#help-development
1 messages · Page 972 of 1
but still, how does it work?
hold up
April 22-26
it generates a class that implements the interfaces
does /transfer require bungeecord
no
it just requires the packet to be accepted by the other server
if you want to delegate those calls to another object sure you can do that
so minehut wont be able to mask ur ip no more
what if it ain't an interface?
then you can't use Proxy
but rather just a class
if md decides to make bungee work of transfer packets he can do that, if he doesnt he doesnt
then what do I do?
if minehut dont/do they can do that
Proxy is more for dynamically generating an impl of an interface, e.g. you don't know what the interfaces are
surely you can extend a class
unless it's final
gg
it ain't final
but
stuff like this
and I won't do it for each version separately
so get it from the craftbukkit package
or if you wanna support future back Bukkit.getVersion
I mean then you go ahead and spin up your own bytecode gen
using asm or something
to extend the class and do w/e you want
like if it was source code, but without the source code
I'm decently sure libraries exist for that
yes it's called asm
or bytebuddy
which uses asm
or you can have a java source code template
that you then compile at runtime
the world is your oyster
how?
well not yet
also I don't think so since that other plugin is also made by me
that looks like something straight from hytale or minecraft dungeons / legends
Well now it's in Minecraft so it looks like it's straight from Minecraft
I don't know what you want us to tell you lol
Then you might just overwrite it by yourself using the same keys
anyways can u store a map in a pdc
looks like a mossy skeleton
sure
how
serialize to byte array
what if my thingi isnt serializable
Or you can use the data container itself
PersistentDataType.TAG_CONTAINER is just a map
it's an enchants plugin and idk if storing a tag for each enchant is efficient
aight thanks
Usefully likes for plugin Dev?
?morepdc IIRC
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
How do you think vanilla stores enchantments? :p
Links
in a map in pdc
Enchantments: [{id:"", level:0}, {id:"", level:0}, {id:"", level:0}]
It's a list of objects
In which case you're looking for PersistentDataType.TAG_CONTAINER_ARRAY
and just store my custom enchant object?
Well you'd have to serialize it to a PersistentDataContainer, but yeah
Can i make a list of a tag container array
all primitives are serializable right?
Yes
aight
Primitives, strings, and arrays of some primitives
Why would you
That's an abuse of the system
But in short no absolutely not a arrays are meant to be replaced by lists
isn't this impossible because using the same key will make the plugin throw an error
There's no type for arrays of arrays, but no reason it wouldn't work if you added one yourself
String[][][][][][][][][][][][][][][][][][] strings; this works fine
Oh, yeah, that's fine
why would anyone need this
You're discovering the existence of multi-dimensional arrays :p
They're usually only useful up to like 3 dimensions, and even then you probably just want a better collection for that
CabernetMC does everything into the 4th dimension because of our extremely complex nature but for the normies going past 3d arrays is unneeded
i don't remember ever using an actual array in java/kotlin
why doesnt spigot add a world particles event, kinda annoying to use protocollib for such a simple thing
always lists
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
They're very useful if you know you have a specific amount of things
Which tbh isn't mant use cases you'd see at this level :P
I guess what arrays have got is speed
and static lists
u wouldnt need to create a whole list for something like "apple" and "orange"
List<? extends Fruit> xd
anyone?
No. It doesnt unless two plugins register a recipe for exactly the same key.
What about identical recipes
hows that even possible since registering 2 recipes with the exact same key makes the plugin throw an error
Fruit[] array = {Fruit.APPLE, Fruit.ORANGE}
List<Fruit> list = new ArrayList<>();
list.add(Fruit.APPLE)
list.add(Fruit.ORANGE)```
idk abt u but the array seems way more efficient
You can create a NamespacedKey without a plugin instance using fromString. Or get a plugin instance from PluginManager
why in the world would u do that
List<Fruit> list = List.of(Fruit.APPLE, Fruit.ORANGE);
Why not
Any idea?
I'm curious now
array initialization takes less chars than list initialization
Show your code and how you determined that recipes are conflicting. The probability of a user error is very high.
?paste

ik their skin
is he a contributor, owner, discord owner, discord staff, staff or what exactly
no
i want a PersistentDataType.LIST.TAG_CONTAINER_ARRAY
no
does not exist
PersistentDataType.LIST.LIST.TAG_CONTAINER_ARRAY
list of a list of a tag container array
Wouldn't you be able to do PersistentDataType.LIST.listTypeFrom(PersistentDataType.TAG_CONTAINER_ARRAY)?
Plugin1
https://paste.md-5.net/gofekefami.cs
Plugin2 (The one which the recipe disappears when Plugin1 is running along with it)
https://paste.md-5.net/ofukecuser.cpp
how are you expecting to have 2 exact recipes and both work
idk
@eternal night can i do that
i believe there's a priority system or something for recipes
@river oracle what this
Nope, the first registered recipe is the one thats being used
why..
just make plugin1 loadBefore plugin2
the opposite*
plugin2 loadBefore plugin1
no its not 2 exact recipes
Check with /pl if both plugins are properly enabled
its 2 distinct recipes
you finding out I'm lying because I'm trying to stop you from doing something stupid 😭
List<String[]>
i want like 9 d array
why
fun
String[][][][][][][][][]
i did, they're both enabled
errors in startup log?
._.
nope no errors
r ucalling the methods
wdym by this
yea im calling those
whenever i remove Plugin1
plugin2's recipe works
How can i prevent the Swapping of an Item with hotkeys in a Player Inventory, Currently im checking both the cursor and current item if its an custom item, this stops the item being moved around normally, but doesnt prevent hotkeying.
That event doesnt provide any Itemstacks tho, how would i go about detecting it there?
does spigot have debug console or something?
wdym debug console?
something like verbose
declaration: package: org.bukkit.event.player, class: PlayerSwapHandItemsEvent
Do you tinker with the ItemCraftPrepareEvent?
I needed that to, but i mean if i m hovering over slot 6, and then press 1, the item from slot one moves to 6, how would i prevent this?
listen to inv click and inv drag and print whats gets ran
The Inventory drag event doesnt get fired tho afaik
ohhhhh
ok i see where the error comes in
Yea the Inventory Drag event isn't getting fired
public class PlayerCraftingEvent implements Listener {
@EventHandler
public void onPlayerCraft(PrepareItemCraftEvent e) {
CraftingInventory inv = e.getInventory();
ItemStack result = inv.getResult();
// Now this code may conflict with other plugin
if (!getCraftingResults().contains(result)) {
inv.setResult(null);
}
}
}
yea i guess this is what causes it
thanks for the help

Hey guys
Yea
What do you need today?
I got helped yesterday, but it doesn’t work yet
So I changed some stuff
I now when I load the hoverable message plugin, I can’t see my prefixes from LuckPerms
Hello, I have the following problem: I can't join my server because of this error:
I tried removing one plugin, and it solved the issue. The problem is that I haven't really changed something in it, it came itself, I don't really do much in the join event except giving items...
The normal ones in chat or?
Packet to large
Yea, permissions work, but prefixes don’t
ik, but which one ?
32
So I implemented the dependencies of LuckPerms, I did some coding
But it still doesn’t show the prefixes
Should I send the code?
there's no sign tho
You sure none of your plugins has custom signs or the sorts?
Teleporting into unloaded chunks and then sending an oversized packet?
But that shouldnt happen
sec i brb
Sure take ur time
is there a way to take a bunch of primitives and serialize them as byte array like in C?
Packet 32 is not packet 0x32
It's packet 0x20. And what 0x20 is will depend on your client version
or better say, should it not be done?
You are using teh player name not display name TextComponent comp = new TextComponent("" + player.getName() + ": ");
Why is it x20 and not x32?
Packet 32 is the decimal value (base 10). In hex, 32 is 0x20
the 0x20 for wiki.vg is that
Again, will depend on your client/server version
Depends on the version :D
ah
So what exactly isnt working?
LuckPerms Prefixes
I already gave him his answer
Oh
@polar forge
he's using player name not display name in his text
Thank Elgar, he found it!
Anybody got an Idea?
I take the dead silence as a no...
it's the same with a newer version tho
?? why is this happening?
check the ClickType
I know when its a hotkey, but what do i do differently when its a hotkey?
So it should be: TextComponent comp = new TextComponent("" + player.getDisplayName() + ": ");
Yea
Oh ok
if the slot you want to protect is clicked then cancel
If feel so stupid not thinking of that
Silly
This is what I did to test locking a slot```java
@EventHandler
public void onClick(InventoryClickEvent event) {
if ((event.getSlot() == slotToLock && event.getSlotType() == SlotType.QUICKBAR)
|| (event.getHotbarButton() != -1 && event.getHotbarButton() + slotToLock == slotToLock))
event.setCancelled(true);
}
@EventHandler
public void onSwap(PlayerSwapHandItemsEvent event) {
if (event.getPlayer().getInventory().getHeldItemSlot() == slotToLock)
event.setCancelled(true);
}```
you'd also have to check in teh drop event
This is pretty strange, even if I’m not op, I always have this colored name
And that prefix
you only modify the name in the join event
anything you do after will not alter teh prefix
Why do I see the &c then?
you see &c because you didn;t translate color codes
What do u mean?
either u start using § or u translate color codes xd
They are already translated in the code
ChatColor.TranslateAlternatColorCodces("&", message) or something
i honestly dont know what you are askin rn
player names are modified onPlayerJoinEvent in your code
you don;t translate color in any code you have shown
- Why do I see &c
- Why do I still have the red name and &c if I’m not op and I’m in the default group
Is toggle shift called when in an inventory?
what prefix are you getting from LP?
My prefix is &c
then
To make my name red
translate it
because you have the hoverinfo.admin permission I guess
it only updates when you join
cause thats how your code works
changing the permissions doesnt trigger a playerjoinevent
What’s the solution then?
„the solution“ doesnt exist
theres a million ways to habdle this
you wanna change the username on every chat message?
what
is the displayname
there might be minutes between chats, so anything can happen
also permission expiry can affect it
and changing worlds
so he needs to check each time the player chats
its not a heavy query
Just create a methodjava public String getFormattedName(Player player) {
then do in there what you currently do in in teh PlayerJoinEvent
except don;t set the display name, just return a string
I think I’ll just keep it on join event
but thats a stupid solution
no it isnt
Far from it
thats exactly how almost every single chat plugin works
voss
PLS READ
use ur brain
you DONT modify display name
DONT MODIFY IT
BUT THATS WHAT HIS CODE DOES
and I'm telling him NOT to do that
youre telling him to update it on every chat message
I literally just told him to create a method to return a formatted String
no
read this again for me
?
im on phone
close discord, close the app
and then open it agaim
kk
I win, you suck 😛
But guys no need to have beef with each other
nuh uh
We just playing 🙂
this is spigotcord
yh we love each other
it will nto work in join
But I have now the problem with the null and &c
yes you do
So u guys told me to translate it right?
I never coded for a translate so it’s my first time
I hate when sites don’t show an example
thats how documentation works
Could I just use
Hey my server got griefed is ther a way to rollback my server for 3 hours
prefix.replace(‘&’, ‘§’)
Do u have coreprotect?
don't
i do but i also need inventory's rollbacked
you could do that, but don't. Use the provided method
Inventories wont work
Ok I will
cant i rollback the server for 3hours by changing a file?
Do
if you have backups, yes
/co rollback time:2h radius:30000
but that wont change inventory's
No
where can i see my backups?
what makes your backups
cuz i didnt make the big back up thing.
but i think i got something called auto backup so i just have to rename a file i just dont know where to find the file
is it a plugin
ChatColor.Translate doesn’t exist
Ok
the methods returns a modified String as Strings are immutable (can not be edited)
Crazy
But I already have a prefix = is it ok if I make another one?
when trying to use TAG_CONTAINER
int
Like this?
I know it’s wrong
But in that file it doesn’t explain what u told me to do
do i need to input map or what
no, you input a PersistentDataContainer
how do i create one
how i can set for living entity path to location
No wait
It’s actually
prefix = ChatColor.translateAlternateColorCodes( altColorChar: '&', prefix);
Is that right Elgar?
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
you can get the context of a PDC and ask it to create one for you
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
But is it correct?
you should learn java to know that
Ok then it’s correct
But how do u translate null?
I now translated every code that started with &
I've told you countless times yesterday to take a java fundamentals course and come back to spigot. Even if you were spoonfed this entire project (as it is right now) you will not be able to create more projects freely later on, you'll have to depend on others to spoonfeed you code while you don't know what you're doing
I understand what I code
...
That’s what I receive in my console
you don't know java.
null represent something that don't exist
you can't manipulate it
Yeah yeah, that's quite obvious 😅
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
PLEASE.
bruh
because you translate null to "null"
basically
so it's working, but you can't use it to translate a color
(message deleted, because my stupid ass couldnt differenciate the files "buildData" and "buildModeData" )
Is possible to disable or modify minecraft recipe book?
the crafting is client side, you could use a resource pack to hide the crafting/recipe book icons, still it could be accidentally clicked on and used.
Use a mod if u want to disable it, or get a plugin that cancels the event when a player puts an item in the crafting menu
Anyone know of a solid lockable chests plugin?
make one 😜
lockette pro
True, but why do that when one already exists
How difficult to update that to 1.20+ compatibility? If you know
does it not work?
when I used to run a server (a few years back), I used LWC (I think that's what it was called?) and it was pretty good, although I'm not sure if it still gets updates
It just says 1.14-1.19, wasn't sure if that might cause issues with a 1.20+ server
Me too, just in case
We'll have to check on that if lockette doesn't work
Hmm
sure, I just checked out of curiosity, and it looks like someone else has taken it over. It still receives updates, with the latest one being in february, and it's available for versions 1.8 to 1.20
https://www.spigotmc.org/resources/lwc-extended.69551/
Lockette is kinda goofy
Def like this more than lockette, seems lockette has become quite outdated
Thank you both either way, @remote swallow ,xellon
How to make an inter-server auction, can you explain the principle of operation, what should it be with the help of the data?
I figured out how to break it within the first 30 seconds of loading it up lol
pls
what broke with it?
When I placed a sign on the chest, entered the editor of the sign then exited and it switched from [private] -> [error]
are signs re-editable now?
It said something about adding people to the chest, “right click the sign and then type /(I forgot the command) but it just enters the sign editor
only two things come to mind, either you didn't setup configs properly or you gave yourself all perms
yeah pretty sure 1.20 added editable signs
Well I put it into a local host, cuz I’m not sure any conflicts with the server that needs it
And I least need to figure how to use it to test it, but then I broke it haha
quite possible then if lockette hasn't been updated that this will indeed break it since it isn't designed to handle this
I am quite familiar with lockettes code, well up to a point anyways 🙂
BungeeCord related question: java player.connect(info, ServerConnectEvent.Reason.COMMAND); what does the Reason do
Lockette is 1.14-1.19 on the spigot page, didn’t check the last update
well lockette strictly uses API only methods
hence why it has worked for as long as it has without much needing to be done with it lol
also because it uses signs, no DB is needed either unlike LWC for example
but, the editable signs thing should be actually easy to incorprorate into lockette though
Right yeah, well lwc has more quality of life so I’m just gonna stick with that or perhaps just fix lockette if lwc has conflicts
not hard to fix lockette
really its just adding an additional listener
cancelling if the sign doesn't belong to the person trying to edit
Yeah not saying the fix would be hard, rather just if lwc works then there’s no need as lwc is updated + maintained as well as quality of life features
if quality of life features are something you need sure
Idk I gave the server owner both of the options so it’s up to them at this point
I’d assume they’d rather quality of life, it’s a survival server and they’ve got some semi large teams
Still, Lockette works perfectly for this, lwc just has the qol benefits
if you think so
what's a good formula to get the middle of lore of an item to put custom enchants lore
high quality english
would reserve capacity
also why is everything object
and cant you reuse the context?
i'm working with Field class
i could reserve capacity yeah
but it's just a one time serialization
and the context can change look
can i see inferCollection?
Guys any solutions for this problem?
Im basically implementing LuckPerms prefix to my Hoverplugin
dont modify the display name and only change what they see on player chat event
^
Could u tell me where in this code I should change the player chat event? Which line? https://paste.md-5.net/xonuguzipu.java
whats getClassFromType?, im sorry im thinking about intrinsical optimizations
remove this
it's just a type converter
and in async chat event called event.setFormat
there's nothing fancy in there
Field::getGenericParameters a thing?
ah no
also whats a generic param on a field even supposed to mean
i love type erasure
i can do this which is nice
This whole code?
you can ask the jvm for the rtti
you could simplify it
what if i have Map<List<String>>
this class is the nicest
what then
mine supports that
one sec
LMAO
dude
this is also why i clone the type context ^
i hope you know what youre doing
i mean the code works, it took me some time to optimize
it's pretty safe
i hope i did a good job with it
`public void setPlayerDisplayName(Player player) {
User user = plugin.getLuckPerms().getUserManager().getUser(player.getUniqueId());
String prefix = "";
if (user != null) {
prefix = user.getCachedData().getMetaData().getPrefix();
}
if (player.hasPermission("hoverinfo.admin")) {
player.setDisplayName(prefix + ChatColor.RED + player.getName());
} else if (player.hasPermission("hoverinfo.moderator")) {
player.setDisplayName(prefix + ChatColor.AQUA + player.getName());
} else if (player.hasPermission("hoverinfo.default")) {
player.setDisplayName(prefix + ChatColor.WHITE + player.getName());
} else if (player.hasPermission("hoverinfo.wood")) {
player.setDisplayName(prefix + ChatColor.WHITE + player.getName());
} else if (player.hasPermission("hoverinfo.wood-mod")) {
player.setDisplayName(prefix + ChatColor.WHITE + player.getName());
} else if (player.hasPermission("hoverinfo.stone")) {
player.setDisplayName(prefix + ChatColor.WHITE + player.getName());
} else if (player.hasPermission("hoverinfo.stone-mod")) {
player.setDisplayName(prefix + ChatColor.WHITE + player.getName());
}
player.setPlayerListName(prefix + player.getName());
}
`
Like this?
sounds like a list of pairs but java doesnt have first class support for pairs smh
is it an open source project?
Just use a record.
would probably put all those types in one file if they're short
i forgot records were a thing
records have ~overhead~ tho if you wanna be very pessimestic
how you even write that word
@polar forge
private final Map<String, ChatColor> permissionColors = new LinkedHashMap();
// Fill the colors from highest perm to lowest perm
public void setPlayerDisplayName(Player player) {
User user = plugin.getLuckPerms().getUserManager().getUser(player.getUniqueId());
String prefix = "";
if (user != null) {
prefix = user.getCachedData().getMetaData().getPrefix();
}
for(var entry : permissionColors.entrySet()) {
if(player.hasPermission(entry.getKey())) {
player.setDisplayName(prefix + entry.getValue() + player.getName());
break;
}
}
}
```fyi you can do it like this
no point to a map if youre only iterating it
iterating entryset is even slower than iterating a list
You can use a LinkedList
Where u put the // should I paste my whole else if statement?
no
just telling you that you need to do that
but use a LinkedList with a record or something
I don’t understand
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
Was this an example?
How can I prevent player from putting items into gui? I have tried many ways, but all don't work
public class GUIEvents implements Listener {
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getClickedInventory() != null) {
Menu menu = Menu.getMenuBy(e.getClickedInventory());
if (menu != null) {
Button button = menu.getButtonBy(e.getSlot());
if (button != null) {
button.onClick();
e.setCancelled(true);
}
}
}
}
yes
Don't bother. He knows absolutely nothing about java, even after our countless attempts to get him to learn java basics
Event#setCancelled()
@polar forge are you perchance Italian
Yep
Oh okay that can make it easier to explain in DMs if you want?
you may be more comfortable in Italian ig
I understand, but don't understand how to check if player is dragging something into gui.
Event#setCancelled()
also if you want to make guis https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
youre only cancelling the event if its a button
what do you guys think makes more sense I have a list with commands and I want to check if a message starts with /<command> should I loop through the list and check if String#startWith or should I split the message and check the first segment and do List#contains
why do you have a list of commands in the first place, why not a map
like subcommand -> instance
Yay maps
I want to have a bungee system that always says "This command is not registred / you have no perms" no matter if you perms to execute or not but I want to have a whitelist that bypasses this and thats why the list
how does that bring you to the list?
I need to decide on either one of those for allow/disallowing a command
looks like whitelist checking or smth, idk im not really following atm
look you do /plugins (I dont want that) so I dont add it to the whitelist and then the player gets a message "This command is invalid or you dont have perms"
and it doesnt get excecuted
On spigot commands will be hidden if they don’t have the perms
Idk if bungee works the same
nah you can still tab them also there are basic commands you have perms for and still I dont want the users to use them
you know if I can get the player from a connection
Nah I think it is the same, probably just didn't set permissions
Can I compile a 1.8 plugin with java 21?
my plugin.yml file isnt getting bundled on build
Hi! How can I check if some block like Cobblestone has some specific data like namespaced key?
I know there something like TileState but it is not implemented in normal blocks
could store it on the chunk pdc if you want it persistent
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
I'm getting this. idk really why
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at net.md_5.bungee.api.plugin.PluginClassloader.findClass(PluginClassloader.java:152)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at net.md_5.bungee.api.plugin.PluginClassloader.loadClass0(PluginClassloader.java:66)
at net.md_5.bungee.api.plugin.PluginClassloader.loadClass(PluginClassloader.java:59)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at net.md_5.bungee.api.plugin.PluginManager.enablePlugin(PluginManager.java:341)
at net.md_5.bungee.api.plugin.PluginManager.loadPlugins(PluginManager.java:251)
at net.md_5.bungee.BungeeCord.start(BungeeCord.java:284)
at net.md_5.bungee.BungeeCordLauncher.main(BungeeCordLauncher.java:67)
at net.md_5.bungee.Bootstrap.main(Bootstrap.java:15)
you need to use lang level 8
pretty sure.
your compiling with 21, you need to run with 21
or that
I think with maven you can use java 21 source and compile to java 8
how I do that whit intellij
I'm using gradle
I think it's similar on gradle
Now I compiled it with java 21 but still having the same problem
sourceCompatibility = 21
targetCompatibility = 21
I'm trying to fix that, but no idea xd
Does anyone know whether java.lang.ref.Cleaner is thread-safe?
I don't really want to start up a bazillion demon threads just to clean up some resources in the background (these resources being soft references)
cant iirc
when doing java -version appears 1.8
wait my thought process was that, if records were introduced in java 14 and you compiled to 8 that it wouldnt have the right ObjectMethods bootstrap methods, but thats just a descriptor, nvm
every time i wanted to compile to lower version, it didnt allow me to
Just compile with Java 21 and run with Java 21. In 1.20.5 you need anyways.
Each cleaner operates independently, managing the pending cleaning actions and handling threading and termination when the cleaner is no longer in use.
would assume so?
The question more lies in whether multiple threads would be able to register cleaners simultaneously
havent used that api but what method are you referring to?
I changed the JAVA_HOME and path to 21 but still appears java 1.8 kek
declaration: module: java.base, package: java.lang.ref, class: Cleaner
Try to compile it from the CLI?
i mean
Doesn't forbid one from having logic in the constructor of that class.
It just won't let you use any featured above java 8
thought so
I'll guess it isn't thread safe, as I'd doubt that the reference queue is thread-safe, but idk
CleanerImpl::getCleanerImpl assumes a static cleanerImplAccess has been set
I'm confused what you're doing
anyways
I don't think you need a cleaner or anything for this
How do I run some code after all plugins are done loading?
There's an initialise/load event, or just scheduler
Scheduler supports more versions
This is getting so rare
java.lang.NoClassDefFoundError: java/net/http/HttpClient
alr goodnight
Well it isn't really spigot-related but for a webserver and I have a few open files being stored as SoftReferences (It's not bad to have them open 24/7 per-se, but after some long-term inactivity it'd be nice to just close them - and I can't be bothered to write actual caching for this - so SoftReference it is)
Eh, okay, I'll just describe my problem. Currently my plugin sends a notification to players whenever the server starts, so I put it into onEnabled. But there are some quick guys who are able to react to that notification and join before the last plugin manages to enable itself causing some plugins to behave weird afterwards. So I want the notification to be sent after all plugins are done enabling
destructor moment 🥺
Iirc there is an event in newer versions
Otherwise just schedule a task, the first task will run only after a full init
Okay, good to know, thank you
declaration: package: org.bukkit.event.server, class: ServerLoadEvent
I'll probably stick with scheduler, it sonds like a more flexible approach
Oh he already said it haha
is there a way to check if an entity is in water?
Entity#isInWater
🤯
Javadocs? What are those
can a non living entity be in water
how to compile spigot 1.8 with java 21? I can't find a good solution
doubt you can
I would assume that Java 11 is the max without hassle.
mc 1.8 was release around 2014 in the same year Java 8 got released. 😄
goddamn 1.8 was nearly a decade ago
so max java version for 1.8 is 11?
Heyo, how do I get a block with the full data, for example chest with its content or sign with text.
I want to store a block in memory and then later place it somewhere.
Full context: creating undo for my own "world edit" thing.
Please tag, I might go to bed, it's late here :D
BlockState
Store the BlockState
Block#getState
So, I'm doing world.getBlockState(x, y, z) to store it
Now I want to place it, how would I do that ?
Its java 8
11 is pushing the envelope without changing anything
As with everything almost 10 years old at this point your problem figure it out
Does anyone know how to make custom plugins?
By writing one.
writing the plugin?
Probably most people who frequent this channel.
Yes, writing Java code.
How much do you charge?
You're probably wrong here. Post your request on the forum in the hiring section.
just chanegd the http request to java 8 methods
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thanks
Three diamonds an hour.
But really, go to the site.
lol is there anyway I can skip the 20 posts and 1 week of usage thing? I just want to get straight to the point in asking.
find someone on the offering section and send them a message
(i hear pineapple development is really good)
could u send me link to them?
shut up
14 years exp would be way better.
You forgot the disclaimer saying you're part of pinaple
lol
#ad
#banned
nuh uh
How can you handle 1.8 commissions if you were even coding back when 1.8 came out
Smh
we dont do 1.8 commissions
profits--
if you want 1.8 commissions pay us to backport pineapple
The best part of 1.8 commissions is you don’t have to worry about future compat
Because you know they’ll never update
you never need to improve it!
I'm starting to fell crazy wtf
java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection
It's impressive that not only did you use the wrong HttpURLConnection, you used the wrong one TWICE
You want java.net.HttpURLConnection, but if you're using Java 11 or above, prefer the HttpClient API instead
thanks choco, just chanegd it. But now it says this Netty is not using direct IO buffers. I saw something in google related to bungee about this issue
Unsure. Seems like a Bungee configuration thing. Likely to do with native IO buffer support provided by Linux
I'm just sending a request to my api idk
Oh. I mean is it hindering your actual request?
If not, it's probably just a harmless ignorable warning
I'm doing this:
ProxiedPlayer player = event.getPlayer();
if (PlayersService.getPLayerEntry(player.getUniqueId()) == null) {
System.out.println("Creating entry"); // This log appears in console
PlayersService.createPlayerEntry(player.getUniqueId()); // Then this logs the Netty thing
}
how can i set the rotation of an itemframe with a map?
if (it.attachedFace == BlockFace.UP || it.attachedFace == BlockFace.DOWN || true) {
var normalizedYaw = event.player.location.yaw % 360
if (normalizedYaw < 0) {
normalizedYaw += 360
}
itemFrame.rotation = when {
315 < normalizedYaw || normalizedYaw <= 45 -> Rotation.NONE // South
45 < normalizedYaw && normalizedYaw <= 135 -> Rotation.COUNTER_CLOCKWISE // West
135 < normalizedYaw && normalizedYaw <= 225 -> Rotation.FLIPPED // North
else /*225 < normalizedYaw && normalizedYaw <= 315*/ -> Rotation.CLOCKWISE //East
}
}
this shit aint working
I am trying to make a plugin that creates a light trail behind the player. Currently I have it place light blocks at the player's location and schedules a BukkitRunnable runTaskLater to set the light block back to normal air afterwards to get rid of the trail. My concern currently is on server disable, these delayed tasks are cancelled rather than ran, causing light blocks to remain in random places upon server restart.
Is there a good way to force these queued runTaskLater tasks to fire rather than to be cancelled? Doing a List of locations is definately an option but I feel like there's probably a more elegant way to go about it?
Packets would probably be your best bet.
That way the server doesn't ever actually have to update the world.
Oh true
Covers the crash state too since saving a list of block locations isn't guaranteed.
Who ever added that method to the api is goated btw.
I see, thank you! If I want to emulate it not being client-sided, I should just search for nearby players and send the method for anyone that's close, right?
Basically, yes.
Does anyone know how to obfuscate with yGuard? Need help with setting it up and running
may I ask why you are obfuscating anyway
prevent people from copy pasting my code
obfuscating doesn't do that
it can easily be bypassed
you already own copyright over your code
perhaps
but to a normal person who doesnt have any experiene at all
would be effective
plugin ideas?
that's mods...
Its possible with a plugin
They wanted plugin ideas 🤷 didn't say what difficulty
would need a custom model, ai, movements, etc
These are rookie issues, real professionals struggle with making the poop physics
custom entities is very hard with plugins
wha-
its a good challenge
i mean yeah
here you go have fun
Random dungeon generator ❤️
You can never have too many on the market
You can make a LOT of money with those
Pick a unique algorithm tho
Are all PlayerEvents invoked in the packet handler?
I could make one, been a while since I did anything with proc gen, ty for the reminder
Some people pay 60$ a month for alienDungeons
So
Its a fucking gold mine
a month?
what the fuck
Paying monthly for a plugin sounds like the most irrational thing a human with a working brain can do
you might as well just pay a dev to make one for you
making it yourself is more fun anyway even if it sucks
A month.
what's the difference between PICKUP_ALL and PICKUP_ONE
is PICKUP_ONE just whenever there is one item in the slot?
I'm not actually sure how to get pick_one anymore
I think if you have an item on your cursor and then click the same item in a slot you might be able to under some circumstances
nope
I must be remembering soem other game
could be
left click -> PICKUP/PLACE ALL
left click on a slot with already some of the same type present, so the cursor can't empty -> PLACE_SOME
right click to place an item -> PLACE_ONE
right click to halve a stack -> PICKUP_HALF
collect all -> COLLECT_TO_CURSOR
swap a different type of items -> SWAP_WITH_CURSOR
drop items off the side of the screen with left click -> DROP_ALL_CURSOR
same with right click -> DROP_ONE_CURSOR
ctrl+q -> DROP_ALL_SLOT
q -> DROP_ONE_SLOT
shift+click -> MOVE_TO_OTHER_INVENTORY
number key or F with no item in destination -> HOTBAR_SWAP
with an item in destination -> HOTBAR_MOVE_AND_READD
middle click in creative -> CLONE STACK
clicking outside the inventory, clicking on an empty slot with left, right or middle click, or trying to hotbar swap with two empty slots -> NOTHING
```this is what I found so far
Balderdash! All the docs are superb!
The docs shall never deplete in value. They are splendid and shall never stultify anybody that encounters them.
PLEASE speak normally
Have thee no genteel upbringing?
Hi guys good morning
I might, currently working on my own docs so it may take some time for me to PR
why is my plugin detected as virus?
bruh
i have seen some plugin owners releasing an update for it
is there some kind of fix?
It seems that PersistenData is bound to some other data, not only the item itself (atleast that's what I experienced)
Is it bound to the localizedName? as that would make the most sense to me
Hi, I need help with debugging my plugin. I am debugging my plugin with intellij idea's remote debug, I added start flags to my start.sh, debugging works correctly but I dont know how can I apply changes to the code realtime to the server.
nope
it's bound to the same stack instance
iirc you need to build?
you dont?
they're talking about hot reloading
afaik you need a local dev server
Ctrl+Shift+F9
build -> debugging actions -> reload classes
Hot Swap failed Spigot Debug: delete method not implemented Spigot Debug: Operation not supported by VM
restart
Is there a way without ProtocolLib to remove tab completer from args on existing commands?
Like /ver <plugin>
And to remove tab completer only on <plugin>
hello
I use Eclipse ide for coding
import org.bukkit.
when I am make ctrl+space
I find only craftbukkit
I have created folder in desktop named Plugin
and created 2 folder inside this Plugin folder
One named Server one named BuildTools
in the server there are spigot.jar and other files
in the BuildTools there are buildtools.jar and other folders files
I imported spigot.jar in the build path
I use JavaSE17
I have been setuped spigot.jar and buildtools
.plugin.java
it didn't work
I see in the options craftbukkit and craftbukkit.bootstrap
@glad prawn
@rough drift can you help me pls
Do not do that
space instead of return please
you could write all of that in a single message lol
ok waıt
you don't need to rewrite it-
just read teh link I posted
I will read now
declaration: package: org.bukkit.event.server, class: TabCompleteEvent
That tutorial tells you to you use java 1.7 (not 17) with 1.16.5🫨
restart what ?
Do you realize what I said? It suggests to use a Java version that is 10 year olders than the minimum requirements of the spigot version. That tutorial sucks and shouldn't be used by beginners
hey I need help
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>plug</groupId>
<artifactId>SimplePlugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
I have this in pom.xml
past this with this text or over ?
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Thanks
Everything else may be good if it doesn't get the important things straight. It sucks if it causes more problems than it solves
hey i have spigot.jar Idk whats version i forgot lmao
Not at all. Its a perfectly working tutorial, even if outdated everything in it works
help
and its very simple to update
"It sucks if it causes more problems than it solves"
literally just changing java and spigot version
What is the purpose of a tutorial if the person reading it has to figure it out after it causes problems?
it doesn;t cause problems, it does exactly what a tutorial is supposed to do
Missing artifact org.spigotmc:spigot-api🫙1.16.5-R0.1-SNAPSHOT
error on <depencency>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>plug</groupId>
<artifactId>SimplePlugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Delivering wrong information is not what a tutorial should do
its not wrong informations
please don't ignore me
follow the tutorial, you have not added a repository
That you are supposed to use 1.7 with 1.16.5 is not wrong information? Are you high?
try reading a little past where it says 1.7
Dude, seriously?
ty fixed
but I forgot the spigot version xd how to find it
spigot.jar version
<version>1.16.5-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
follow the tutorial, its all explained
ok
Ya, it is. It just shows that the person who wrote it doesn't really know himself what he is doing. "You really should use this extremely outdated version, but you might use this one that is outdated as well".
I'm suprised you got it to work so fast, but have fun.
I didn't read anything just followed the pictures LOL
How would I get the warden entity
@EventHandler
public static void onPlayerPotion(EntityPotionEffectEvent e) {
if (e.getEntity() instanceof Player p) {
if(e.getCause() == EntityPotionEffectEvent.Cause.WARDEN) {
}
}
}
there is no warden entity in a potion effect
the player or entity, not the warden
so theres no way to get the entity who gave the potion effect
you'd have to listen to another event to get the attacking entity
also how could I make a zombie attack other zombies
Hi, i have never used mongo db before and i am getting this error when trying to insert a document
java.lang.IllegalStateException: state should be: open at com.mongodb.assertions.Assertions.isTrue(Assertions.java:110) ~[Athena-1.0-SNAPSHOT.jar:?]
@eternal oxide
how to import the plugin to plugins folder?
how to make it jar
in eclipse
show your code
run the maven package thing or click on the build button
gradle build
Missing artifact org.spigotmc:spigot-api : jar:latest
error
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>plug</groupId>
<artifactId>SimplePlugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>latest</version><!--change this value depending on the version or use LATEST-->
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
ok
same error
Missing artifact org.spigotmc:spigot-api : jar:1.20.4
<version>1.20.4</version><!--change this value depending on the version or use LATEST-->
you need the full version like 1.20.4-R0.1-SNAPSHOT
oh ty fixed
thanks ❤️
my laptop very bad :/
I don't know how I will open eclipse + mc same time
Eclipse is the best IDE for weaker computers
I also dev on an i7 3770k
@blazing ocean
nvidia geforce gt 630m 2gb
@vital void
Document document = new Document("uuid", player.getUniqueId().toString());
document.put("level", 0);
main.getMongoDB().getDatabase("testDb").getCollection("_testcollection").insertOne(document);
can you send the whole error