#help-development
1 messages · Page 166 of 1
so what part should i remove
You need to have a messaging system between the proxy and the server for queuing, I would recommend looking into redis
how do you mean run it on the proxy?
the io.github.nosequel.tab. part
done
The proxy can have plugins too
how exactly is a proxy set up? Like I said very new to this so if there is some kind of basic resource somewhere that could help
Alternatively to redis look at this https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Google bungee cord
Do note that PMC does not work if no player is online
^^^^ didn’t know that because i don’t use it
To store data can I use .yml files and different servers can access it
Use a database
or would it have to be a database
Database
Well you can, but that'd be an absolute pain in the ass to manage
why?
is redis the only good option here?
atomicity
mongo to store player info and redis for real time
why?
why?
so you dont accidentally delete a file
or the server crashes or something
and everything is gone
thats why
its also just much better in general
Eh, those are weak reasons
and it’s s l o w
@quiet ice
Even worse reason
I normally use .yml files to store data in my spigot/paper plugins and it works fine, but they are just very large files
Compared to the reason that it is insanely hard to share files across processes - all those reasons are minisicule
have to ctrl+f to find what you're looking for
use mongodb
so much better
like
SO MUCH
Or SQL as it's much lighter
SQL is pain from when I tried to learn
sql is ez
SQL is worth learning
insert, select, update, remove, create and thats all you need
Would I use the db to store data like players in a queue? and what kit they have selected?
No?
I tried when I was nooby, I’m sure I would be fine with it now.
not even remove its delete idk I use it once a year
Generally you wouldn't want to store that outside of volatile memory at all
right
only if the server shuts down and you absolutely need to save it
https://learnxinyminutes.com/docs/sql/ you can have a look here
Well if you want selected kit to carry across servers then yes store it there
(protip: You can use PMC for that)
Do I need to create a plugin for the game servers and a different one for the lobby server?
Haven’t used it at all
@Override
public void run() {
for (int d = 0; d <= 90; d += 1) {
Location particleLoc = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ());
particleLoc.setX(location.getX() + Math.cos(d) * size);
particleLoc.setZ(location.getZ() + Math.sin(d) * size);
if (color != null) {
particleLoc.getWorld().spawnParticle(particle, location, particlecount, new Particle.DustOptions(color, particlesize));
} else {
particleLoc.getWorld().spawnParticle(particle, location, particlecount, 0, 0, 0, 0);
}
}
}
}.runTaskTimer(instance, 0, delay);``` why doesnt this spawn a circle of particles it just spawns 1 particle
Probably a better idea
No, just have the plugin be aware wether they’re in a game or not.
But you will need a separate for the proxy
You likely need to
why…
yea
Okay I'm going to do some more research on proxy and revisit this, thanks for the help
Though you'd want to use Minestom for lobbies
how do you mean?
minestom is amazing holy crap
Bungee is just a proxy, where are the lobby itself will run on spigot or a fork of it (or if you are adventurous - minestom)
minestom for game and lobby servers 👍 (joke but it’s what I do)
or for fun put it all on 1 server and watch how little resources it uses!
it really do be
slightly buggy
what is pmc
What I linked above
redis?
plugin messaging channels
oh sorry I see
I’ve had weird issues with players not seeing any of the blocks in an instance and just falling through the floor…
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
minestom compatibe with spigot or smth?
I legit didn’t even fix it I just cancel the death now and do my own
nope
wondering why people talking bout minestom
because ✨ lightweight ✨
kinda unfamiliar with it
Hence why minestom should only be used for minigames or lobbies
uh I think there's a test server
Minestom itself is just a framework
:o
Imagine spigot but without any world generator, entity spawning logic and all that stuff
I never joined it I just find the API nice and its quite lightweight so I use it
😭
https://wiki.minestom.net/ there's this if you wanna quickly skip through what its like
rip
C++ and Py
None of those are DBs
at Uni I need to use Py and JS so far lol
c# is a very good db
average key/value store enjoyer
java is bigger
I prefer using sun.misc.Unsafe for DBs 😎
anyone?
Debug the locations it spawns the particles I guess
maven tries to find my local artifact in the spigotmc repo rather than my .m2 folder
Maven will use the maven local repo over any other repository ... are you sure you pushed it correctly?
tmrw is going to be a long day :(
well your code is bad
And are you sure that you didn't change the directory of your maven local repository (unlikely, but possible)?
you instantiate new location every loop step
Oh wow, 90 allocs is the end of the world
take your particleLoc declaration out of loop
Vanilla gets away with hundreds of thousands of allocs
Nah it’s epic
mafs?
some small Java
Because there are practically no rules
Maths
And you can customize features you normally can’t
ah my problem solving is basically math
networking boring asf
Math + Java + English + notRelatedAtAll
and systemmanagement is probably breaking another pc
English is the language of the internet
oh wait I have python lmao
bae
well actually gonna have 2 more computer-related courses next symmester
i have html/css aaaaa
What is particual reason for that? We always learned that vars should be declared in smallest scope as possible
one for linux
Discrete Maths (1h30) Python (1h30), Analysis (maths) (2h30), Linear Algebra (1h30)
ye create location 99 times and setX setY
Or just create it once
and in loop just change x and y
ok ty i found the issue
is it possible to change the particle's speed? rn they go flying everywhere when they spawn
well particle is an enum
you can't modify it directly
but
declaration: package: org.bukkit, enum: Particle
that's all you can modify
i meant change it in the spawn method this is what i have rn particleLoc.getWorld().spawnParticle(particle, particleLoc, particlecount, 0, 0, 0);
you can change the speed using /particle (the vanilla command)
declaration: package: org.bukkit.entity, interface: Player
and i checked the docs i didnt see anywhere saying speed
ah well thats rly anoying...
what kind of particles are you working with?
flame
o ok ill try it ty
anyone have some reliable code on getting the spigot version at run time
I found this online
final String packageName = Bukkit.getServer().getClass().getPackage().getName();
return packageName.substring(packageName.lastIndexOf('.') + 1);
but for some reason I feel like this isn't going to work properly
spigot version or you mean nms?
I neeed server versions so I can load the correct NMS module
what is the package format? I really don't want to have to load up minecraft right now xD
org.bukkit.craftbukkit
sth
idr exactly
havent touched spigot in a while, youll have to excuse me
yk what I'll just check it with an onenable thingy
thsi is what I use java private static final String NMS_VERSION = Bukkit.getServer().getClass().getPackage().getName().substring(23); private static final Method DEDICATED_SERVER = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".CraftServer", "getServer"); private static final Method SERVER_LEVEL = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".CraftWorld", "getHandle"); private static final Method SERVER_PLAYER = getMethod("org.bukkit.craftbukkit." + NMS_VERSION + ".entity.CraftPlayer", "getHandle");
legend 🔥 thanks
get method being ```java
/**
* Obtain a Method via reflection.
*
* @param clazz a Class to access.
* @param method a Method to find.
* @return Method the Method, or null if not found.
*/
@Nullable
private static Method getMethod(@NotNull String clazz, @NotNull String method) {
try {
return Class.forName(clazz).getMethod(method);
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}```
I'm using mojang mappings and doing maven modules 🤷♂️ though reflection works as well I guess I shoulda probably done that xD
This is what I use to remove the need for version specific imports
I have interfaces set up like this
public interface NMSInventoryHandle```
🤔 yea I was just going to use further abstraction to do that tbh your way is def easier
what version are you on
?paste
Optional<Method> but thats personal preference 😉
Optional would be absolutely useless
imo it is already pretty useless
better than nullchecking every time
fourteen is pretty much right
unfortunate that null checking is so much faster
You are all fools
aint talking about speed?
You want for it to crash if it can't resolve the method
I feel like you're a person that relies on null for every problem they encounter
And there is no way to recover from it
This would be the most preferable outcome
nope I rarely do null checks unless needed but Optional is just a fancy nullcheck wrapper
nevertheless, you shouldn't use null for every little thing
Optional only makes sense if it is reasonably expectable for it to be null and it is reasonably expected for developers to be able to work around it
who?
In this very specific case, it is not possible to react nicely if it is null
using Optionals for everything is essentially equivalent to use nulls for everything
(unless you are using NMS "for performance")
hey, someone know how i can get the uuid of players who never been on the server before
?
ahh yes I use NMS for "performance"
Never told you to use optionals
but at the very least, don't spam null on every method
never said I did lmao
spamming null lol
I just think optionals are un-needed in java
At least in the java of the future
it wont work, it says nullpointer when im trying to grab one
Optional::map is nice
whats being null?
null makes sense
it does not
why wouldnt it
_
I like null
Being a non-fatal error or being an uninitialized value
here's an example
you were already told
yeah, i got it like he did wrote it down, but it wont pull a web request i guess
imagine you have a method getEmployee(id), and you want to return null if there is no employee found with that id
how does an employee being null make any sense
Because there is no value?
where is the plugin.yml version displayed?
null = no value so you know there is no employee with that name
I'm pretty sure an employee isnt supposed to be a value
lol nice @fossil lily top result for now
Do note that throwing exceptions is INSANELY resource intensive
that's where we're supposed to fail fast
especially unchecked exceptions
It's exactly what we're going to do 👀
or return null objects
tf
I was searching usage of EntityAttackEvent ¯_(ツ)_/¯
e.g Employee.NOBODY
because for player -> entity damage I use FinalAttackEvent but it doesnt work with entity -> player
Congrats, you just defined an alias for null
You for sure aren't going to use Unsafe#allocateInstance for that value
smh this chat
will entityattack covers all so
No
whats Unsafe#allocateInstance doin? allocating memory for a new object?
yeah thats true but I dont get a prettified event.setBaseDamage 😂
the whole point of avoiding null
is to avoid NPEs and polluting your code with checks everywhere
actually all of these are useless except setBaseDamage
Counter point: Assume Employee has a field called name of type String. What are you going to populate it with? String.UNDEFINED?
whats the difference between
if(object == null){
// actions
}
and
if(object.isEmpty()){
}```
Creates an object but does not run the constructor
avoiding nulls is pointless though. You still have to error check any alternative, like an Optional. You are simply adding a greater overhead than checking for null.
an empty string or "NOBODY"
rust not having null but having Option<T>
i mean you cant really avoid unpresent values
this is a better explanation of what im trying to say:
https://www.yegor256.com/2014/05/13/why-null-is-bad.html
Why NULL is a terrible practice in object-oriented programming? Despite the fact that it is used a lot and everywhere, this article tries to explain why you should give up this bad habit.
I just .damage
and use 1 as default
you can make it easier to deal with trho
tell me
im sueing
I've been doing nothing but staring at this for the last minute
yoink
Yeah I read that. I disagree with some of it.
For example, the point about ambiguous semantics. Only relevant if you are not using annotations.
whatchya' working on?
lets go Employee.NOBODY
as for throwing exceptions rather than return null, arguable
Employee.LOUDBOOK == Employee.NOBODY
Which way too many people don't
I mean the issue with null is that it cant really be expressed at type level, the higher ordered objects aka types yk imho
a hypixel skyblock 1:1 ripoff
i mean catching exceptions is slow
(unless Mono, Option, Optional etc)
Which means we should push the use of annotations 🙂
... ... ... good luck
null and exceptions have different usecases to some degree
ty I'll need it
Exceptions catching is not that slow these days
slower than checkign for null, but not that slow
tru
Also, assume you have a method called LineReader#readLine() - are you really going to throw an exception if there is no line - this will just cause needless
String lastLine = "";
boolean hasIterated = false;
while (true) {
try {
lastLine = reader.readLine();
hasIterated = true;
} catch (IOException e) {
if (e instanceof EOFException) {
break;
} else {
throw new RuntimeException(e);
}
}
}
if (hasIterated) {
return lastLine;
} else {
throw new EOFException();
}
instead of
String line = null;
String lastLine = null;
try {
while ((line = reader.readLine()) != null) {
lastLine = line;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
if (lastLine == null) {
throw new EOFException(e);
}
return lastLine;
gonna be 1 per island
you should actually not even have such class
yea you shouldn't even read files
ima see how heavy it'll be
lemme send you another link
if its lightweight enough I'll keep it
not true
in the view of elegant objects its seen upon as something less attractable
How the hell are you going to read individual lines of code then?
as we treat all objects as living organisms
return an empty string
looks bloat asf
Unsecure
then null is supposed to be more secure?
my handlers :(
Yes, because null means "not initialized", by design - where as "" means "a string of length 0"
I see no problem with an empty line, being empty (of length 0)
Rip my design structure all my NMS classes have Handler at the end
It does open up security vulnerabilities in some contexts
returning null is a bit problematic, but lets say you have some function where "" and null would represent different results
then null might be needed
Especially strings of size 0 are problematic given that they fuck up many hashing algos
then you should refactor
simple
not necessarily
lol too bad you need it for some things
what if the result was "" 👀
also are they even finished yet
if your method expects you to understand the result based off "" vs null
then that makes 0 sense
if you facade between modules of different levels of abstraction then that might be necessary 2hex
An empty file vs no file
what can you do with nms + spigot that you cant do easily with minestom
idk what minestorm even is
Although in my example for the sake of fairness it will never return null at all
do you know if there is a packet to change the name above a player's head?
but if its less popular and I will make less moeny from it no need to use it
It's only within the method (and the methods it calls) that null is used
Minestom
Well, there are cases I guess
Returns the same either way though
though less common
yeah, but I agree avoid null if possible
RIP to builders?
is minestorm even finished I was under the impression no one had finished one yet
nope sorry I think I've seen multiple discussions about that and it didnt seem easy could've been a while ago tho
its finished
i mean its always getting updates but
Let's hope yegor thought about that
is it finished for every version? major
Removing the builder pattern also contradicts the no-nulls theory unless you love insanely long constructors
1.16.5+
Builders are needless junk if taken literally - so they are superfluous according to that post
but use latest
https://javadoc.minestom.net/net/minestom/server/network/packet/server/play/PlayerInfoPacket.UpdateDisplayName.html not sure if this is the same thing
declaration: package: net.minestom.server.network.packet.server.play, record: PlayerInfoPacket, record: UpdateDisplayName
Actually, EO also says that constructors should be really empty
and dont even argue you need 1.8.9 becusee server performance is amazing on 1.18 with minestom
tried that, only updates in tab
yikes
but how does it contradict to the "no-nulls theory"
I think you need to respawn the player
yeaahh I think that was the issue
Okay empty ctors, no nulls and no builders is a recepie for disaster since you just removed all compile-time fuck-up pprevention systems
not empty ctors, but they should be relatively short
With empty I mean no args
args are okay, according to yegor
If args are allowed there is still a saving grace - but that means having either extremely complex/dense OOP or very long ctor calls (both boil down to the same thing) for very complex models
🤷🏻♂️
Either way I'll still use null due to it's fail-fast properties
yeah tho tbf builders and null arent the best when it comes compile time safety
but I understand what you mean
Does anyone know how to send a message to a player and then clear it a few seconds later?
ex. Wynncraft's dialogue system
still didnt work :(
In the chat or above the inventory?
yeah uhm every conversation about that did not go well lol
Hi! how can I prevent players to place items in a custom inventory by using maintained right click with a stack of item ? The event doesn't seem even detected
But they extend -er
yep it isn't detected with it
it seems that I can with the add player packet actually but I can only use 16 characters, including Color.BLACK and other stuff that isnt part of the string. I might just add a armorstand passanger
damn thats annoying
im asking the disc if they have any suggestions
all in main?
in b4 you get told to use github discussions
Yeah ofc
man I hate that place
😂
we're meant to evolve not devolve goddamn it
perfectly reasonable
:(
public class InventoryEvents implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getClickedInventory() == null) {
return;
}
Player player = (Player) e.getWhoClicked();
player.sendMessage(e.getClick().toString());
}
}
2000 loc is a weak number anyways
Consumer ends in -er too my friend
Weak.
Just rename Consumer into Supplied and Supplier into Consumed
Will totally not consume confuse anyone at all
it sends the type of click detected but when i'm using in a maintained right click to distribute equitably the items in multiple stacks into the custom UI, nothing is detected and nothing is cancelled
i cutted it but here is my whole event :
https://pastebin.com/kX4X6SKY
yep the rest is correctly working
i mean, all other click types are detected and cancelled normally
can someone help me? I am trying to make this plugin work without needing to be an operator in the server but it only work if the player has the op
check for permissions
in plugin.yml and permissions set to default: true
that too
the code it's to long, I am trying to "break" it
?paste
it's basically this
I think there is 2 problems but I don't know how to patch them. The first is that when I shift click from my inventory the inventory selected isn't the custom one but the inventory of the player, so the event isn't cancelled and the second is that drag clicking items isn't just detected. So how can I just prevent the player of touching his inventory when he is in the custom inventory ?
Before it I've put the hasPermission
The function only work with op players
But I wanted to work with everyone
well dont use hasPermission lmao
That's the point, I am not using it
Yeah
yep but dunno how x) it's why i'm asking because at my knowledge I can get the inventory from where the player clicked but not when the player is clicking in his own inventory
It's used in other function, but it's not related to that one
messy 🍝
Well, I am new with programming, sorry
what I tried to do it's that the player can walk behind another one, if it's crouching it can "steal" the other one
And it worked, but only with Op players
For some reason
ooh okay thanks so much I couldn't find it
Chat
Yourself
Only thing that I wanted to only op player do its the command and that checks
then it is a lot of effort that I am unsure is worth it
uh okay but my FactionSelection implements an InventoryHolder not an InventoryView so how can i check if they are corresponding 🤔
that would count as fall damage
void damage counts as suicide too iirc
hm
Bukkit being bukkit ig
How so?
You need to buffer the chat and resend it to clear the chat
With the new 1.19 update it gets even harder
Or well - at least it gets harder if you want to do it right
I want to clear a specific message from the chat after a certain amount of time
Not the whole chat.
guys, no to be boring, but because I am starting with coding, what are good plugins to try making it to develop my programming skills?
hence you need to buffer the chat
So basically save the entire chat log and clear the chat and then resend it with that message removed? Or just resend the chat with the message removed?
If you were to clear the whole chat it would be easy - just spam a lot of empty messages
latter
If I'm not mistaken, there's actually a Clientbound Packet for deleting chat messages.
good ideia, I will try
Nah there isn't
thanks bro
Unless you are not talking about the same chat I am talking about
How difficult would it be to log the current chat that can be seen and clear a specific message then?
Because with the action bar and title bar it is a lot easier
not too difficult, just cumbersome. But other plugins make NMS a necessity
I am using NMS currently in my plugin anyways.
that's what venturechat does
you just gotta make a fixed-size deque
let's say 200 elements
where you log the chat packets
actually not a deque, just a list
I'd need to log that player's current chat log then delete that specific message and resend it then? (How would I log the chat that the player is able to see? Is there a packet or something for it?)
thanks all is working perfectly now; i'm pretty new with the Spigot API 🙃
I guess deque would be useful
Outbound chat packets
Right.
yep but sometimes i'm a bit lost and don't find what i wants like today
That doesn't sound too difficult. Thanks everyone! 🙂
The only problem would be logging private messages so those don't get nuked in the resend process.
?
Hey im having an error when I run build tools
Cloning into 'Spigot-API'...
fatal: invalid branch name: init.defaultBranch =
applyPatches.sh: line 16: cd: /d/BuildTools/Spigot/Spigot-API: No such file or directory
Resetting Spigot-API to Bukkit...
HEAD is now at 0958895a SPIGOT-6274: Reloading configuration does not clear previous values
Applying patches to Spigot-API...
fatal: could not open '../Bukkit-Patches/*.patch' for reading: No such file or directory
Something did not apply cleanly to Spigot-API.
Please review above details and finish the apply then
save the changes with rebuildPatches.sh
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, sh, applyPatches.sh]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:973)
at org.spigotmc.builder.Builder.runProcess(Builder.java:904)
at org.spigotmc.builder.Builder.main(Builder.java:703)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
I want to add a /msg command but I'd need to make sure that those messages don't get destroyed when chat has been resent to clear a specific chat message.
Have download the lastest version ob buildtools?
does playerinteractevent right click air just not work or smth?
is it fine to send packets async
should be
Doesn;t fire with an empty hand
using an iron hoe it doesnt trigger when i right or left click air
i havent tested any other items
How would I log the current chat history that the player has currently since that's what I'd need to resend?
PlayerInteractEvent#getAction() == Action.RIGHT_CLICK_AIR
ik
it has those
but its just not triggering
for some reason
weird, do oyu have any other plugin running?
what are u trying to do atm?
detect right click and do stuff from that
anyone have ideas?
https://paste.md-5.net/releyoturi.java
(ignore cooldown check, havent reloaded the server after adding that stuff)
ok ig
lol?
any ideas?
ok
nope
If you want to get assisted please must be patient or open a thread with the issue waiting patientlly for getting answered - Thanks, Alex
tryna make sure it doesnt get drowned out 💀
unless you mean dynmap trying to summon a stackoverflow demon but thats a different story
so then threads are your best friend!
Send your code please
?paste
dynmap's code not mine, it just doesnt like my chaotic biome provider
my code is here
only thing i changed since then was priority
no difference
aside from cooldown check working bc i reloaded it to check priority
so rn it only works when i right click a block
nothing else
dead chat 💀
ok so with debug, its nothing with my code
its simply just not being triggered
Anyone know if there's a way to put Glowing on non LivingEntities?
Was hoping to put it on an Item entity in the world but it appears effects are gated to LivingEntities and above only.
You mean Glow like outline glow or glow like enchant?
Glow outline
try using a library. I'm not really sure if it's possible using the minecraft API
Ty. I'm going to see if I can do some packet magic but if not I'll look for a library
can't you just do Entity#setGlowing(true) ?
i'd use a consumer instead of anonymous classes
yeah
new MenuItem(arenaItem, "&7Multiplier", 13, pl, event -> {
Player player = (Player) event.getWhoClicked();
// ...
event.setCancelled(true);
});
basically you write the exact same thing a lot, which is extremely uncool, you can think of better solution
the only change is name of itemstack and QueueType
yeah use lambdas and functional interfaces (giving you some terminology to work with just, but alex and nuker told ya alr)
i'm sure you can shorten this a lot
MenuItem class might look like this then
public class MenuItem {
private Consumer<InventoryClickEvent> consumer;
public MenuItem(ItemStack item, /* ... */ Consumer<InventoryClickEvent> consumer) {
this.consumer = consumer;
}
public void onClick(InventoryClickEvent event) {
consumer.accept(event);
}
}
would like to see your MenuItem realization tho, cuz other way there's nothing more we can suggest
all the real ones do
private final Map<Integer, Tuple<ItemStack, Consumer<InventoryClickEvent>>> items;
what's so good about Object.equals
over ItemStack#equals(ItemStack);
Oh i see
that's where Object.requireNonNull comes from
I assume Objects.equals is null safe
well, that's not a problem to define a null check in your equals() realization
depends on developer tho
need to look through ItemStack sources
well equals() still is not symmetric
since for instance
Object o = null;
sout(o.equals(other));
throws
(which is why Objects::equals can be used as it first checks a == b before a.equals(b))
maybe intellij is so smart that checks sources or smth
@Override
public boolean equals(Object o) {
if (o == null) return false;
// code
}```
done
yes but thats not the same
if the variable you invoke equals on points to null then you get an npe
oh true
but apart from that yeah
well, basically if you have an NPE here, that's your fault and you have to fix it anyway
true
ah well Eclipse's ui is what turns me down for most part
the only underline i hate is scanner.close()
when you only have main method
when you run eclipse debug and method comes to the end, scanner closes automatically
hmm yeah prob
but it still gives underline
tho try-with-resources is the superior here afaik
yea
i just switched to it
but now i have one more } in the end
and all code 4 spaces to the right
myeah, could refactor the contents of the try statement into a separate method
but it outa be fine right
sadly uni doesn't care much about enterprise in my experience
like how its done at the job
if only
we learn gui and sorting on java rn
oo
and i'm the only one in the group who actually knows java
💀
so yeah i can't even ask to send me some code
which i'm too lazy to write
i really don't wanna touch gui after my first java game
wanna try btw?
ugh sure
I have 8-19
alr i'll send j17 version
understandable
yeah
do you store player objects in queue
?
or uuids
if you store uuids, you don't need to cast entity to player in this code
how can I get item at index 0 from arguments of command?
args[0] ?
It's there a way to detect to see when the player get online in the server?
I wanted to delete a certain item because when the player get to the server, the item kinda mess up with the login plugin, so I wanted to check if the player it's holding that item (when he enters the server) to delete it from its inventory
PlayerJoinEvent
Hey, I have a plugin (on a bungeecord server) and I'm making a command to join a survival server easier. Instead of using the bungeecord's /server survival I want the player to be able to just use /survival. When I run the command /survival it says it is unknown. I know that it is talking about the command I put in the plugin to run after the player runs the other command however, because it shows it as a command when I hit tab in game. Here is my /survival command class:
public class Survival implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
return true;
}
Player player = (Player) sender;
player.performCommand("server survival");
return true;
}
}
When I use /server survival in game, it works, though.
have you registred that executor somewhere ?
thanks
and in plugin.yml I have it listed
just sudo them
can you show it
player.chat("/server survival);
why does player.performCommand not work?
@Override
public void onEnable() {
new Damage(this);
new Break(this);
getCommand("spawn").setExecutor(new Spawn());
getCommand("survival").setExecutor(new Survival());
}
and you get no error when starting srv ?
show full code it might just be a OOP thing
Hello, I have a quick question right here
What's the difference between running a task Asynchronously and running it normally?
well its relative if you look at it more objectively
but in short, async means some code x runs on some thread that is not the server thread
and a thread is like a seperate process/queue that can execute independently, such that it doesnt have to wait for other threads to run some given code
most of the things are on the main thread so put your plugin's maths async
So is running a task Asyncly better than normal?
no
Async has some problems
only put maths and java-related things to async
not spigot-related
like list operations
- Memory visibility
- Thread allocations (the resource management)
- Update tasks (set a new value based on old value)
Alright thanks
?learnInventory
these are specific to Java tho
xD
Maths? It probably takes longer to spin up a new thread than it takes to just do your maths on the main thread.
Sometimes, maybe if you do extremely long and big computations
well depends on maths you know
then you could use a pool like fjp common pool to decrease the overall latency of the computation (which is eagerly initiated)
It's just that some people think everything should be on an async thread, and it actually takes longer.
yeah its a trap
What, sqrt might take 500 nsec?
Hi love, how are you?
I really miss you
We used to talk a lot 💔
@rapid vigil anyway in addition, we use it to either increase throughput (for instance the amount of users a service can deal with at the same time)
or we use it to decrease latency of a task
yeah im good, hope you're doing well ntl
that's just generally faster to use pow(2) instead of sqrt
https://pneumonoultramicroscopicsilicovolcanoconiosis.club/0tnnuF1p https://pneumonoultramicroscopicsilicovolcanoconiosis.club/WlidZR0n
????
why cant I .effect or .levels
so like use distanceSquared() > distance() when searching for closest of two objects
Oh alright, thanks so much for the explaination
Weird never seen you can do that with enums
smh
I mean enum class (arguments...)
switch to records then
i learned that records existed like 2 days ago
cool
But java classes arent more recursive than enums in terms of resources?
recursive`?
recursion
enums are java classes
int i(int b) {
i(b);
}```
recursive isnt it that consumes a lot?
depends
that why i hate fucked english because if you dont explain a context doesnt make sense
sorry for my bed england
resource intensive maybe you meant
i selled my wife for internet connection
recursive means that a function calls itself within its definition
to play counter strik
I cannot talk my gf sell online coffes🤦♂️
confusion
good night
well functions specifically
values cant really call themselves
im being very nitpicky now
see you soon, good night my loving
but functions can call themself, cannot them?
i know
Is there a way to download a coding app and code spigot plugins on phone?
sorta
Wait really which where
So my final question, are enums mutables or not?
Ive seen someone deploy a vsc web service
nevermind
and then through the web work on a project using the vsc web interface to work on a project
version control, basically github
https://www.youtube.com/watch?v=q2viJSYyKio @rapid vigil
this is the closest to what Ive seen
which is actually nice to work with
not inherently
Oh alright I'll check it out, thanks
gn
I would use a cuboid region
use a BoundingBox
I would create another class just managing the cuboid region and include it in the game object
yea
I would defintly put a good name
I would a keep a ref in the Game obj
Because if not i will looks really mix to understand
Please dont be trolling
Im being serious
na
class Dodo{
private final boolean x;
private final int y;
public Dodo(boolean x, int y) {
this.x = x;
this.y = y;
}
}```
effectively the same
Given any class X, for all instance variables of X, then there exists a constructor for X that takes all instance variables of X.
id say its useless
or well, meaningless to be precise
yeah, tho its more inflexible
like what if you want your constructor params named differently than the fields
or want to add/remove fields or params
How can I create a new NameSpaceKey for my custom enchantment?
learn java looping arrays
I mean this is more of a modulo question
Yes, you can do a roundabout through an array with the modulo operator. System.out.println(foods[i % foods.length]);
Not really he's just trying to print the elements and doesn't understand arrays.
oh I see. you are correct
Maybe I missed earlier conversation then
I missunderstood the question
Is there a way to prevent a mob from spawning?
I wanted the warden to not spawn at all
And also the wither, but since it's a "ritual" só spawn idk if it's possible
Entity spawn event should handle all entity spawns
It should still be caught by CreatureSpawnEvent
Looks like it from the docs
I will try both, thanks
does Enchantment#getByName(String); still work
?tas
Bind Webserver and Mc server to the same port
when is onDisable() called? is it called at the beginning of the plugin disable sequence or at the end of it?
at the start
https://pneumonoultramicroscopicsilicovolcanoconiosis.club/PD6alAGy https://pneumonoultramicroscopicsilicovolcanoconiosis.club/Y2w86Sjg anyone know why its not showing the enchantment below it?
how can i get a player from their usernaem
Bukkit.getPlayer(username)
do cmd args start from 0
attributes
do I need an attribute modifier?
its not attribute
i know that
you must have ItemMeta#addItemFlags(ItemFlag.HIDE_ENCHANTS);
🤔?
is it possible to get PersistentData of a player from PlayerQuitEvent
I'm spawning in a a boat with world.spawnEntity(grid_pos_1, EntityType.BOAT);, how would I get an instance of that boat
What
player.getPDC?
was this to me or RRS?
I didnt get what you mean
wdym instance
it’s not an object
idk if thats the right word
im kinda new to plugin development
i want to put a player in the boat
boat.addPassenger(player);
Yeah whats the problem
does world.getEntity not exist?
i dont think so
If not just loop through and find the one you want
as in loop through all the entities?
yea but I could be very wrong
spawnEntity should return you the instance of the boat
you just have to cast it to a boat
how would i do that?
looks like you are not only new to plugin development
👍
If a player have open inv and he got kicked. will the invclose event get force called? or the inv will dismiss?
it gets fired even if there is no inventory visibly open
is there a better way then to return a Future<Void> in the saveAsync method?
/**
* Saves the data to the player's file. This will overwrite any changes made to the original file that happened after
* creating this instance.
*/
public void save() {
try {
JeffLib.getNMSHandler().updatePdcInDatFile(this);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* Saves the data to the player's file. This will overwrite any changes made to the original file that happened after
* creating this instance.
*/
public CompletableFuture<Void> saveAsync() {
return CompletableFuture.runAsync(this::save);
}
but people should be able to check when it's finished
or force it to complete now
Have it as a bukkit event to be able to be controlled, canceled, modified, etc
what do you imagine?
wdym?
funny, they still wouldnt know
how should I return a boolean without blocking?
callback is probably the best choice to make
Async bukkit event
otherwise some sort of binding or whatever
:p
thats why i suggested it xD
even if its forge nms can still do same thing
but outside mc yah callbacks; thats my practice at least
Anything event/callback realted honestly
thats the same as returning the CF
events just allow for remote control; call backs are more direct ie you need that exact instance to receive said callback
Object.wait and Object.notify
no need for all this exessive runnable stuff
events; or callback
lightweight; no strain
unless you dont know how Object.wait works; then uh
isnt that basically a callback?
that would just be something his end users could do currently
idk if he wanted something more
like, configured/laid out or not
eg with FunctionalInterfaces or just using that method
he could also return an object with a state
could but now that objects gonna take up space in memory while its being waited upon (Multiple calls might happen at the same time, idk how his saving methods work), not much ofc unless he has like 50k calls a second lmao
honestly
bunch of ways to set it up
just depends what your looking for
i should pr a fix for that
ngl yes
that simple
its modded ofc tho
but tile entities get ticked per tick
so the mc renderer sees that value changed and just swaps its color based on the color set
yeah that part will be annoying
have to get colors from in game
god
"colour"
so gross

why colour
noo
wait
i just noticed that
the fuck?
imma just use reflection then
wait, is there an armour?
Hello, does anyone know how to put spigot mapped on a server?
the server is always "spigot mapped"
damn I didnt know it would be that easy to get an offline player's PDC, and to save it again https://github.com/JEFF-Media-GbR/JeffLib/blob/e0e31672930552a93149a43dc4334d3deb5c085c/spigot_1_19_2_R1/src/main/java/com/jeff_media/jefflib/internal/nms/v1_19_2_R1/NMSHandler.java#L430
is there a way to give a mob a health bar
yeah but you can only use one line, so you can show either the name, or only the hearts, or have both in one line
oh wait
but you cannot use a custom name to show two lines
yeah
actually
that'd be better
how would I do that?
make an armor stand inside of it or something?
armour stands
for two lines, you need to entities, e.g. an invisible armor stand
shit im britishifying
although I'd use Area Effect Clouds instead
lol
idk why I used "armor" because we use "armour"
what's the advantages
area effect clouds have no hitbox, and they cause way less client lags
if you have hundreds of armor stands, the client might get huge TPS drops. hundreds of area effect clouds are no problem though
would i make it teleport to the mob every tick or something?
only downside is: area effect clouds are only visible up to 48 blocks, while armor stands work up to 64 blocks or so
yes
I'm not sure if setting it as passsenger would work, from what I remember this wouldnt work as you won'T be able to see both custom names then
so yeah, you gotta teleport it I think
wouldn't that be way too high as well
idk
also is it normal to make a new class per new type of listener
and how would i create a progress bar
with a min and a max
and it outputs a string
actually
nevermindf