#help-development
1 messages · Page 1137 of 1
What if I wanna support 1.8+?
useful, thanks!
Like instead of hibernate?
No instead of the libraries section of the plugin yml
Ah okay
Yo that seems sick
Will it download it each time tho?
How do I get the entity that an entity is mounted onto
I have an Interaction as a passenger of an ItemDisplay and I want to check if the Interaction is mounted on the ItemDisplay
getVehicle should work
returning null but its 100% mounted
hm
if i make permissions in 2 different plugins, but with the same name, for example name of the permission is "plugin.command.ban", is it treated as the same premission?
thats not an idea im just curious
imma test it anyway
so there should never be 2 plugins with the same name in plugin.yml right?
?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/
NO PROBLEM
For some reason when I'm writing JSON back to a config file the gt and lt symbols < and > get encoded to unicode? \u003c and \u003e
I'm not really doing anything extrordinary to save?
val content = saveContent(key)
if (content.isJsonNull || (content.isJsonObject && content.asJsonObject.isEmpty)) {
plugin.logger.warning("Unable to save empty ${serializable.key}.json is this intended?")
return
}
val savePath = saveDirectory.resolve("${serializable.key}.json")
savePath.writeText(jsonHelper.gson.toJson(content), Charsets.UTF_8)```

hi pepe
@chrome beacon that was it thank you much
🙏
nice :)
gson 😡 🤬 💢
people
how do I save itemstack to sql
and then retrieve the itemstack in question back from it
imho you should use NMS
get the bytes from NBT
make sure you use DFU when loading them!
NMS isn't required to convert items to bytes
You can use the bukkit object output stream
(no)
BOOS is naive
very naive
some would even call it dumb
I think that's way to nice personally
never used it myself 🤷♂️
iirc the PR is
-org.spigotmc.spigot-api
+io.papermc.paper
kekw
those methods afaik are decently well implemented
ofc things get tricky and annoying with AIR but we'll just ignore that 👍
if you serialize AIR outside of containers anyways you're a monster
so uhm
I serialize air
😃
now what
null?
uhm well NMS doesn't have null item stacks
what that
who nms
this nms?
;-;
you'll want to do extra steps though since you have a container
you can probably put stuff in a TagList
what?!
or you could use BukkitObjectOutputStream which is like like 3 or 4 times less storage efficent
probably more than that tbh
benefits no NMS
cons literally everything else
Well, okay, (a) it's not NMS, it's OBC. (b) It's exposed (albeit unsafe) API, so you can access it through Bukkit.getUnsafe()
yes it is
that's a link to my PR
Bukkit exposes no such methods yet
Oh, weird. Stash gives zero indication of that
Just a commit hash, but that could be on master for all I know lol
yeah I'm surprised it only gives commit hash 🤷♂️
and doesn't even link to my fork
val size = configuration.loot.size() / 9 + 1
return if (size - 1 % 9 == 0) size - 1 else size
Am I missing something why does intellij think size -1 will always be zero 👀
remainder takes precedence
ah
ROYGBV or something
makes sense 🤦♂️ its always the stupid stuff
Hi, i'm spawning this item bug I don't get the colors, anyone know how to fix? Thanks
yes, & is not a natural colorcode
either use § or translate & with https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/ChatColor.html#translateAlternateColorCodes(char,java.lang.String)
Hey can someone maybe help me how to add custom fonts?
Ok, thanks. Another question. There is any way for detect when it's a crafting inv or the player inv? Because when i try to use InventoryClickEvent and do Economy.instance.getLogger().info(e.getInventory().getType().toString()); and click an item in my inv i get CRAFTING
resourcepacks 🤔
yes i did that
i put the picture in resource pack
still doesn't work either
CRAFTING is always the player inventory
tbh no idea, not an resource packs expert
Hey I am searching for a way to change the Playername with nms in the version 1.20.6 but all recommended Packets doesn´t seem to work. Does anyone know how to tackle this problem?
If a rogue process takes my SQL database connection, while I have it in auto-commit disabled mode and am in the process for executing statements, and it executes a statement, will the statements I had already executed by the time it executes the statement also be executed?
If you have your SQL database connection in auto-commit disabled mode and are executing statements, those statements will not be committed to the database until you explicitly call a COMMIT command. In this mode, any changes made by the statements you've executed are part of the current transaction, but they are not yet permanent.
Now, if a rogue process somehow gains access to the same connection and executes a statement, this introduces several potential issues:
Transaction Interference: If the rogue process executes a statement on the same connection, it could potentially interfere with your current transaction. This means the rogue process's statement might be executed in the context of your uncommitted transaction.
Impact on Your Statements: The statements you've already executed are still part of the same uncommitted transaction. If the rogue process's statement completes successfully, your previously executed statements are still in the transaction but will not be visible to others unless a COMMIT happens.
Commit or Rollback: If you subsequently issue a COMMIT, both your statements and the rogue process’s statement will be committed together. If you issue a ROLLBACK, both your and the rogue process's statements will be undone, as the transaction is treated as a whole.
In summary:
Your statements will not be immediately executed or visible to others until a COMMIT occurs.
The rogue process could interfere with the current transaction, and its statement will either be committed or rolled back with your uncommitted changes, depending on what happens with the transaction.
If the rogue process has executed statements before you commit or roll back, those changes will be tied to the fate of the transaction as a whole.

oooo best model
Was that ChatGPT
I mean I believe you
But you are truly of the omnissiah’s blessed
i love bullshit generator chatgpt
sometimes you have to rub your head, but most of the times its actually very useful
guys im tryna create a gui with Inventory framework by stvanfschie
I just wanna add a bunch of items thats it, if theres more than the inventory can hold then page it
How can i do this
can you link the framework?
https://github.com/stefvanschie/IF/wiki/Paginated-Pane looks like this
just for the entire inventory
My confusion is also
so that your GUI just persists of a really big PaginatedPane
Will the rogue process’s statements become part of the uncommitted transaction
wait let me ask my best friend
short answer: yes
long answer:
Yes, if the rogue process somehow gains access to your database connection while you're in the middle of an uncommitted transaction (with auto-commit disabled), its statements will become part of that same uncommitted transaction.
Here’s why:
Single Transaction Context: When auto-commit is disabled, every statement executed on the connection becomes part of a single transaction, until you explicitly commit or roll back that transaction. Since the rogue process is using the same connection, its statements are executed within the same transactional context.
No Isolation Between Statements on the Same Connection: SQL transactions work on the connection level. As long as the connection is active and the transaction is not committed or rolled back, any statements executed on that connection—whether by your process or the rogue process—will be added to the same uncommitted transaction.
Outcome Depends on COMMIT or ROLLBACK:
If you (or the rogue process) issue a COMMIT, all changes made by both your statements and the rogue process’s statements will be saved to the database.
If you (or the rogue process) issue a ROLLBACK, all changes made by both your statements and the rogue process’s statements will be undone.
Therefore, the rogue process’s statements will indeed become part of your uncommitted transaction, and their fate will be tied to whether the transaction is committed or rolled back.
I'm so confused
Why is x and y a parameter
What even is a pane
the location of the pane inside the GUI
a section
How do I make the main like gui just the page with all the items
look up the wiki, there is everything explained
ive been looking
you create a GUI, give it a PaginatedPane which covers the entire inventory, put your items in there
How does making the transaction exclusive actually disable other processes from modifying the transaction?
cant you just ask that GPT yourself 🤔
Ok whats the method to add an item to a pane
Like if you have access to the connection object, wouldn’t any executed statement become part of the same set of changes regardless of whether the transaction is exclusive or not?
Aye but could you actually just ask this last one and then I’ll ask it myself for any future ones
Sry I’m on my phone
In database systems, exclusive transactions (or exclusive locks) are a mechanism to ensure that only one process can access or modify certain data within a transaction at a time. When a transaction is made exclusive, it effectively locks resources (like rows, tables, or even the entire database, depending on the isolation level and lock type) in a way that prevents other processes from accessing or modifying them until the transaction is completed (committed or rolled back).
?verify
🤬😣☹️😍😒😌🤩🤩😎🥰😒😍
!verify
Usage: !verify <forums username>
ah
See
then you can send pictures
literally does not tell u how to add an item to a pane
2 secs after looking at the resource i found out that there is an addItem method
and a populateWithItemStacks method
bro theres only addPane and addPage
.
I wrote a simple little thing to get the player name color from the player prefix with Vault
But this is not possible when the player is offline.
For example, there is a list of players, the colors are drawn correctly when online, but this does not happen when offline.
Hi I have a question 😄 How can i get the Death Location and send it to the player who died?
My code so far
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
e.getPlayer().getLocation();
e.getPlayer().sendMessage("");
}
}
You can get the x coordinate for example with Location#getBlockX(). Also for all other axis
and how do i send it to the player then? 😄
with ```java
Location location = e.getLocation();
Player player = e.getPlayer();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
Location#getBlockX() just means the method from Location. In your case you have to use your variable with location.getBlockX()
What? It says Cannot resolve method 'getLocation' in 'PlayerDeathEvent'
Could you send your current code please?
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Location location = e.getLocation();
Player player = e.getPlayer();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
}
}
aah my bad
maybe e.getPLayer.getlocation
There is no PlayerDeathEvent#getLocation() but Player#getLocation() so write this instead please:
Player player = e.getPlayer();
Location location = player.getLocation();
Thank u ❤️
Your welcome
or Danke dir 😄
hahahaha
How can i import craftplayer with different version in one plugin to make plugin compability with different versions and use craftplayer?
Reflection or modules
how can i use this = with slash like 0 is not 1? Intellij doesnt accept this symbol
Like = but in reverse
Yep thanks xD ❤️
:)
i need to do a list of ranks, and every rank has list of players - in config, how do i do it? do i do list of lists or like this?
im new to using configs so i have no idea
is there a way to highlight the block through the world where a player dies to find his stuff easier? my code by far:
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player player = e.getPlayer();
Location location = player.getLocation();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
}
}
yeah this seems fine
I would not do a list of lists
assuming you have a set amount of ranks
umm.. and how do i get these indented ranks? (rank, rank2)
?codeblock in the future please
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
what do i not need
you can just use getList("ranks.rank1")
i dont know all the ranks that are gonna be in "ranks"
as long as you know the names the ranks should be you can put it in there
well you can get all the keys under ranks
how can i do his?
getSection("ranks").getKeys(false)
whats false
deep
what
if you want to go deeper when looking for keys
how can i put this code into this black box
´´´java hi´´´
backticks
Need to be backticks
for me its the key below esc
do the enters
yeah that key is like somewhere else on every different keyboards
What kinda keyboard layout do you dutchies use lmao
okay so how do i get the death position highlighted? my code by far
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player player = e.getPlayer();
Location location = player.getLocation();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
}
}
qwerty
qwertz
ftw
you didny type java probably
qwerty 
Also I have the § key easily accessible 
but im not using legacy stuff anymore so it dont matter
based
why doesnt it turn into these colors?
i told you
you probably didnt typed java
type*
i typed it as u can see 😄
but you need to put the lang on the same line as the opening ticks
but you did it too low
and then hit enter
look at this
bravo yayaayyay
discord magician
i got it now 😄 after java shouldnt be a space
public class OnDeathListener implements Listener {
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player player = e.getPlayer();
Location location = player.getLocation();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
}
}
so can u help me? 😄 how can i get the death position highlighted?
what does highlighted mean?
like if u get hit by a spectral arrow veryone can see u through blocks
@pseudo hazel why not list of lists? (config file)
oh... you apply effect
glowing
thats what u mean?
thats what i want to do with the block un which u died
well you can I guess
oh.. apply effect to a block ?
esp if you dont know the ranks you will have a list of lists might be nice
but the parsing is just a little bit more annoying
so.. which one would you choose
well idk what you are making
Spawn a block display and make that glow
whats the purpose of this config
and how do i do this?
umm ill choose list
the goal is to make it as clear as possible for the one editing it later
no one is gonna be editing it later probably
then how do you get stuff in it
i also have another question, how to store players in config becasue... um player nickname can change and uuid is not good for the one editing config
yes
i understand what you ment now
so you should design starting with that in mind
yes
I mean this is a tough question
oh
for the sake of having correct data always, use uuid
i mean, i could use uuid
but for the sane, use player names
ill maybe ask
but this is usually the reason why plugins like this should have configs in game
the guy that wants the plugin
oh yeah
that could be good to
Does someone know how to spawn a block display and make it glow? 🙂
esp when working for a specific client, just ask them as soon as you have to make a decision regarding usability (reasonably)
Have you tried using Entity#setGlowing
I dont even know how to spawn a block display so i cannot set it to glowing...
world#spawn
world.spawn(location, BlockDisplay.class, blockDisplay -> {
blockDisplay.setGlowing(true);
});
smth like that
wrote by hand and off memory so 🤷♂️
world cannot be resolved...
but can i get players name or something if they are not online? from the uuid
because i can make a command for adding players, but it also should display players added
or something like that
i have to defy a new world for this entity or what? i dont understand anything xD
Do you have any experience with programming or Java?
but im not sure
yeah you need to implement the World class
and then add the entity to it
\s
just a very little bit but im trying to learn
and all these tutorials i found just type things but doesnt explain why
umm.. what? i do what?
yeah don't watch youtube videos for learning Spigot
Player player = e.getPlayer();
Location location = player.getLocation();
player.sendMessage("X: " + location.getBlockX() + " Y: " + location.getBlockY() + " Z: " + location.getBlockZ());
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! 🎉
and this is my code from before
oh.. you were not talking to me @pseudo hazel
you ask someone else, I dont know what's the best way regarding offline players, as my plugin doesn't care about offline players
okay, so thanks for help
or well kinda, I just use the name they joined last with
thats also an option, i could save that in config i guess?
Use the UUID
but I have a minigame plugin, so I only have that info for like a few hours at most from every player
but i need also the names
Why?
just to display them
yo, Player.isJumping() returns when just jumped and it's on mid-air?
That method doesn't exist in Spigot
You should ask Paper
Jumping is completely client side now
what
oop
then how do i check if player is mid-air
there was a method
which metod
Check if the player isn't on ground and not in water
Do note the on ground flag is client controlled
player.isOnGround can be bypassed with simple hacks
yes that's what I said
you can manually check the players hitbox against the world if you want
ive been using ((LivingEntity) player).isOnground()
That's wrong and not how Java works
idk i was js askin if that works
Hello, I looked in the interface provided by the API it seems there is only on method related to Addresses in the entire interface
InetSocketAddress getVirtualHost();
cheers 🍷
how can i broadcast message with adventure api?
how can i get if PlayerToggleSneakEvent is sneaking and not standing
That's not right
no spam
sorry
Connection#getSocketAddress
I mean when u press shift and not release it
do i explain myself?
PlayerToggleSneakEvent#isSneaking
use Javadocs please 🙏
how would one go from Chunk coordinates and relative X and Z to a regular location would it just be
(chunkX << 4) + relativeX
(chunkZ << 4) + relativeZ
Sounds about right
Then check for the opposite
PlaceholderAPI help:
Is it possible to display (%server_online_worldnamehere%) with two different multiverses?
Ex: 72 people are in (Creative Server 1), 53 people are in (Creative Server 2)
Is it possible to add those two numbers together into one text?
Example image of 72 + 53:
why don't you ask in their discord server
papi has a discord server?
how would i approach using it?
nvm some guy got me lol
in the papi dc
nah some guy on the helpchat discord server helped me its fine
guys how can i convert legacy ampersand to minimessage
Use the legacy serializer to convert it to a component
Then mini message to convert the component to a minimessage string
can i do with adventure api?
i use adventure api for minimessage
Idk if the legacy serializer is part of the base adventure api
Might be another dependency
Adventure api supports legacy ampersand
Component component = LegacyComponentSerializer.legacyAmpersand().deserialize(str);
return MiniMessage.miniMessage().serialize(component);
Incompatible types. Found: 'java.lang.@org.jetbrains.annotations.NotNull String', required: 'net.kyori.adventure.text.Component'
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i solved
my fault
MiniMessage minimsg= MiniMessage.miniMessage();
return minimsg.deserialize(minimsg.serialize(component));
function wants Component type but i return String
then it gives error

that.. doesn't do anything
I'm sure it does work
public Component translateColorCodes(String str) {
Component component = LegacyComponentSerializer.legacyAmpersand().deserialize(str);
MiniMessage minimsg= MiniMessage.miniMessage();
return minimsg.deserialize(minimsg.serialize(component));
}
it works but minimessage not formatting
just legacy
i dont have clue
you can't mix both legacy and mm
is it impossible?
you can't easily pull it off in three lines
I don't
a little bit
and honestly I don't care to support both at the same time lol
either one or the other
the proper way to do that is to go through the serializers, but you can't have both formats in the same string
private static final LegacyComponentSerializer SERIALIZER = LegacyComponentSerializer.builder().character('&')
.hexCharacter('#').hexColors().useUnusualXRepeatedCharacterHexFormat().build();
public static String translate(String toTranslate) {
return (ChatColor.translateAlternateColorCodes('&', SERIALIZER.serialize(MiniMessage.miniMessage().deserialize(toTranslate))));
}
but they want a Component, not a String, and that is lossy
sure, still lossy
true
Tell her!
Maybe if choco updated his PR
Oh wait he did, I can’t yell at him for that anymore
:/
whoever needs it can use it
public static final Pattern HEX_PATTERN = Pattern.compile("&#[a-fA-F0-9]{6}");
public String legacyToMiniMessage(char Char, String str) {
Matcher matcher = HEX_PATTERN.matcher(str);
str = str
.replaceAll(Char + "0", "<black>")
.replaceAll(Char + "1", "<dark_blue>")
.replaceAll(Char + "2", "<dark_green>")
.replaceAll(Char + "3", "<dark_aqua>")
.replaceAll(Char + "4", "<dark_red>")
.replaceAll(Char + "5", "<dark_purple>")
.replaceAll(Char + "6", "<gold>")
.replaceAll(Char + "7", "<gray>")
.replaceAll(Char + "8", "<dark_gray>")
.replaceAll(Char + "9", "<blue>")
.replaceAll(Char + "a", "<green>")
.replaceAll(Char + "b", "<aqua>")
.replaceAll(Char + "c", "<red>")
.replaceAll(Char + "d", "<light_purple>")
.replaceAll(Char + "e", "<yellow>")
.replaceAll(Char + "f", "<white>")
.replaceAll(Char + "n", "<u>")
.replaceAll(Char + "m", "<st>")
.replaceAll(Char + "k", "<obf>")
.replaceAll(Char + "o", "<i>")
.replaceAll(Char + "l", "<b>")
.replaceAll(Char + "r", "<r>")
.replaceAll(HEX_PATTERN.toString(), "<#$1>");
return str;
}
that is not correct
and it's wrong
what do you recommend for this code
just don't support both, or support them separately but not together
what about that?
it does not have the same effect in minimessage as it does in legacy formatting
what they behave differently
they just do different things due to how components work, <reset> means "close all open tags in the current deserialization context"
idk why you're making this so hard and wrong for yourself
and <!italic> and <!bold> and .....
what the hell
what
I'm telling you, they are completely different formats
you are making this difficult for no reason
just support one or the other but not both in the same string
for write easier
it does not have any way
i will put serializer select option to config.yml
idk
thanks
I agree
guys how can i do multiple return types in java?
sorry 🥲 one question
how edit the resource?
your welcome
hey sorry
how edit the resource?
or
How to change the file?
@vagrant stratus sorry
Just upload and update
Anyone know why?
Strings are not mutable. Its mutating methods return a new string
You need to re-assign your s variable, so just s = s.replace(...) would work
Alright, brain being stupid i guess because i knew that 🤷♂️ Thank you @worldly ingot
im getting the error that plugin.yml is not found
do i just make it here
?
JAR will be empty - no content was marked for inclusion!
yikes my jar is empty
i made dat but when is in air and sneak is always false
This method returns the host the player is trying to connect to
How do I clear all arrows that are attatchsed to the player? Cuz seems like they arent entities
realised, lol
Nvm, p.setArrowsInBody
how do i properly compile this?
Use the package task
Can I redistibute Connector/J or with maven called mysql-connector-java (same thing?) shaded in my plugin, or is it better to specify it as an external dependency somewhere in my plugins folder?
And are there any differences if I distribute my program payed/free?
Read the license of that dependency. If it‘s on maven central just use plugin.yml instead of shading
Lifecycle > package
Is there any way to play a sound for a player within a min volume?
the vanilla command "/playsound" provides an arguement called min volume, but method from spigot api doesn't
Spigot includes this already
it is not recommended to do this as spigot already shades a mysql connector. If you provide one in your plugin it will cause conflicts and is a pain to deal with. Also an issue if you want to use mariadb connector instead of the mysql one that is provided.
Hi, there is a way for prevent a custom item from being used in player's crafting inv?
has anyone here managed to get hotswapping to work with spigot?
im trying and i get hotswap errors lmao
What are you trying to hotswap and what's the error
dunno like, the whole plugin
just trying to set up class hotswapping
I believe Paper userdev can do that
i basically made this config
then
downloaded a copy of jetbrains runtime from https://github.com/JetBrains/JetBrainsRuntime/releases
and put https://github.com/HotswapProjects/HotswapAgent/releases in its directory
okay well i basically did this lol
I'm not sure how well paperclip handles that
^^
most stable paper moment
Should be able to handle hotswapping when you run in debug mode from IDE
alright thanks ill give that a try
alright it works now thanks for the help
Hi, I want to make a command that all the players can open a container which helps them share items, but I think if I just
Bukkit.createInventory(null, InventoryType.CHEST);
The inventory will disappear after the server reboot and lost every items in there, how can I prevent that?
You need to save it somewhere
How can I do that?
The easiest way (not the best way) is just to save the items to a yaml file
Is there a way to change internally all items in the game?
Like mob drops, block drops etc but without changing the drop in the listener, maybe doing it when the server loads change all drops.
Have I explained myself? xd
with the config api
You can use a datapack
loot table
^^ a datapack with loot tables
Uh, i don't know how they work lol. Is it not possible with nms?
alright I will try to use serialize
But do players will need to install the datapack when joining the server? I really don't know how they work
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
no
ItemStacks are already serializable
it's server side
thank you
I'm new to plugins lol
I use datapacks for the past 5 years
me have question
when you make a Merchant using Bukkit.createMerchant() and add MerchantRecipes to it you can also give the MerchantRecipe some details like how much exp it should reward the villager towards leveling up and how much discount its price should receive based on reputation, but it seems there's no way to actually assign this Merchant to a Villager
basically, the Merchant you create has no knowledge of a Villager, but i would still like for it to work with villager mechanics such as discounts or exp
Some stuff i found out after researching:
Merchant is an interface (package somewhere in inventory)
You are currently using:
Merchant merchant = Bukkit.createMerchant("Inventory title");
If you want to work with Villager:
Villager villager = player.getWorld().spawn(player.getLocation(), Villager.class);
Merchant merchant = (Merchant) villager; // isnt neccessary just showing thats the same Merchant
Villager extends from AbstractVillager, that implements Merchant
Do note if you want to modify that villager do so inside the spawn method consumer
Thats only a information i found out after looking at Villager class, i dont know if thats works good or is the best option
🫡
Discounts and such work on rep which does require an actual villager
and it looks like the api wants a villager for the xp to work as well
i would really like to work with new Merchant instances though as I don't want to actually modify the villager's trade data
i want to make a non intrusive custom trade plugin that basically overrides the normal villager interface with a custom one, so that if people want to remove the plugin it will not leave any messed up villagers behind
and it would give me more control over what the player can see and trade, like personalized additional trades based on renown or reputation
so yeah I'm trying to do this
and I found
try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
BukkitObjectOutputStream objectStream = new BukkitObjectOutputStream(byteStream);
FileWriter writer = new FileWriter(fileName)) {
objectStream.writeInt(inventory.getSize());
objectStream.writeObject(inventory.getName());
for (ItemStack item : inventory)
objectStream.writeObject(item);
writer.write(Base64.getEncoder().encodeToString(byteStream.toByteArray()));
}
on internet
but too bad inventory.getName() doesn't exist anymore
Thank you for help! And others.
Just wanted to ask this because it is licensed under GPL license.
If the name is always the same you could ignore the name
alright, but I still want to know how to get the title of an inventory in case I need it one day
inventories don't have a title
opened menus/InventoryViews have a title
just save the title you use to create the inventory with in some other variable
you shouldnt be using the title to determin if its yours so you shouldnt ever need to know the title
why not just save the contents then
the inventory holds basically no data that you cant get from just the items other than inv name which you probably should know without having to save the inventory
Hey, could someone send me a link of Ageable blocks? i'm searching which are part of this Interface but can't find
declaration: package: org.bukkit.block.data, interface: Ageable
Yeah, but can't find the Blocks that are ageable there, or maybe i'm just blind idk
all of these
Isn't wheat also ageable for example?
I saw that but crops like carrots wheat etc doesn't appear there
And if you use IntelliJ:
https://prnt.sc/yqQ2G8RZrF0-
im guessing crops use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/CropState.html
declaration: package: org.bukkit, enum: CropState
they don't have a reason to have a subclass
Ageable is just.. enough
Yeah, but I was looking the blocks that were ageable and couldn't find them in the javadocs
I just want to be sure
Maybe in minecraft wiki? let me search
Nope
the wiki is very useful
also https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html#WHEAT
BlockData: Ageable
I'll just use cntrl + f there xd
thanks
Hi, I have a problem. I'd created a new inventory and I want to remove the option to close the inventory clicking the ESC Button.
@EventHandler
public void onInventoryClose(InventoryCloseEvent e)
{
if (!e.getView().getTitle().equals(ChatColor.RED + "Bank Menu"))
return;
Player player = (Player) e.getPlayer();
if (player == null)
return;
if (exitPlayers.contains(player)) {
exitPlayers.remove(player);
return;
}
Economy.instance.getLogger().info("CALLED");
new BankMenu(player);
}
This is the code, but i get a stack overflow and my CALLED log is spaming
delay by one tick
Ok, in java how can I delay?
?scheduling
Couple things I see here alreadyt
- Do NOT compare views using the title please instead reference the ideas of https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
- The InventoryCloseEvent player can never be null (Ensure you check for instanceof Player instead of a blind cast, this could cause issues down the road
- You don't need to track with (exitPlayers) if you follow #1
- Menus need to be re-opened after 1 tick and not immediately after see https://www.spigotmc.org/wiki/scheduler-programming/
Ok, thanks
im trying to check whether an object is a primitve wrapper or not, im iterating over all base wrapper classes (that i put in a set) and check if my class is assignable from them.
Would it be smarter to recursively check for the superclass of an object until its a base wrapper class of the set?
I'm not sure what's smarter, iterating over all of them and checking for isAssingableFrom seems quite inefficient, altough the other method would be bad with lots of superclasses
Primitives from Google commons has checks for this
Spigot ships it
what do i need to type?
given that you can't subclass wrapper classes, the recursive approach is simply not needed
you can extend from bigint
that is not a primitive
and it can represent numbers that can't be represented by primitives
hmm
like 10000000000000000000000000000000000
What about -10000000000000000000000000000000000
thats a small big int
Makes sense
BigInt can also be 69 if you want
If you're wanting to check for a numeric value, you can check if the type is a subclass of Number instead
That class actually encompasses BigDecimal, BigInteger, the primitives, and a few others
Guys i have a weird issue with a plugin, those are the screenshots:
as you can see, the reason is "reconnect" at first, but somehow it manages to still ignore the if that checks the reconnect reason, on second time works pretty much fine.
using bungeecord, serverkickevent
wdym by templates
What do you want to change
arguments
arg names?
yes
You can probably add a live template
The auto completion uses the arg names of the method you're overriding
if you have dependency sources downloaded, it'll use the names from the sources rather than the inferred names from decompilation
^^
Hello
i need help with my broadcast message
could someone help me change it from the server to Ops/ admins on the server
?paste
loop through the online players and send the message to people with a certain permission
OK
nvm
hm?
Bukkit.getServer().broadcast("message", "permission");
oh ok
Hi there i have some problems whit my code i dont now how to fix it i am not realy known whit coding i hope you can help
here is the main Class
https://paste.helpch.at/ejinuhoxen.java
The errors are on lines 3 - 5 - 27 - 67 - 70 - 78 - 92 - 93
https://paste.helpch.at/elakopabit.java
The errors are on lines 3 - 55 - 110 -147
pom file
https://paste.helpch.at/apiramevaq.xml
Could u guys help pleasee!
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;** (light gray) (Bukkit = red)**
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.managers.RegionContainer;(light gray) (RegionContainer = red)
private WorldGuardPlugin worldGuard;** (WorldGuardPlugin = red)**
POV ai codes for you
hahah
you didn't write any of this code
Mf used chatGPT 😭
ChatGPT is fine, but atleast learn some of the stuff your tryna make 💀
If you don't know how to code, then don't use chatgpt at all because it wont help you. Instead learn java and how to google the problems.
correction, use it when you understand, what the AI just did for you
yo ucan use chatgpt to solve your problems if you know what you are doing and the problems are easy and explained well enough, sometimes you are just too lazy to write code yourself lmfao
Cool but chatgpt literally killed junior positions in job market.
but if you go tell chatgpt "do magic and do the project for me" the guy is gonna smoke a whole 50$ of weed and trip like a grandma
if you can't invest to train your staff to do above minimum requirements then you should not be hiring juniors at all
you might need to use some NMS
No it didn't
It's not even close to a junior developer
The idea that ChatGPT is taking developer jobs is literally preposterous and almost certainly propaganda from companies who stand to gain by shilling AI products
I think with a little critical thinking you'd beable to find good reasons for software jobs to be hard to find rather than AI BS
Twitter brain
The earth is flat
Real now that's something I can get behind
If you think ChatGPT is killing Jr Position you didnt understand Jr Positions in the first place💀
I absolutely agree. ChatGPT has solved bugs for me instantly that I would have wasted an hour testing. You do need to know how to code for gpt to be useful. Must provide the proper prompts, and understand the code it gave back to know if theres anything needing to be changed specifically.
Wait isnt a cube like minecraft? Steve lied to me
No
Earth is a flat world sadge
The government doesn't want you to know the world is only 30 million blocks by 30 million blocks. They're hiding the world border from us
They know the only efficient way to get there is ice boats through the nether which is exactly why they don't just let you get meter by meter cubes of obsidian easily
Didn't do much research.
Chat went ai to conspiracy theory real quick
My EntityDamageByEntityEvent triggers twice per each hoe swing, is that normal behaviour?
well, the answer to that question always is:
- Are you running more plugins than your own?
- Are you running a fresh build gotten from BuildTools on a clean server folder?
- Can you reproduce it in any other way? Strip out everything unrelated in your plugin and just leave a minimal reproducible example
once you've checked all of these, you can gauge whether it is indeed normal or not
chances are it is just your plugin doing a weird thing or another plugin making interactions funny, then there's the 5% chance it is a Spigot bug, then there's a 1% chance it is a vanilla bug
I have 2 questions, the first one, will Player.spigot() work with other cores like paper or something like that? And the second one, to make constant-live actionbar (with changes) is only by BukkitScheduler.runTaskTimer?
It's possible afaik
while #spigot methods do work, there's little reason to use it at all nowadays, no?
as far I was aware, most of the methods that are there have just been moved up to the general interface instead
For example to send action bars messages
it's not possible without console or Player.spigot
Afaik
Component stuff will be moved to .components() eventually
like Player.components().sendMessage()?
well, a bit off-topic then but you wouldn't use it on paper-based forks or paper itself anyway, since they use Adventure for that
I'd wish we all just got along together and decided to implement Adventure on every platform but sadly that's never gonna be the case
Because I want to make flexable plugins that can be used at spigot, paper core
and others
and why would I use adventure from paper instead of player.spigot()?
Adventure works on Spigot too, you just got to use the bukkit provider
Yes
Well, I don't know alot about adventure but what is it?
it is a cross-platform API/library for handling the minecraft component system
so, anything that uses components, Adventure will handle
And why it's better than Player.spigot()?
well, it is practically standardized given most of the other platforms also use it, and it's fully featured
i.e., you can do components in display name of items, things that Spigot hasn't gotten to implement yet
Well you can't do those things on spigot even if you use the bukkit platform tho
I'd have assumed they just implemented it straight from nms, ig it is too much of a bother
the only upside you'd get from using them is the completeness and the other frameworks around adventure like mini message
I'd argue you also get a lot nicer API over bungeee chat components, but that is subjective
I mean, you can use whatever you want
just know it is there if you end up needing an alternative
the one issue that you might find is that unlike bungee chat, it'll completely ditch the legacy system and if you ultimately want to use it you have to go through serializers
My code is up to date!
it being Something#components() doesn't quite feel right to me
Well, its the alternative to the paper way
but also, going the paper way would be a declaration of war 
one could completely confuse that with the data components tho
data components weren't a thing when that format/idea was developed
It's also way better than spigot() or sendComponentMessage()
So pick your poison, I guess
yea but into what xD
I could make it textComponents() lol
I'd honestly just rather have ItemStack have a getDataComponents() instead
Yea
Given that data components are presumably not coming to spigot anyway ™️
its w/e
everything is text components, since ultimately it does end up in a text representation
I mean, the data component API in Paper is kinda eh, not loving it right now
Well there isn't one?
well, the planned one so far
Ah
I don't like to complain without providing actual feedback, but I also can't really come up with anything better lol
Yea, well it just sadly exposes the reality that we are abstracting an ever changing system
but people wanna use highly specific things in each version
well, since it closely resembles the internal implementation, I'm sure some third-parties are going to take advantage of it and build up from that
I don't really know much about MySQL but I would like to learn it.. Soo.. What's the name of using .db files instead of full MySQL databases with connections etc.
Well, but the API should expose something stable enough to depend on
like, the BasicCommand of brigadier API
for now, that is just gonna stay ItemMeta
I need brigadier in spigot
sqlite?
👍
use a command framework like cloud or command api then
(which is distinct from MySQL, mind you)
Really?
Yes
might want to get a db browser for sqlite to look what is happening inside
Hmm... Ok! Thanks
I guess it's not normal to save player's data into the configs so I would like to learn SQLite xd
It's small things like (columnName INTEGER PRIMARY KEY AUTO_INCREMENT) in MySQL vs (columnName INTEGER PRIMARY KEY ASC) in SQLite
But they'll bite you in the ass lol
It's just something to be mindful of. When Googling online for help with queries, make sure you specify SQLite instead of MySQL because you might get different answers and be frustrated as to why your MySQL query isn't working in SQLite
And why does SQLite differ from MySQL? I though that all SQL type dbs almost the same
almost
MariaDB has its own features/syntax as well despite being a "successor" to MySQL
For the same reason Canada English differs from US English, there are different flavours of SQL :p
they all implement different subsets of the SQL standards
And melons
and deers
hmm, well it has sense
like, MySQL implements some of the SQL standard 2003 and 2011 IIRC
while SQLite only implements a subset of 2003 or something like that (bigger subset than MySQL's but still a subset)
sqlite also obviously has the sanest code of conduct
Satanist?
one could say that
the developers are very religious iirc, yeah
Reminds me of lessons of technical drawing
There were a lot of circles..
Strange.. circles..
does anyone happen to know the structure of an empty nbt list
like I cant give it a proper type
all the wiki says is "[TAG_END] may also be the type of empty List tags"
but idk if that means that an empty list is just a random end tag (doubt it) or if it means that the type of an empty list should be TAG_END (0)
im guessing the latter but hoping someone knows for certain
in which case an empty nbt list would be [9, 0, 0, 0, 0, 0] as byte array
Yes
TAG_LIST TAG_END (0 length)
However I assume the tag end could be any valid list tag
right, well lists have a size so they dont use the end tag to denote the end
Correct
so I guess they just decided to use 0 for an empty list, which happens to be an end tag, thus making the description a little weird
It just denotes what type of tags the list contains
But it’s empty so it doesn’t matter
guys
I coded it to open the sign editor screen with a command using Minecraft.net.server and Packet.
But there is a problem, I want to have text on the sign when the editor opens and I can't do that
does PlayerResourcePackStatusEvent trigger before PlayerJoinEvent?
I mean, I'm testing it and it seems to be like that, but is that always the case?
also, has that changed through versions? if someone joins my server using a lower version, is it going to workd differently for them?
anything final (i.e. loaded, declined, discarded and idk if there's another like that)
I think everything but downloaded and accepted are final
Also idk if the client waits for the download for packs sent on join
nah, I just checked, it does depend on the client's speed to make the connection vs downloading the pack
at least that's what it looks like according to my tests xd
From my experience it will download after you have joined the server
yes, it will ask as a prompt
I'm embracing my true values
Y'all ever sitting there having problems adding something and then your like wait... thats stupid. you can just add the rewards manually in the yml xD
Context: I was making a placeholder for my task reward system. in the gui i was trying to add %ITEMS% and over complicate this lol
no but spent hours of debugging for a problem which was non-existent (i commented a line out)
Any recommendations on a lib for Config Management to simplify Config creation/usage? I am currently using https://github.com/boxbeam/RedLib/wiki/Config-Manager but I think the dev does not have much inspiration to continue supporting it xd
i created my own inside a plugin, was pretty useful to me while being quite messy. maybe it helps you too https://github.com/godcipher/antiac/tree/master/src/main/java/de/godcipher/antiac/config
"lib"
looks like this in the aftermath
# Config version: 3.0
# Configuration settings:
# Stores the last x CPS internally to process
cps-storage-limit: 30
# What click types should AntiAC track? [ATTACK]
allowed-clicktypes: [INTERACT, ATTACK, BLOCK_PLACEMENT, BLOCK_BREAK]
# Enable modern feedback
modern-feedback: false
# Whether to log flagged players
logging: true
# Database URL
database-url: jdbc:mysql://localhost:3306/antiac
# Database username
database-username: root
# Database password
database-password:
# [MYSQL, POSTGRESQL, H2, ORACLE, SQLSERVER, SQLITE]
database-driver: MYSQL
# [MYSQL, POSTGRESQL, H2, ORACLE, SQLSERVER, SQLITE]
database-dialect: MYSQL
# Commands to execute when a player gets flagged
commands: [kick %player%, say %player% got flagged by %check% check!]
# Lowest allowed TPS until the TPS protection kicks in
tps-protection: 15
# Enable violation-based actions
violations: false
# Maximum amount of violations allowed until the player gets flagged
max-allowed-violations: 8
# Whether the server allows bedrock players
bedrock-players: false
Props for making it, but I'd rather use a fully supported lib made and supported by someone else so I don't have to maintain it xd
fair enough
Hello everyone it's not a spigot related question but i don't realy know where to ask
I have a quick question regarding the use of shadowJar. I've configured my task like this:
def pluginJarName = "MyPluginName-1.0.0-all"
// Task to copy the shaded jar into the plugins folder
tasks.register('copyPluginToServer', Copy) {
dependsOn build
from("$buildDir/libs/${pluginJarName}.jar") // Generated jar file
into(serverPluginsDir) // The plugins folder of my server
}
// Run the copy task after shadowJar
shadowJar.finalizedBy(copyPluginToServer)
In my IDE, I've created a Run/Debug configuration to start the server with the Gradle task shadowJar before launching it. This allows me to use Ctrl + Shift + B (the build shortcut) to inject changes and debug without restarting the server.
My question is: should I use the ${plugin-name}-1.0.0-all.jar or the ${plugin-name}-1.0.0.jar? If I'm not mistaken, I should be using the one with the -all suffix, right?
cost me 2 days to figure out i forgot to reset a value which made it inconsistent 
can I create a world with the directory for example worlds/nether
yes
just change name to such?
you have to create/load it with WorldCreator
new WorldCreator("worlds/nether"); would this work?
yes, with .createWorld()
thank you
how would I teleport a player to a different world
cus player.teleport didnt work
world has to be loaded to be able to teleport to it
printing Bukkit.getWorlds shows my world does that mean its loaded or do I have to do another step
no other steps
you likely can;t teleport to the world in the same tick you load it
sure
What are the pros and cons of using packet events instead of nms
Pro: You don;t have to understant nms nor update your plugin everytime it changes.
Cons: You have to wait the the plugin to be updated if it breaks
when you say packet events do you mean protocollib
he means PacketEvents. Its a lib/plugin to replace PLib
oh cool
its also worth noting you're adding a dependency to your plugin which, if you plan to publish the plugin, will put off some people
EntityShootBowEvent#setConsumeItem() is deprecated, is there a replacement to this?
the deprecation would say if there was
spigot use snakeyaml so why people use boostedyaml that is also a derivated of snake??? i don’t get the point
there is no point. They are misguided by someone who once used it and liked it
Someone tell me that because we can update the config and keep comments good
BoostedYaml supported comments when Spigot did not
and now Spigot does
Boosted does have some other features that can be useful
Performance differences?
PacketEvents performance should be good enough
is there a easy way to completely clear a players inventory
player.getInventory().clear()
It does
does player.teleport return false if failed
declaration: package: org.bukkit.entity, interface: Entity

