#help-development
1 messages Β· Page 1933 of 1
Interesting
Or, it copies to the plugin folder.
Yeah I'm not sure why applications are allowed to replace and humans aren't :(
Honestly, I didn't even realize reloading plugins was a default bukkit command oop.
It is, but it reloads everything rather than one plugin
That can be fine if you only have a few plugins on your server
But many larger plugins will break if you attempt to reload them
So it is often necessary to have a plugin manager to reload individual plugins
I see, makes sense. Yeah I'm just using the one I'm working on currently so it should be good enough. Thanks for all the tips tho π
wouldnt this cancel the whole event? for each player? I basically wanna make it so that 1 player cant get the see the message if thats at all possible
sorry I phrased it wrong
Yeah you can do getRecipients().remove(target)
alright let me try that out
ah it didnt work
do I have to save it to any variable?
The implementation isn't guaranteed I guess
ehh oh well it wouldve been a cool feature but its fine without it, thank you π
How can I get all variant of tropicalFish?
Does the explosion of blocks come in blockbreakevent?
does anyone know why this is not working, what it is supposed to do is make it so that only a furnace named "Reinforced Furnace" will cook at 3x speed yet when i do this any furnace cooks at this speed any ideas?
No
Run your code through a formatter please
how do i do that?
In eclipse, ctrl + shift + f I believe
there is 1 more } there right at the end that i accidentally cut off just so you know that isnt an issue
What's not working about it
Oh
You're doing == on a string, for one
You need to do a.equals(b) instead of a == b when comparing objects
this is whats wrong with it
No, you can always use == with null
There's a lot else that could be wrong with this
you're firing the method outside of the if, so regardless of it having the metadata or not, it'll cook faster
But that's what stuck out to me
That's also true
You're also adding 3 to the cook time
Wouldn't this only ever increase how long it takes?
no it triples it ive tested it
Not to mention the 1600 thing - this will only run for 1600 ticks after the furnace is placed, after that it will stop
So, 1 minute
ok ill test that
i did that because thats the coal burn time
ok ill test it and tell you what happens
You're listening on FurnaceBurnEvent
I wouldn't do it that way though
I would just schedule a task on FurnaceBurnEvent that runs indefinitely, but cancels itself when the furnace is no longer cooking an item
so how could i do that... i think i might have an idea
Just don't keep a time variable
And cancel the task when the furnace is no longer burning
Doing it this way, I think FurnaceBurnEvent would be run every time a new item starts being smelted
And cancel the task when the furnace is no longer burning
and when furnace is no longer there π
That too
wait how would i get the event to indefinatly run
just dont cancel it?
if it only runs when the furnace starts to brun
But the issue doing it your current way is that if they use a fuel that lasts for less time than coal, it would keep increasing the smelting speed
burn
For example, if they used sticks, it would eventually apply that 20 times
So it would smelt... I guess 60x faster?
Wait no coal smelts 8 lol
So 16 applications, or 48x faster
so basically i changed the stuff on my code now and tested it and nothing changed
Does HumanEntity#dropItem fires PlayerDropItemEvent?
Which event I need to track and cancel to prevent players from removing items from chests? (But allowing them to add)
?tas π
aw no embed
Hello how do i make this colored on console ?
Output:
[Spigot]: Configuration have been reloaded
Code:
Bukkit.getLogger().info(ChatColor.translateAlternateColorCodes('&', "&a[Spigot] Configuration have been " + "reloaded"));
For colours you need to use the console command sender
Your reload command should work for players too so this should be automatic
its still doesnt work
Bukkit.getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&2[Spigot] Configuration have been reloaded"));
omg the md_5 legend
Does calling unload on a chunk, when there are players present, unload the chunk?
I know how to summon him
Type "scoreboard packets" in the chat
2000 iq
hey md_5 i have problems with scoreboard packets
does your console support colours
yes it does
idk then
I laughed a bit tbh
yay
Be more creative
"I hate spigot api and i will use packets for scoreboards because async performance"
caching for sure
I don't think bungee ever got a working scoreboard API; mainly of course for that clash reason
Question: using packets for nametags and player list displaynames would make me the abailty to use a per-player scoreboard?
(to understand: not using packets just destroys all the displaynames, when using getNewScoreboard(), and everyone's name will become white (currently using the /team feature))
does the plugin's logger supports "{}" for placeholders or is that another?
ewww
Yes
oh alright
unfortunately you have to specify the level so you cant do logger.severe("something went wrong, {}", errormessage)
Yeah
Then write a wrapper around that
πΆ
Isn't a simple image easier?
No, ΒΏAnd the Nickname of discord? With what font?
excuse me? why u declare a discord bot as js?
THATS MY BOI
No for DC.js
ew python
i use java for bots π³
You are a true legend
Is in Canvas that font?
Dont play a moderator
Legends use C++ and Python
This is funny.
Who's gonna get kicked for what?
My message was basically just for fun. People use whatever they want.
There is no wrong, or right here
Each humans are other
Having a look, the kick was because it wasn't related to help development and it seems like you were told to stop
should i startup a database sync? (in onEnable)
So, stop saying that put directly on image, how i put the variable of Nickname directly on image? , O can't, true?
Just say me how i use that font on PHYTON, no discord js
I am developing a command api, want to ask an opinion, here is comparision https://paste.md-5.net/wusawubeju.java (i know there is some ready things but i didn't liked them)
any ideas on why this isnt working?
it used to be getItemInHand() but i changed it
I don't find nothing
because tahts deprecated for 1.8
Helps if we had the actual lines lol
im doing it like this, just the idea of having a base class which handles the onCommand looks better for me
https://github.com/FourteenBrush/MagmaBuildNetworkReloaded/tree/master/src/main/java/me/fourteendoggo/MagmaBuildNetworkReloaded/commands
anyone?
Thats for draw, no for download fonts
yeah but u still have to manually chack for argument length and cast them
that was the main point i was trying to avoid
yea that might be something to look at
How?
just accept what you need Player, int, double not String[]
- i have a cool tab complete system
im just overriding onTabComplete π
I want to download the font, no to use on PHYTON, i know how to use
yes, so you can disable plugin if something went wrong
I just want a link for download font
nah but i mean if you're doing it sync, the plugin wont disable until all the db stuff is done right?
yeah, but my point is to make it easier, and clear cuz i hate checking for argument length, this nesting in if/else and check if something is int or not, catching NumberFormatException, and so on
A link for download
Google "find a font"
you can do it asynchronously
yes, thats unavoidable
if you want that font go ask the people who made it what font they use or look on a font website
well my database shuts down on disable so iguess i have to do it sync on disable
Isnt there
They dont help me koya
That bot is in your discord it has your logo on it. Figure out who owns it and ask them. If they won't help you then good luck
well that can throw a nullpointer too
that's handled too
that's how spigot one is bad
and .doubleValue is unnessecary iirc
no slap, smh
maybe, didn't really checked, but the point was to demonstrate the unnecessary verbose of spigot's API
you would need to handle the neccesary arguments outside the command instead of doing it inside so whats the point π
wdym?
you don't handle arguments yourself
hey
it is already handled in a finalized class
you just say "i want double as my first argument" and the api provides it to you, you don't need to do anything else
you don't check arg's length, you don't check if it is a number, you don't cast it
you just accept it as a method argument
hmm i like handling the logic in the command :D
you like nesting and if(args.length > 0) ?
I think I quite like this idea
Life is good, but it can be better
i don't understand wdym handling logic inside command
the api just picks the method which argument signature fit to the command sended
like you said, check for argument lengths
you don't handle it outside yourself
it is already handled
one-time and forever
and for every command
i meant to answer this
if you dont handle logic in the command, in my case it will become a few lines of code which gets executed, which will defeat the point of having a class for each command lol
i dont like annotation frameworks lol π
why?
i mean, nothing wrong with coming out with another
RedCommand exists, it uses files
you are not going to like a lots of frameworks then haha
it looks like.. too messy
π³ you're right xd
i created my own stuff and i like it :D
i don't think so, you might have different ways of execution same command, with different arguments, but instead of checking length, types and casting, you just define separate method for each signature of command possible
so you just say, if the player passed a string which is a player nickname and a string which is double, execute this method, otherwise, if player passed a string which is a double, execute that method and so on
i think those that develop big enough plugins can appreciate that
yeah but honestly, it is quite ugly because of 3 nestings
hmm yea i understand
and it is also qute logical, because each method handles only ONE scenario of issuing a command, instead of putting all possible argument combination in one single method
which can become really messy with big commands
what about the concept of subcommands
in my opinion 'dynamic' argument combinations will become difficult to adjust your tabcompleter accordingly
but i understand what you're doing
i don't see anything dynamic here, all possible combinations is defined in a class and can't be adjusted at runtime
well to let the tabcompleter know what type it can expect
without too much exceptions like for casting etc
well, the tabcompleters are made the same way as the command methods, just with different annotation
ah
just annotation changed from "CommandSyntax" to "CommandCompleter"
cloud command framework on top
it is not annotation based, i tryed using something like this and it super messy with big commands because of VERY MUCH nesting
but for small commands it is porbably a good choice
i just have different methods which handle all of the command :D
It supports annotations. Nesting is easy to avoid as well
Is there a way to disable the Tab-Complete for names, or at least modify them (using packets maybe)? It seems to be locally saved so it's taking the name tag value I set at an earlier point (onJoin)
Currently I tried "PacketType.Play.Client.TAB_COMPLETE" with "onPacketSending" overidden but the server doesn't even detect a tab complete from the player
What tab completion of names
when you press Tab with no commands in
That happens? Neat
Thats client side. You need to fake player list to make it working
Ty will look into fake players lists
https://paste.gg/p/anonymous/5f98c13c5c544fc18f15b9ecff6ddaca
Thats how we handle commands w/cloud
looks quite good, but i dont like the part where instead of accepting arguments directly in method you need to get them from conext, and also that you need to manually map method to its signature
i like making method(int arg, Player arg1) instead of method(Context ctx) and then getting arguments + mapping them manually
You can do that with cloud annotations
is cloud command standalone or library?
but.. annotations are very straightforward and does not support abstraction at all. Idk i just prefer builders at that point
ACF had a lots of hacks
library? wdym by standalone
should i put it's jar in plugins folder of server or not?
no, you shade it yes
How do I add value into list in lambda?, idk why my list doesn't have any value
is getStats being executed asynchronously?
that looks weird, i would expect a forEach
yes?
if you're doing something async and then go back to sync, the sync thread doesnt know whether or not the async stuff has already finished or not so in your case the list isnt filled yet when the sysout is called
idk if im explaining it very good
That is the api and im not able to change to sync
Thatβs why you need callbacks or futures
^^
taskChain
future 
So any idea to save it into List? Using callbacks?
you can block the thread with a lock object
final Object lock = new Object();
() -> {
// ...
lock.notifyAll(); // notify that it is done
}
try {
lock.wait(); // wait for it to be done
} catch (Exception e) { e.printStackTrace(); }
// ...
Meh
Dont think about getting result, think about what are you going to do with it
or use bukkit tasks that run sybc
Either you have a thread safe list which operates atomically, and then just save the content on whatever thread you might be in, or you schedule a task on the server thread which saves it to the list.
interesting i will try
Yes but finalize sucks
There are so many flaws that come with it
Use a WeakReference + ReferenceQueue or just handle it with sth like try-with-resources
send an empty list
Using this code
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF("KitPvP");
player.sendPluginMessage((Plugin) this, "BungeeCord", out.toByteArray());
My problem is that when I click the icon, it won't do anything than just sending me some errors into the console.
I guess I really messed up, but how can I fix this?
NOPE
Finalizers and destructors work in vastly different ways
The concept is similar.
For one, finalizers can cause memory leaks :)
Three lines of the error:
java.lang.ClassCastException: class neonowlgery.*************.core.lobby.menus.LobbyGameModeMenu cannot be cast to class
org.bukkit.plugin.Plugin (neonowlgery.*************.core.lobby.menus.LobbyGameModeMenu is in unnamed module of loader '
*********.jar' @14977039; org.bukkit.plugin.Plugin is in unnamed module of loader java.net.URLClassLoader @484b61fc)
Or Java 9's Cleaner
Yes. Three lines
Does LobbyGameModeMenu extend JavaPlugin?
You are casting a class to plugin that does not extend plugin
Cause its not the loader. π
Yeah
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
im talking about how finalize() is called when an object is cleaned
They're still different implementations
You're comparing the general idea of them
Is that phantom only, or does it support weak also?
Cleaner works off phantom references I'm pretty sure
π€
It's a wrapper around them
Fun fact: It started out as internal API but ig people liked it
i know but they are both used to 'prepare' objects for destruction
java.lang.ref is like one of the most mysterious packages.
Okay I lied actually
java.lang.constant is
java.lang.invoke is pretty mysterious as well but not as much as constant or ref
And I say this because you don't realize it exists until one day when you're like "Damn I wish we had reference types for primitives or whatever" and you type Reference in your editor and find WeakReference and SoftReference and shit
And you're just like "tf are these??"
π€
Using the loader would be better for changing servers?
(in most of yours case: "Main class")
what
Any idea what method/packet it is?
Or I messed up everything by using VeloCity?
a method is like a function in java and a packet is a piece of information sent over a network by an application to communicate with other applications across the network or the internet
Not too complicated though.
Weak = A reference that is essentially ignored by the garbage collector. If a weak reference exists and no strong references exist, an object will be cleaned regardless of the weak references.
Soft = A reference that doesn't get cleaned ever until the JVM requests more memory.
Phantom = Like Weak in that it doesn't impact garbage collection, but if a phantom reference exists, it will be sent to a ReferenceQueue when the object is being cleaned (making it similar to finalize but much safer and faster)
(And a strong reference is just your regular types like Object o = new Object();)
Ik I'm just asking which packet handles player lists π
oh lmfao
PlayerInfo one
Best application of this is uhhh WeakHashMap
Which stores keys as weak references, therefore acting as a sort of lightweight cache.
So we have a weak boy reference, a soft boy reference, but no cat boy reference
Yeah π
sad
Won't that interfere with name tags and stuff like that?
it will
We do have a ghost boy reference tho
you'd have to fake tablist
Spooky boy reference
Maow on his way to make the world's first
CatReference
Ah this is a headache π . I think name tags and name tab completions use the same name variable. Might have to find another way then
how do i draw a rect with opengl lol
Good question
How do I draw a rectangle with OpenGL?
doesnt it like vary per shader
the data you have to provide
AnnoyingReference will randomly free objects from memory
yes
using Unsafe#free()
i think thats a thing
It's uhhh
Unsafe::freeMemory(long address)
I believe
I bet it's just a direct mapping to free from stdlib.h
oh ye
Lmao that's great
yes very useful also
"oh well there goes the server instance
So then I guess implementing JavaPlugin to the game selector menu won't work. π
What will a cat reference do
No. No it won't.
Meow when it gets cleared.
lmfao youll get spammed with "Maow"
Looks in console
10,000 lines of meow
yeah
It's like a real cat! :D
Ignore you when you call it
Heh
So you recommend me using the load class for sending players to another server, right?
SwearingReference
Fuck i got deallocated!
Shit there i go
Idfk, I don't use BungeeCord lol
Uhh it's all over the place but
In Java 9 it's like under the jdk.unsupported module or smthn
oh its in java.base
Oh lol
lmfao
Umm... wow...
So I can make my plugin just unreference the server
I use Spigot tho so I know the basics of Bukkit :p
And I know you can't instantiate a plugin nor can you have multiple classes in your plugin extend the plugin class.
But I'm not sure what "the load class" is.
Unsafe is fun
Actually I am sending the player to another server from a Spigot plugin
Because sometimes you need to change a private static final value
You can do that with reflection.
You'll need to communicate with bungee to do that
One sec
But from the loader class (or main)?
Cause implementing JavaPlugin into the selector menu doesn't works.
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
Wow. π
It works fine, I can use the JavaPlugin method, but it just throws me errors
field.setAccessible(true);
try {
final Field mods = Field.class.getDeclaredField("modifiers");
mods.setAccessible(true);
mods.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, /* ... */);
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}
That's possible ^
Not anymore
Java doesn't let you reflect into Field
But yeah on Java 8 and below it's a fun hack
Java making itself unfun
Exactly
"Nuu you can't refwect that, you naughty boi, you're gunna bweak stuuuuffff"
Shut the fuck up Java
who I am
i wish there was a command line option like -Dunsafe=true
Oh there kinda was
But they removed it
Yeah
Java 17 removed this flag that allowed you to open all modules for reflection.
bruuuuh
I was truly pissed when I found out about it
Anyway there's a good chance Java 18 will remove Unsafe's memory allocation methods in favour of the Foreign Memory API.
yeah but that api seems cool
So people're gonna have to come up with much more creative solutions to unsafe reflection.
It is!
also where tf is the jdk.internal.misc.Unsafe native code
You mean I need to use the channels, right?
Correct
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
You can ping me btw otherwise I won't respond if I'm not here.
Isn't this the code for that?
I'm not sure haven't done my own sending stuff for ages.
You sure a bungee cord command isn't what you want?
Wait
Btw
Don't I also need an incoming messenger?
I just found an old programmer pickup line I wrote
Hey baby, are you
sun.misc.Unsafe? Cause I wanna engage in some unsafe internal access with you ;)
Sending player from Spigot server... without command. c.c
Ah. Yes you'll need to send messages between plugin->bungee
lmao
π€
So I really need that incoming crap
Crap? Mmk
I don't even understnad, what arguments I need to give to it. xD
Plenty of guides on it out there
'k I guess this server doesn't have any commands for that πΉ
hello, i was wondering if it was possible to use multiverse commands with condition commands
π§
for exemple, i want that when a player wears a specific item, it executes /mvtp
Thats a #help-server question, though. Conditional commands is a plugin?
no it's vanilla
I mean through code you could probably avoid needing to execute commands
mvtp Kandda test [nbt={Inventory:[{Slot:103b,Count:1b,id:"minecraft:carved_pumpkin",Count:1b,tag:{display:{Name:"{\"text\":\"test\"}"}}}]}]
i tested with this syntax but nothing happens
mhm
Isn't this an XY problem
so i'll just have to put this with execute if?
?xy
Asking about your attempted solution rather than your actual problem
what?
I can't really find what I need...
read a minecraft wiki article on execute command. It is a powerful instrument, actively used in datapacks or command blocks
execute if entity @a[nbt={Inventory:[{Slot:103b,Count:1b,id:"minecraft:carved_pumpkin",Count:1b,tag:{display:{Name:"{\"text\":\"test\"}"}}}]}]
ya but what about this?
Why are you trying to do it this way?
i'm trying all ways
They say itβs even turing complete π
i want the one that works
Or more accurately what are you trying to do
make an auto execute for a player when he wears an item
so in my case the target command is /mvtp
how do i get the boss bar from an existing wither?
Just make a plugin that listens to playerinteractevent check if right click confirm if item in main hand is not null check if item has itemmeta then check if it has a displayname and then check if it has the correct itemname after that execute the command
i'm not good at making plugins
Good 1.14 times.. I almost did a battlegrounds minigame with a datapack
just wanted to know if bukkit supports mv for that
You won't need to execute a Command they have an API
who do
Its time for you to learn then.
This is legit the basics
ya i planned to
Merely planning wonβt get you far
but it's kinda something that i need to do rn
Exercising and practicing it will though
is it possible to disable all caves and ores in a world
I've litterly given you what you need to make in plain english
all you need to do is have a good look on how to make a basic plugin and dealing with events
They have an API it makes it easier than executing commands as well
well as i said i need to do it rn
y
yas can you explain?
Disabling caves and ores
They have an API that allows you to use their plugin through code
Kanda anyways if this has nothing to do with programming than Iβm afraid you should move to #help-server
Hi guys! is there any way to loop for each Material entry and add it to a list?
Material.values()
ty
why even add it
u have an enum ready
Yes but i'm trying a thing
List<String> materials = Stream.of(Material.values()).map(Material::getValue).collect(Collectors.toList());```
if u want it as a list
Something you can't already do with the values?
or List<String> list = Arrays.asList(Material.values());
will this disable the withers bossbar from updating?
ah
this also works
but not sure why would you use it
Hi, im trying to spawn a hologram
It works fine on 1.8 clients but falls into the floor on 1.7
Im not asking why i should support 1.7
i asked. 1.7 is unsupported at all
yeah. I see your point, but different servers have different player bases.
I agree with this
is this a public plugin
thats why im making my own plugin
it is not officialy supported, not supported by enthuisasts either. You are on your own
1.7 yikes
Just use the Holograms plugin 
any alternative for #setCursor on InventoryClickEvent since its deprecated
player.setItemOnCursor maybe
I know it can be used still but asking if there are other ways
doesn't exist
what version ?
1.18 api
maybe i can just event#getCursor#setAmount to 0 or set type to air
idk if it gets fired though or mutable
dont know what is wrong with player.setItemOnCursor
will do that first then the one I said
Hello is there a way to check if a player his inventory is full?
inventory.getFirstEmptySlot() will return -1
player.getInventory().firstEmpty() == -1
Is using "this" in a static context really that illegal in Java? π
everything is illegal in java
lol
its not clean code to set something to "this" when the obj is static
player.sendPluginMessage((Plugin) this, "BungeeCord", out.toByteArray());
that line
requires
that this
but the IDE says
that its illegal
Xd
are you in your main class?
Ofc
'cause I cannot do that in the game selector
but I somehow need to reach the loader
statics don't get initialized or instantiated
But just implementing it won't work with private Loader lapi = new Loader();
might need to use a singleton instance rather than this
It will actually crash my plugin
You also shouldent need static methods in your main class
You should just get access to it via a singleton instance (or DI) and then call the method
calling by plugin.sendToKitPvP(player); or something like that?
yeah
generally itd be on the lines of PluginMainClass.getInstance().sendToKitPvP(player);
ofc getInstance can be named anything, as long as that method exists in the main class as static
Still does nothing... π
Just says that it is already inited
...
No mind of what
Never gonna fucking use the code Loader loader = new Loader();
It just fucks up my plugin
And I've fucking had enought
is Loader your main class?
Yes
ah so thats why
Because it just loads
yeah that will throw an error
You would want a static variable of Loader in the top of your class, not initialized, in onEnable set it to this
Then have a way of getting that variable, and you have a singleton
no that doesnt matter
In this case my main class is named AlphaCentauri, (I am using lombok, but you could just create the methods)
Lombok π
You would create an instance variable, and then in the onEnable set it to this
always
What?
oh
Cuz I think IntelliJ is hard
I wasn't even able to modify my plugin
and it makes the plugin have a long package
which I don1T want
that just means you have to learn more about it
I started with Eclipse, then moved to IntelliJ as Eclipse was crashing a lot for me lol
how is that possible?
may have been a crappy pc, bad ver, could be a lot of things Β―_(γ)_/Β―
Didnt care to troubleshoot it
So basically
When having done the instance
Where do I exacly need to use it?
In the game selector, or in the loader?
You can use it anywhere to get your main instance
You can also make that sendToKitPvP method not static, I presume its static based on the error
Which would allow this to work in it
So you mean, I should make the sendToKitPvP back into the gamemenu? π€
you could
Up to you
Just without it being static, you can use this, or the instance (if you are accessing from another class), and yeah you could have it in another class
Intellij is simple as dick
(instance as a variable is unused)
But still much powerful
With 4GB of RAM, I am not gonna use it for sure
in another class, yes you can
Anyone got an idea how to display Gif in 1.18? As the plugins that does that isnΒ΄t updated because of the new packet handling
oh ok that makes sense
Or if it is in your main class still, and the method isnt static you can just use this
I sent it back to the game menu
And now it says the same... -.-
java.lang.ClassCastException: class neonowlgery.*************.core.lobby.menus.LobbyGameModeMenu cannot be cast to class
org.bukkit.plugin.Plugin (neonowlgery.*************.core.lobby.menus.LobbyGameModeMenu is in unnamed module of loader '
**********.jar' @7ef6f50a; org.bukkit.plugin.Plugin is in unnamed module of loader java.net.URLClassLoader @484b61fc)
Yeah, just a way to display a GIF ingame, normal images works fine but atm I canΒ΄t find a GIF version
The JavaPlugin? π
you are casting LobbyGameModeMenu to Plugin somewhere
Rather than using an instance call I believe
Nah
I removed the JavaPlugin casting
as
?di
but it still says the same
Which is weird
Because the code is not actually coded xd
β¨ Constructors β¨
Depends where because the plugin is a whole core
Containing a lobby
and a KitPvP in the inside of it
By the
public LobbyGmaeModeMenu(JavaPlugin plugin) {
}
```?
It is deleted.
Instance in Loader is unused
π§
π Main-Class named "MainClass" π
Actually
You want me to put back the depenency?
Man
It made no sense to delete it then...?
"Class" or "Object" prefix is unecessary verbose
Its called Loader
?main
Hey, can someone help me using eclipse-plexus-compiler on gradle? I'm trying to solve this issue on my project https://www.spigotmc.org/threads/cannot-access-net-minecraft-server-v1_16_r3-packetplayoutplayerinfo-playerinfodata.497496/
I have for days
I'm already using spigot nms
Having
public static Loader instance;
public void onEnable() {
instance = this;
}
also does the same error π
https://dba.stackexchange.com/a/13705 I want the rank's going from 1-2-3, and if it's a duplicate then I want a random change of getting it 2, and a random chance of getting it 3
Actually. Coding in "BungeeCord" while using VeloCity is a bad idea, or is it?
It's velocity
two different platforms right?
Hey Conclure, can you help me with this? I know that you're really familiar with Gradle.
aglerr tbf Idk how you specify a compiler with gradle
I think thats an ide setting moreover
Here's how it's done in maven https://paste.md-5.net/xiwevagefa.xml
Oh, you dm'ed me. I didn't notice.
actually
Tbh, that really doesn't help much it's just the dependency for the compiler.
compileJava.javaCompiler.set("eclipse-plexus-compiler")
that ought to work
hmm
actually
Tbh that sounds more like a workaround
It accepts Property<JavaCompiler>
java.toolchain {
vendor = JvmVendorSpec.matching("eclipse-plexus-compiler")
}
that's probably the more solid solution
I dont get the problem, 1.16 nms worked without any problems for me
Ye same
Try to play with PlayerInfoData
I still get the bad RuntimeInvisibleParameterAnnotations errors on compile
wha
Maybe, but when I'm really stuck.
I have 3 modules tho, so that's why I don't want to switch right away.
This is my goal btw https://www.spigotmc.org/threads/packet-discovery-spectator-mode-modifications-noclip.319125/, you may asking why but all I want is put player on spectator mode and completely removes the hotbar.
Hi guys! Is there any way to get the entity a player is looking at? if yes, how can i do so?
do a ray trace
how?
world.rayTrace
max distance
The distance
ok
see javadocs
#939505914224996382 pls :)
Show us the errors.
@EventHandler
public void onWalk(PlayerMoveEvent event){
if(plugin.getConfig().getBoolean("enable")){
Player player = event.getPlayer();
if(player.getLocation().getBlock().getType().equals(Material.STONE_PRESSURE_PLATE)){
player.sendMessage(ChatColor.RED+"Launched");
}
}
}```
I wrote this piece of code but the problem is it shows to send me the message Launched but instead it does nothing
You want to get the block under the player instead.
Or you can just use PlayerInteractEvent and check if the action is INTERACT for pressure plates.
ok
Also to compare enums, use ==
is there an entity move event on 1.8.8?
No
Looking at your code, your dependency injection thing is wrong.
Instead of a pressure plate, I used a diamond-block but it still shows the same thing
can i do something similar?
You can certainly do that with the WorldGenerator but that's too much for me xD
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
or Chunk loading stuff idk
It's kinda similiar of what you're trying to do but that'll solve your issue.
Show the code again
you can do repeating task, but, meh, just move to something newer
k
Is there even EntityMoveEvent on newer version?
at least on paper there's
Hi guys! Is there any way to remove a player from the TABLIST while still being online?
Oh on paper, okay
You might need to use packets
you can hide it
yeah thats fine
Or that
the real question is... how? π
i know i can but i don't know how!
Player#hidePlayer i believe
and that will hide the player from others right?
But that will make the player "invisible" also
yes
i'm making a sort of vanish so thats ok
Oh! Then use the api method
?
Wow nice site, tysm
Yeah it's called javadocs btw.
didn't know that, ty
what happens when i call someFuture.whenCompleted(lambda).join() (the join thing)?
does it only returns the T param or does other stuff too
Thats for working with multiple CompletableFutures
The plugin.inv is null.
how does that work?
that multiple futures are calculating a part of the thing you need?
make it private and make a getter
You can access like that however I suggest you to make it private and make a getter.
Also initialize it so it won't be null.
It's null because you haven't assign a value to that field.
@EventHandler
public void onWalk(PlayerMoveEvent event){
if(plugin.getConfig().getBoolean("enable")){
Player player = event.getPlayer();
if(player.getLocation().getBlock().getType().equals(Material.DIAMOND_BLOCK)){
player.sendMessage(ChatColor.RED+"Launched");
}
}
}```
it was supposed to send me a message when I step on diamond blocks but it does not do that
CentralisedFuture<Clan> first = this.clanManager.getUserClan(player.getUniqueId());
CentralisedFuture<Clan> second = this.clanManager.getUserClan(receiver.getUniqueId());
CompletableFuture.allOf(first, second).thenAcceptSync(ignored -> {
Clan clan = first.join();
Clan receiverClan = second.join();
});
@tardy delta
Get the block under the player.
Multithreading advanced code
ok
Getting 2 clans at the same time π
Yes, it's pretty basic thing on java
i will never understand multithreading and futures :C
Well, you have two futures which completes at the same time
with CompletableFuture.allOf you create the future which is going to be completed when those two futures will be both completed
ah
join() just gets the result
and then you get the result
yep. Since both futures are completed, it is not going to cause thread lock
does this looks good tho?
yep seems fine
but, assuming that Lang enum is mutable.. that suck
I have a dilemma whether use public static fields for config value or an enums.
I store not only String, but also a List, boolean, etc.
both are not the best idea
I suggest using a fluent interface, declaring defaults by annotations:
public interface MyConfig {
@DefaultInteger(3)
int someInteger();
@ConfKey("display.user-message")
@ConfComments("The message shown when a certain thing happens")
@DefaultString("Hello user")
String userMessage();
@ConfKey("display.enable-user-message")
@DefaultBoolean(true)
boolean enableUserMessage();
@IntegerRange(min = 1, max = Integer.MAX_VALUE - 1)
@DefaultLong(10)
long boundedNumeric();
@DefaultString("ONE")
MyEnum enumValue();
@SubSection
NestedSection nestedConfigSection();
@DefaultString("https://github.com")
URL validUrl();
}
And then work with configs like any other object
The code will be too long for me xd
eeh
There's a ready solution:
https://github.com/A248/DazzleConf
something.getMyConfig().userMessage()
I took the example from here
I'm not really for annotation-based code flow
i dont see anything wrong
I know, there is nothing wrong but it's too long
manual parsing would be worse in terms of LOC
i cant think of the shorter solution
Probably records and java serialisation, but that isn't really configurable
True tho xd
I love records
i don't like annotations too much; but, in terms of something that simple like configs, it's just easy!
I use them semi-sparingly as eclipse has a hard time grasping the nullabillity of the implicitly declared methods
eclipse moment
Most don't have annotation-based nullabillity checking enabled so I'm not really surprised that it is wonky from time to time
does anyone know of a way to control and ride an entity through 1.8.8 with NMS? I cant find any tutorials or forum posts on this
I myself declared war on any annotation that has the RUNTIME retention
i love lombok
Oh yeah, and those too
lombok sux but eh
i'm talking about an island https://en.wikipedia.org/wiki/Lombok
π
Well, it is more the @Inject annotation that really sparked my hatred towards those
but it's so helpful to not write getter and setter
i would use it if it's not hated by majority lmao
Pro tip: avoid setters and getters
let's ignore the fact that any IDE can automagically generate those
It has some cool stuff like @Delegate or @SneakyThrows
smh why does <Void> exists
for example, Futures that return nothing
although i find it really annoying when trying to search where the method is located
i know it's stupid to write this
with lombok, it is going to be located NOWHERE
i'd say thats fine
If you code well you will never look at the code after writing it
return null; is annoying tbh
Why is this not a consumer?
CompletableFuture means that it should return a fallback value on fail
how to detect block under the player?
Well, this is a Function
Okay.... So using the code line....
@SuppressWarnings("resource")
DataOutputStream data = new DataOutputStream(out);
makes absolutely no sense, because it just throws a f#cking error....
java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/libs/org/apache/commons/io/output/ByteArrayOutputStream
And also makes the plugin crash... -.-
There are several ways.
- You can get the location and reduce the y by 1 and get the block
- You can also get the block and then use
Block#getRelativemethod
but the CompletableFuture#exceptionally does that only gets called when the completion threw an exception or is it from the for example database too?
I already tried a fucking yt video
What the fuck else do I fucking need to fucking do to just fucking send the fucking player to the fucking KitPvP?!
Stacktrace please
thats a lot of fuck
what
It is just dreadful that the DataOutput-izΓ© requires a suppress warning, and crashes the plugin, and without it, I would get an error
does it gets called when the future is interrupted or stuff?
Use try with resources
it gets called if future completes exceptionally. For example, a SQLException
?notworking and give the stacktrace
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
ah right
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(out);
try {
data.writeUTF("Connect");
data.writeUTF("KitPvP");
} catch (IOException e1) {
e1.printStackTrace();
}
player.sendPluginMessage(Loader.getPlugin(), "BungeeCord", out.toByteArray());
i thought it only handled completion exceptions
please close the stream
or even better
try with resources
π€
Okay, then check your imports, make sure you import java.io.ByteArrayOutputStream
call the close method or use try with resources
not the Bukkit one
try (DataOutputStream dout = new DataOutputStream(out)) {
// Do data output stream magic
}
Now that explains much more...
don't forget ByteArrayOutputStream too
lol
u know closing ByteArray streams has no effect
It is time to kill myself... π
Static analysis
it just looks cooler π₯Έ
JIT will compile it down to NOPs anyways - probably at least
whas a nop?
no operation
Is there an way to add config entries through bukkit/spigot api?
i'm using the default config.yml in the resources folder
yes use the configuration api
Format nop
Forms nop = 0 (0x0)
Operand Stack No change
Description Do nothing.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you could create a new file too
and load it with YamlConfiguration.loadConfiguration(file) which returns a fileconfig object to work with
i dont want to code an own config. i want to use the default file.
in getConfig there are many things like addDefault or set. but i dont know what of these i could use to add an entry
okay and can this also add entries if they are not exisiting or does it throw an error if i set an nonexisiting entry
?config
?configurationapi
?configapi
what
this is not the day?
?configuration
it adds them if they arent present already
it still not the day dessie
okay thx
Very broad question but what Backend database or service should I be looking into for synchronizing the same plugin data across multiple servers?
this is a pretty good explaination but you'll need to search a bit
https://bukkit.fandom.com/wiki/Configuration_API_Reference
java.nio
Relation Database + Message broker
Or netty if you are less stupid, and if you are really less stupid then you'd probably go with MariaDB or Redis
MariaDB x Redis yep
Redis
I was looking at a Mongo/Redis combination
mongo is for noobs
ik
shut it Mongo is great
but thats doable too
Easy, wich is why I want to use it
I don't really care about scale since this would be for a small server, I just need the data to be the same on all servers
ok
what would i save to the database instead of a world name which is null?
so if a location isnt associated with a world what would i save
how can i give effects to a player
Player#addPotionEffect
sql supports NULL values]
ok thx
i'm wondering if im trying to get Bukkit.getWorld(null) if that will work
prob throw an npe
?effectapi
could do like a check, if world == null use player.getWorld
actually I should prob do something like that in my plugin, just realized a fast way for an NPE lol
ah in craftplayer class
Anyone has any experience modifying the Declare Commands packet?
https://wiki.vg/Protocol#Declare_Commands
Trying to edit it using Brigadier, but having no luck
hello
public void AdvancementEvent(PlayerAdvancementDoneEvent event) {
NamespacedKey namespacedKey = event.getAdvancement().getKey();
String key = namespacedKey.getKey();
if(key.contains("mine_diamond")) {
if(level != 2) {
event.getPlayer().removeAdvancement("mine_diamond");
} else if(level == 2) {
level = 3;
Bukkit.broadcastMessage(ChatColor.BLUE + "OP Item Level: 3");
Bukkit.broadcastMessage(ChatColor.BLUE + "Next Quest: Enter the Nether.");
}
}
}```
why does removeAdvancement show up in red