#help-development
1 messages · Page 69 of 1
Yes, but why isn't it hitting anything? To my knowledge it should be
how can i get a list of every world? Bukkit.getWorlds only returns the overworld
Bukkit only knows about loaded worlds
i would still expect it to return the end and nether
Look for the folders in the server folder
it will, if they are loaded
o h
i'll do that
Bukkit.getWorlds() returns all three on a standard server
How do i get the Block's ItemStack from BlockPlaceEvent
to get the server folder do i just parent up from the plugins folder or is there a better way?
I want to check if it has the PDC values
Yea i think thats it
You can see the code, I save the config
And the changes show up in the config but it just can’t read them for some reason
How to do playerclickevent
Inventory or in world?
Inventory
InventoryClickEvent
You are having this issue because you are saving a copy of the config private final FileConfiguration config = Survival.getInstance().getConfig(); You read from a different instance
Then do whatever you need with the event?
Bukkit.getWorldContainer()
does that just give me the server folder directly?
neat
yes
where can that be changed?
Bukkit.yml
cycle through every world
because then the only proper way is to get the path from the classloader sources root
why not just use Bukkit.getWorlds() ?
it only gives me the overworld for some reason
then the other worlds arent loaded
yeah that's why i'm using folders instead
Bukkit.getWorlds() always returns all currently loaded worlds
essentially i want to store wold specific configs directly in the world directory
that way if the world gets transfered its already configured
well then the world container is exactly what you're looking for anyway
and if it gets deleted its no longer in the config cluttering a single big file
yup
What data are you storing with the world? Each world has a PDC if you are able to read teh data after the world loads
PDC probably isn’t good for config stuff
pdc?
?pdc
persistent data container?
Depends what he is storing
worlds for a bedwars
what data
i have a source world and world i copy from the source
and i want to know if the world is a copy or the original
BUT
i want it to be crash/restart proof
so delete all copies when the server starts if it finds some from a previous crash for eg
as for the originals, all the data telling where each base's bed is, the spawners, the rates etc
not sur i want to use pdc for configs
i could for the copies though
Does anyone know how to register a multiverse event with the Multiverse Core Api?
If I use PlayerDeathEvent on a Hardcore world.
Is there a way to not ban the player? I want to respawn em
hardcore servers dont ban
You should find your answer https://github.com/Multiverse/Multiverse-Core/blob/284b3179ad99a59336a3db894f62d9a96c8979a9/src/main/java/com/onarandombox/MultiverseCore/api/MVWorldManager.java
um, why have it hardcore if its not hardcore?
simply set their gamemode back on the respawn event
sometimes they can respawn
they just leave you in spectator
so its not hardcore. just use normal mode and set to teh correct mode on death
ohhhh
but yeah this is better
why? the point of hardcore is its one life
No, I've read all this in the wiki too. But I still don't know how to create an event listener.
Some hardcore servers have more than one life
Which you may argue is no longer hardcore but meh
Keep in mind if you run it in normal mode you won’t have the hardcore heart texture
ah right
You could probably spoof it with packets
i m bored af so i m makin random plugin requests from people
u can send some if u want
texture is enough of a reason. I just couldn;t see the point in using hardcore if it wasn't
I'll take a copy of Hypixel please
ayo
this is what they wanted, this gives you an item which does nto let u die
but its stupid knowing totems do the same
Lol
Thinking quickly Dave crafted an immortality item using nothing but an old CD, an apple, and an immortality item
Is this fine?
wtf lol
public abstract class Command extends SubCommand {
public abstract List<SubCommand> getSubCommands();
public Command addSubCommand(SubCommand subCommand) {
getSubCommands().add(subCommand);
return this;
}
}
having a non abstract class in an abstract class
all good?
What does subcommand define as methods?
name, description, syntax, usage, etc
I would just have a command class with all that stuff and a list of commands which are the subcommands
Thats another way of doing it
is there have event to checkitemstack move to another the inventory like from playerinventory to chest inventory?
InventoryClickEvent
hmm how to know?
Is it a good idea making my command manager a singleton?
public class CommandManager {
private final Map<String, Command> stringCommandBuilderMap = new HashMap<>();
public Command getCommandBuilder(String command) {
return stringCommandBuilderMap.get(command);
}
public void addCommandBuilder(Command command) {
stringCommandBuilderMap.put(command.getName(), command);
}
}
Might be a bit neater than putting it in the main class
unless there is another way
nevermind I will just make the methods static
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
ffs thats annoying
its good style
yeah but so many steps
its not a lot of steps
more than 1
just pass the instance via contructors
hmm bro do you know how to check if player move itemstack from their inventory to orther chest?
watch youtube videos
?jd-s
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
Look at you, you know all the little commands
?jd-bcc
lol
Is there a way to check if a player can interact with the chat (hover event...)? If they have disabled it in their settings or if they are Bedrock with GeyserMC
no, those are completely client side
a click event is too, unless it runs a command obviously
I know how to detect that the player has disabled his chat so I thought it might be similar
The player syncs that to the server so you can fetch that information iirc
but yea, styling and events of chat are all client side
👍 thanks
This is the tick method for a boat, client side 1.18.2. This suggests that boat movement is handled server side right?
boats are weird
Minecraft is weird
No
No?
But it only calls controlBoat() if it's client side
Yeah
If no passengers it just slows down and stops
That is handled server side
If a player is controlling it that controlBoat method will be fired on the client
and then sends movement to server
controlBoat() is only fired by the client if it's not a server?
I always wondered what Level#isClientSide was
unless I am misunderstanding what level.isClientSide() means
wdym?
flag is always false on a paper server
so it might be the internal server for singleplayer worlds
but it checks if the world is being ran on a server or local right?
And only fired controlBoat() if it's local
so when connected to a server, the client would not be handling the boat movement
It checks if the world is the client world
basically if it's running on the client
Are you saying that there is a 'client world' and 'server world' when the client is connected to a server?
I believe so
The server world is on the server
and the client world on the client
Why would you even need such a check though? When would the client ever have the server world
Singleplayer I guess
Right
I attempted to fix this and it's still not working
public void saveInventory(Player p) throws IOException {
Survival survival = Survival.getInstance();
survival.getConfig().set(p.getName() + ".inventory.armor", p.getInventory().getArmorContents());
survival.getConfig().set(p.getName() + ".inventory.content", p.getInventory().getContents());
survival.saveConfig();
}
Ok thanks for the help
you have a Field too
The simple fix is to stop using fields to store yoru config. the lazy way is to call Plugin#reloadConfig() after saving
public void restoreInventory(Player p) throws IOException {
Configuration config= Survival.getInstance().getConfig();
ItemStack[] armour = config.getList(p.getName() + ".inventory.armor").toArray(new ItemStack[0]);
ItemStack[] content = config.getList(p.getName() + ".inventory.content").toArray(new ItemStack[0]);
p.getInventory().setArmorContents(armour);
p.getInventory().setContents(content);
}
The issue occurs when restoring
Well my plan to work around this then is to put the player on an invisible entity on the boat, listen to steering packet, then handle boat movement on the server. That should work right?
What should I do?
Reload config?
Reloading config after saving worked
tysm
The only reason im using a config to store inventory data is because I know im only using this on a small scale
Theorically yes. But I already imagine a mess doing it
If I'm storing max 5 players at a time then there can't be an issue 
Minecraft protocol isn't friend with sever-side movements control...
stackoverflow sucks lol, just wondering how to save an uuid in sqlite
So I want to make a command that resets the world.
Currently it resets the region files from a backup, but after a restart, the changes have not been applied. How do I make it so that my changes take effect?
binary blob iirc
wondering how to implement that
how come?
use a ByteBuffer
smth like this?
like this
anyone #help-server
would recommend making some sort of abstraction for serialization
public abstract class VariableSerializer<T> {
public abstract byte[] serialize(T obj);
public abstract T deserialize(byte[] str);
}```
like this
help plz
bro just be patient
dont advertise your question we know it's there
but can u help?
no i have no idea about the plugin
if you're really that desperate go ask the plugin dev's discord
would PreparedStatement::getBytes work on a column which i declared as BLOB?
ill try
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
List<WrappedChatComponent> components = packet.getChatComponents().getValues();
for (WrappedChatComponent component : components) {
//component.setJson(component.getJson().replace("Swear", "*****"));
packet.getChatComponents().write(components.indexOf(component), component);
}
}
Hi i made this code with protocollib one thing how i can get the message sent by the server?
yes
but got an issue where sqlite couldnt find my record when the pk matched :/
sqlite is pain
so i hope using uuid in that format will work
getObject doesn't work with sqlite
packet.getStrings().read(0) iirc
let me check
https://pastebin.com/KDyh3A49 so the antylogout sort of works correctly yet there is a problem, i did this wait(15000) and hashmap.remove(uuid) but i still die when logging out after 15 seconds, why?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lmfao ok wtf
what is wait()?
wait(15000) just locks your server's thread
for 15 seconds
effectively crashing your server
okay, how do runnables work?
?scheduling
Its this and i meed to import it as string i think?
okay, thanks
wdym import it
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
String message = packet.getStrings().read(0);
}```
Nah mean like String text = …
declare it, yeah
Thanks
doesnt that apply to all packets?
thats only a snippet of the entire code
protocol lib requires packet type when declaring a packet listener
smh select query doesnt want to match
i'm clearly in the database but it doesnt want to match
im battling in my mind whether i want to split my massivep lugin into separate mini plugins
?
What is an api guys
"SELECT * FROM players WHERE uuid=?" doesnt want to match any record
in the screenshot you sent you didnt use the where
also
there is a |0
How to change api of plugin
maybe das the table index 🤔
stored level
you don't
lol
not how it works lol
the plugin has to change its API
so close to the data and withou a indicator? 🤔
so I guess contribute
an api is basically how plugins talk to other plugins
What
uuid|level ??????????
yes
i haven't used sqlite cli once in my life
xD
still needs to be extended
DIE
Can someone change api or my plugin
?
that is a collum right ?
those are 2 column
dunno what ur saying
phew
no
🥶
wrong channel
bruh
sqlite cli lol
bruh i dont care i just want to see whats there
that on the cli?
Mongo Compass oh wait you use midql
yes
Hey, I'm getting this error when I call this method:
[14:33:27 ERROR]: Could not pass event PlayerChangedWorldEvent to RunnerVSHunter v1.0
java.lang.NullPointerException: Cannot invoke "org.bukkit.World.getName()" because "map.world" is null
at com.sinden.runnervshunter.manager.GameManager.setGameState(GameManager.java:35)
METHOD + CLASS:
https://pastebin.com/5XVWRRR5
CreateMap constructor:
https://pastebin.com/izMN3uds
world null lol
Null pointer at GameManager 35
dunno you would even call your class CreateMap
._.
MapFactory
Hi can someone add stocks to supermobcoins plugin for me using their mobcoinshopevent api
maybe you are getting the world before it was loaded
in the constructor
Hi im having an issues im using the packet serverbound chat message for translate other plugin message but this doesn't work how i can do that? (with protocollib or other method)
No suitable driver found for jdbc:mysql://############/###########?useSSL=false pls help im on 1.19.2
might be, il lcheck it
i tagged it so i no get hacked lol
ah yes
any idea why no working?
.
127.0.0.1?
?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/
so the ip is
so anyone can connect
whats the point of using an externally hosted mysql server?
The plugin admin said it's easy but idk how
im making a public server
This is the wrong place. Go somewhere else
so i want the database to be up at all times
?
This help development channel?
So you're making an addon/plugin yourself

bump
Yes
That constructor doesn't exist use;
/**
* Creates event with an action and a list of contents.
*
* @param action action of this event
* @param contents array of contents, provide at least one
*/
public HoverEvent(Action action, Content... contents)
Content being Text
code block hehehaeha
Are you using maven or gradle?
What
Bruh f off I told you if the dev doesn't want to answer your questions go elsewhere. You aren't a dev and we aren't going to spoonfeed you
none ig
?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/
Hire a dev
I can't post there
Don't need a post to contact a dev offering
Ok
bump
What is "Content"
Content being Text
Which one do I choose
new Text("Hello World!");
Whatever one you want your the buyer not me
lmfao
Because it can be more than just a string
You can also have items in hover components
items?
Mhm
How does that look?
My God you are just wasting my time didn't realize you were that kinda mf
You see the tooltip
do you not understand how an api works
As if it was in an inventory
Ah I see
Just a troll
wait thats a thing
Mhm
Man I just want help why r u rude about it
If u don't want to help me don't reply
"my plugin" how do you make a plugin without ever having spigot?
man probably paid for "his" plugin
Super mob coins plugin
From spigot mc
stored in the block chain
In btc
Ahaha
I bought from mc market it's not in spigot
public class onPlayerDeath implements Listener {
Main plugin;
public onPlayerDeath(Main plugin) {
this.plugin = plugin;
}
@EventHandler
public void onPlayerKilled(PlayerDeathEvent event) {
Player victim = event.getEntity();
if (victim.getKiller() instanceof Player) {
Player killer = victim.getKiller();
if(killer != victim) {
double vHealth = victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
double kHealth = killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(vHealth - 2);
killer.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(kHealth + 2);
if(victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 0.0) {
victim.kickPlayer("Tu foste banido do servidor por teres 0 corações!");
}
}
event.setDeathMessage(ChatColor.YELLOW + victim.getName() + ChatColor.RED + "(" + victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() + " Corações) " + ChatColor.WHITE + "foi morto por " + ChatColor.YELLOW + killer.getName() + ChatColor.RED + "(" + victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
} else {
double vHealth = victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(vHealth - 2);
if (victim.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue() <= 0.0) {
victim.kickPlayer("Tu foste banido do servidor por teres 0 corações!");
}
}
}
}```
i want when a player die the player lose 1 heart permanently and the killer win 1 heart "lifesteal"
but this isnt working
Oh wait, judging by this guy, it's probs stored in an NFT
My NFT plugin guys
reuse variables
sorry for bumping but i wana die right now
Life steal plug8n number 100,001
uhm naming conventions lol
design patterns where
caching stuff where?
?main
ah you alr said that
Who wants to add a stock api to super mob coins plugin
im having an issues im using the packet serverbound chat message for translate other plugin message but this doesn't work how i can do that? (with protocollib or other method)
Please stop asking here
The plugin admin said it's easy
wrong place
We've told you so many times now
do you not know how to reverse engineer nms packets
Then which option I choose at services
no...
can someone help me please?
uhh storing variables when?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
?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/
class names start with an uppercase chaaracter lol
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
read around this part
Plz idk which option to choose for adding api
If you want help with development then pose an actual question
You shouldn't be running a server without basic logic intact
Yup, go back to scratch
I want to add stock to mob coins shop
(They can't code)
(They are a troll yet we are still responding)
(I think they can read this even tho its in brackets)
Shit
stock?
Noooo
Yes
this is my first time using mysql soooo pls forgive me for bumping
why u need api for that?
Because he doesn't know how to use a plugin config or code so he wants to be spoonfed
;-;
This server use super mob coins and they have stock but I dont
Good luck ❤️
Which server?
The plugin admin said u can make api for this
Pika network
bro u don't need api?
i can't do that with protocollib directly and my real question is what packet manage that the chat one doesn't manage that how i can edit the directly sended like that (p.sendMessage("Hi my message") ) <= Grab this and edit it
Then what
Could you show your code? And did you include a MySQL driver in your plugin?
If it's your first time read this guide: https://www.spigotmc.org/wiki/connecting-to-databases-mysql/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Just look on their wiki or docs how to add stock
They don't have that
ok tysm
if you do need api for stock in a shop that's a very dumb plugin
Step 1) Download intelliJ
Step 2) Get git
Step 3) clone the repo
Step 4) Get a test server
Step 5) Get maven
Step 6) Build it
Step 7) Get mongo
Step 8) Store an int in mongo
Step 9) Edit the int when the stock changes
Step 10) Compile and enjoy
what plugin supports EssentialsX and show balance
Wrong channel. Use #help-server
oh i get it @marble copper
And also the timer of their plugin doesn't work it only changes when u reopen the gui
yes
does it use normal economy?
No its mob coins plugin
and not mob coins
SuperMobCoins
./transfer
Can you guys move to #help-server
I already told you how to do it without paying a dev and no experience
Yes in the config they have gui for shop I edited it
But there is no stock option in config
Help development is no more welcome to helpserver 2
go do what @crude charm said or ask google
What is int
i gtg
sup
Is there any other mob coins plugin with stock
This isn't even java knowledge, an integer is basic math terminology
I know integers
lol
int is when you intentionally feed in a game such as league of legends
U said int it confused me
dude look at this guys youtube channel 😂 bruh
@marble copper what do u want anyways
Stock plugin for mobcoins
make it yourself then
Do you even own the game?
They can't code and they refuse to stop posting here
probably not xD
I have a server and I need mobcoins for the server
:O league of legends
more like league of dumb
wow so funny!
i used to play that
i dont see the funny here
.
Again wrong channel
Some vbucks
I bought the mobcoins plugin
mmm I didn't reply to zoibox
It's bad
What did you expect from mcm
Supermobcoins?
I know
Their other plugins r good
soo im confused by and don't forget to shade and relocate this. what dose that mean?
I thought spigot had the MySQL driver
It should but it's quite old
shade with maven
Anyone help plzz
Stop posting here
thanks
thanks
Can anyone here make mobcoins plugin with stock I'll buy it
Stop posting here
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/
Make a post in services
I checked
#help-development is the channel for development help, and if you aren't writing code yourself then you shouldn't be asking your question
They don’t have the post requirement
There's is no api developer
API dev as in?
Anyone know any good sounds for completing a quest?
Ghast scream
fireworks maybe
The level up sound
is that required coz i just testing
yes, otherwise it will not start up iirc
(assuming you are talking about bstats, too lazy to check)
MySQL driver
i was talking about mysql driver
Then it is probably optional
thanks
However, you may need to shade it in anyways unless you include it on the runtime classpath by other means
sql driver is usually included
Time to shade your depenedencies
WUTTTTTTT
Like 26 is:
getCommand("acceptinventoryrestoration").setExecutor(new AcceptInventoryRestoreCommand());
[23:37:17 ERROR]: Error occurred while enabling Survival v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.zoibox.survival.Survival.getCommand(String)" is null
at me.zoibox.survival.Survival.onEnable(Survival.java:26) ~[Survival-1.0-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:548) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:596) ~[purpur-1.19.2.jar:git-Purpur-1761]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:510) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:641) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:427) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:342) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1141) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1761]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[23:37:17 INFO]: [Survival] Disabling Survival v1.0-SNAPSHOT
acceptinventoryrestoration
register it in plugin.yml
why so long 💀
Secret command
indentation
Does anyone know how to get ormlite to work with spigot? been trying a bunch of different versions and no luck, using ormlite 6.1 and ormlite-jdbc 6.1 as well as the mysql-connector-java package, complains about this "Could not find class 'com.j256.ormlite.jdbc.JdbcConnectionSource', referenced from method Is it even possible to integrate Spigot with Ormlite? My guess is during the maven package script it is not including the dependencies in the final output jar.
package should include them if youve got the shade plugin set up properly
?paste your pom.xml
https://paste.md-5.net/wewidoqama.xml this is the pom.xml without the ormlite dependencies
you need to include maven-shade-plugin in your <plugins>
shading is confusing lol
ah I see
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
then dose it not shade the spigot api?
no, because spigot-api is set to provided
right
provided dependencies are not shaded
makes sense
but compile dose right?
sqlite weird
.
Yea ^
have been trying for two days now lol but that stupid select query doesnt want to match
@visual tide damn I've been trying to figure this out for 2 days and I'm glad I joined this server, shading the plugin worked and I can actually use ormlite. thanks a lot!
hmmm still get the error: No suitable driver found for jdbc:mysql://############/###########?useSSL=false. pom.xml: https://paste.md-5.net/uzigipedev.xml
i would've been miserable using raw sql statements and doing everything with the result set object
how can i detect if chest being open by any other player?
so why no work i hate this so much
what is this theme?
didnt work yesterday with uuids as strings and today it doesnt work with byte arrays
one dark vivid
inventory open event then check if inventory is chest
code btw java connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=false", username, password);
That is what i would think
mysql works with hikaricp right?
with what?
connection pool
im doing function that makes so if specific chest is being open then any other player cant break it, so this event doesnt fit me because im already using blockbreakevent
oh idk
How i can edit message sended by the server (plugin) i tried with the serverbound chat message with protocollib but doesn't seem to work (how i can do that?)
Can you set name of that chest?
no
?jd-s
declaration: package: org.bukkit.inventory, interface: BlockInventoryHolder
You cannot get the view out of it it seems like so you cannot set the title
https://paste.md-5.net/ikemaguyix.md full log
im coding plugin for 1.8
there is no this method
when EntityDamgeByEntity event cast?
after get Damaged?
There is still https://helpch.at/docs/1.8.8/org/bukkit/block/Chest.html#getBlockInventory() though
Why is the are the values stored in the ArrayList not being fed to the Accept class?
RestoreInventoryCommand Class:
https://hastebin.com/zesoqogulu.java
Accept class:
https://hastebin.com/giyusojuku.java
Ik I could just pass it by using static but its static abuse
new RestoreInventoryCommand()
basically you create a new sample/unit/object/thing every time, thus a new array list is created everytime
hence different array lists are being used
🤤 I actually made a really nice utility class for click action text components
static abuse
🤩🤩🤩
I have one as well... somewhere
look at my beautiful code...
public static TextComponent.Builder addComponentText(List<?> objects, String command, String hoverText) {
var componentText = Component.text();
for(Object object : objects) {
componentText.append(Component.text(object.toString())
.clickEvent(ClickEvent.runCommand(command.replace("<object>", object.toString())))
.hoverEvent(HoverEvent.showText(Kyori.mini(hoverText))));
if(objects.indexOf(object) != objects.size() - 1) {
componentText.append(Component.text(", "));
}
}
return componentText;
}
i see Class.forName() fixing ppls issue thats the same as mine but i dont know to use it for MySQL connector
Hey so, i've done remote debugging for a while now, but I booted up my pc today and it stopped working. The code doesn't hit the breakpoints at all anymore.
It's the jar application type one
Why could that be?

is this a correct way of doing that?
private final @NotNull Map<String, Class<? extends CommandExecutor>> availableCommands = Map.of(
"close", CloseCommand.class,
"test", ScreenCommand.class
);
// ...
private void loadCommands(){
FileConfiguration config = this.getConfig();
List<String> commands = config.getStringList("enabled-commands").stream().filter(availableCommands::containsKey).toList();
for (String commandName : commands) {
PluginCommand command = Objects.requireNonNull(getCommand(commandName));
try {
CommandExecutor executor = availableCommands.get(commandName).getDeclaredConstructor().newInstance();
command.setExecutor(executor);
} catch (InvocationTargetException | InstantiationException | NoSuchMethodException | IllegalAccessException e) {
getLogger().warning("Couldn't create command: " + commandName);
e.printStackTrace();
}
}
}
config:
enabled-commands:
test: true
close: true
i fix the error No suitable driver found for jdbc:mysql: with java try { Class.forName("com.mysql.cj.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } posting for if ppl have this problem
Hey, how do I build a 1.19.1/2 jar again? java -jar BuildTools.jar --rev latest, or 1.19/.1/.2 all give me a compilation failure:
https://paste.gg/p/anonymous/a0dcd475c4f543929e98f80e4c8ea121
Either you are using a too old JDK version or a too new one (latter is unlikely)
However I fail to understand how this happened
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
Try using the latest Java 17 adoptium release
^ also delete all old BuildTools files and let it start over
Hi
any one got a clue why th is this happening when i tryna build my plugin
I got muted but now I'm back and I need help with deluxe menus
I want to make a stock shop with deluxe menus
Van someone help
wrong channel
Code is wrong
how can you tell?
Could you give us the whole pom.xml?
of course
From experience
And which code is wrong?
U can't see it properly but there's red color on it
The target folder?
Yeah
Hey um how much will it take for a dev to make a black market plugin
What happens if you do mvn install (or comparable) on the API module first?
here's the thing i do clean package
and API module should build first anyways
i dont know why it isnt
What plugin r u making
actually i got whats wrong
It cannot resolve the API module - so my idea was to look at whether it will resolve it when it is in the maven local dir
directory or dictionary?
Figured as such - just wanted to be sure
hmm reproduced same thing where sqlite cant find record with byte array as pk
dunno how to fix
its always printing no query found
fuck forget to close db
for (ItemStack content : config.getList(player.getName() + ".inventory.content").toArray(new ItemStack[0])) {
for (ItemStack armour : config.getList(player.getName() + ".inventory.armor").toArray(new ItemStack[0])) {
Inventory inv = Bukkit.createInventory(null, 54, CC.GREEN + player.getName() + "'s restored inventory");
inv.addItem(content);
inv.addItem(armour);
player.openInventory(inv);
}
}
What's wrong with this? Why is it giving me a null pointer?
giving the NPE where?
?jd-s
?
[00:54:33 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'previewrestorechest' in plugin Survival v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:168) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:942) ~[purpur-1.19.2.jar:git-Purpur-1761]
at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[purpur-1.19.2.jar:git-Purpur-1761]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[purpur-1.19.2.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:311) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:295) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2390) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$21(ServerGamePacketListenerImpl.java:2344) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1387) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1364) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1357) ~[purpur-1.19.2.jar:git-Purpur-1761] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1335) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1223) ~[purpur-1.19.2.jar:git-Purpur-1761]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1761]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Item cannot be null
at org.apache.commons.lang.Validate.noNullElements(Validate.java:364) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventory.addItem(CraftInventory.java:292) ~[purpur-1.19.2.jar:git-Purpur-1761]
at me.zoibox.survival.commands.PreviewRestoreChestCommand.onCommand(PreviewRestoreChestCommand.java:40) ~[Survival-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more
>
ah that is not a NPE
Thank you, the changes suggested made it work (Changed from Zulu to OpenJDK and deleted leftover buildtools files)
It has items which are restored fine with my restore command
And nothing of note above that message?
Nothing at all
Thats the full error
Caused by: java.lang.IllegalArgumentException: Item cannot be null
at org.apache.commons.lang.Validate.noNullElements(Validate.java:364) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftInventory.addItem(CraftInventory.java:292) ~[purpur-1.19.2.jar:git-Purpur-1761]
at me.zoibox.survival.commands.PreviewRestoreChestCommand.onCommand(PreviewRestoreChestCommand.java:40) ~[Survival-1.0-SNAPSHOT.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
... 23 more
We are idiots
Can't see the forest from all the trees
You are deserializing Items as null
just do a null check and replace the null items with air
lol when trying to reproduce my issue everything works fine but in my project it doesnt
💀
depression
https://ormlite.com/ if you find sql syntax boring, try this
or just use jooq 
isn't it paid?
hmm i might
no lol
its open source ?
hmm it turns out its free, but
did you just call jooq heavy compared to an orm ?
ormlite is very lightweight compared to jooq
I guess ?
I mean one has all the not fun orm issues
the other is a nice wrapper around sql
sooo i know its not a spigot qustion but how to i query 2 keys at once in MySQL
also kekw
is there a way to run mcfunction (datapack) file using spigot plugin?
often those vulns come from test-dependencies such as junit
ok
Welp doesn't matter
What type of a null check? This is what I have and im still getting the error
for (ItemStack items : inv.getStorageContents()) {
if (items == null)
items.setType(Material.AIR);
}
lmao
they work until they don#t and then you get to mix orm with sql and everything explodes
if (items == null) { items = new ItemStack(Material.AIR); }
I am surprised that even compiled for you. The IDE must have been screaming hard at that
It's still giving me an error
https://hastebin.com/uqukiburiv.properties
Full class:
public class PreviewRestoreChestCommand implements CommandExecutor {
public InventoryUtility inventoryUtility = new InventoryUtility();
@Override
public boolean onCommand(CommandSender sender, Command command, String lavel, String[] args) {
if (command.getName().equals("previewrestorechest")) {
Player player = (Player) sender;
if (!RestoreInventoryCommand.hasRestoreRequest.contains(player)) {
player.sendMessage(CC.RED + "You don't have an outstanding inventory restoration request!");
} else {
Configuration config = Survival.getInstance().getConfig();
ItemStack[] armour = config.getList(player.getName() + ".inventory.armor").toArray(new ItemStack[0]);
ItemStack[] content = config.getList(player.getName() + ".inventory.content").toArray(new ItemStack[0]);
Inventory inv = Bukkit.createInventory(null, 54, CC.GREEN + player.getName() + "'s restored inventory");
for (ItemStack items : inv.getStorageContents()) {
if (items == null)
items = new ItemStack(Material.AIR);
}
inv.addItem(content);
inv.addItem(armour);
player.openInventory(inv);
}
}
return false;
}
}
Ah I think I might know
I think its order
is there a method to check if server is behind bungee?
Nope
i could check spigot.yml file but is that good idk
ItemStack[] armour = config.getList(player.getName() + ".inventory.armor").toArray(new ItemStack[0]);
ItemStack[] content = config.getList(player.getName() + ".inventory.content").toArray(new ItemStack[0]);
for (int i = 0; i < armour.length; i++) {if (armour[i] == null) {armour[i] = new ItemStack(Material.AIR);}}
for (int i = 0; i < content.length; i++) {if (content[i] == null) {content[i] = new ItemStack(Material.AIR);}}
Inventory inv = Bukkit.createInventory(null, 54, CC.GREEN + player.getName() + "'s restored inventory");
for (ItemStack items : inv.getStorageContents()) {
inv.addItem(content);
inv.addItem(armour);
player.openInventory(inv);
}
@crude charm
Having null be represented as air is kinda being phased out atm
Just takes a very, very long time
Oh uh, found a bug
It gives it to me correctly just doesnt show it in the menu right
im detecting static abuse here....
instantiating utility class 👀
Am I not supposed to? If I dont then ill get a null pointer?
💀
?
utility classes should be stateless and shouldnt be instantiated
If I dont then ill get a null pointer?
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I know what di is
How to start updating plugins from 1.18 to 1.19?
I dont use it all the time tho cause I end up having 50 variables to instantiate one class
or in the way the spigot guide states which requiring the var
i mean that code you posted would require two parameters
One? Just the arraylist, no?
you could also pass a container that holds instances of the objects you need
Survival and RestoreInventoryCommand
This is the first project I have used static for getting an instance of main
and it's so much easier
and faster
And doesnt force you to think about your design so you can just hack in your stuff so that it works.
exactly
Static is a thing for a reason, if you constantly try not to use it then they may as well remove it
I love to have messy code without any design patterns that create bugs which take you at least the same time to debug that you needed to write it in the first place.
there is drawbacks to using static as well as some other things. You don't necessarily need to actively avoid it, but in general if you don't need something to be static then best to not use it.
I was coding and wanted to send the argument from the command a player was executing, and instead of getting Test from /test Test i got something like this lJava.lang.String;@b93f202 any way to fix this?
Thats the thing tho, there is ALWAYS going to be a way to avoid using it
calling toString or smth?
not true
actually String::toString would just returns itself iirc
show your code
constants (one example of many)
Good point, but still
statics are a handy way to keep some objects from being GC'ed since anything static will never go away.
?di use this instead of the JavaPlugin.getPlugin
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
and class names start with an uppercase char
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Why is this happening?
public class PreviewRestoreChestCommand implements CommandExecutor {
public InventoryUtility inventoryUtility = new InventoryUtility();
@Override
public boolean onCommand(CommandSender sender, Command command, String lavel, String[] args) {
if (command.getName().equals("previewrestorechest")) {
Player player = (Player) sender;
if (!RestoreInventoryCommand.hasRestoreRequest.contains(player)) {
player.sendMessage(CC.RED + "You don't have an outstanding inventory restoration request!");
} else {
Configuration config = Survival.getInstance().getConfig();
ItemStack[] armour = config.getList(player.getName() + ".inventory.armor").toArray(new ItemStack[0]);
ItemStack[] content = config.getList(player.getName() + ".inventory.content").toArray(new ItemStack[0]);
for (int i = 0; i < armour.length; i++) {
if (armour[i] == null) {
armour[i] = new ItemStack(Material.AIR);
}
}
for (int i = 0; i < content.length; i++) {
if (content[i] == null) {
content[i] = new ItemStack(Material.AIR);
}
}
Inventory inv = Bukkit.createInventory(null, 54, CC.GREEN + player.getName() + "'s restored inventory");
for (ItemStack items : inv.getStorageContents()) {
inv.addItem(content);
inv.addItem(armour);
player.openInventory(inv);
}
}
}
return false;
}
}
instead of args.toString, use args[0]
when you use toString on an array, it gives you the string representation of the array
and not what is in the array
oh okay
Arrays.toString if you really want to see the contents of the array
armour 
..
what?
anyone know any modern guides / tutorials on NMS and packets and stuff?
?
and am i misreading or is 7smile agreeing with you about static abuse
ah
sarcasm
I thought i was sarcastic enough
lmfao
i think zoibox actually thought you were serious though
Committing a cardinal sin
lol
nms and packets are not supported or standardised. All you do when using it, is reverse engineer
and play around. You mainly start with the CraftBukkit implementations and then dig your way through.
Its easier if you have specific issues.
to your design, yes
also, it helps to learn about reflection first as well
before going messing with NMS stuff
tbh the amount of reflection you need for nms is pretty basic it's self explanatory
Whoiy?
because sometimes it is necessary to use when messing about with NMS
What about it?
With the latest versions its really rare because everything is so data driven now.
I actually cant remember if i ever used any reflections after 1.17
so u decompile spigot.jar, and play with stuff. but how does one recompile it? recompiling methods vary
you don't need to decompile it, buildtools gives you the sources already
the only thing that would require decompiling is the minecraft jar if you are wanting to mess with stuff that spigot doesn't use or import
i ignored the buildtools folder until today. is the source just in BuildTools/ or another subdir?
depends which source you are looking for
in the work directory you will find the source classes for the minecraft jar
the ones that let me mess with packets, make custom mob classes, etc
in the build directory you will find the sources for spigot server and api
which one will let me do this
I usually just use Intellij. Really helps navigating through there when you know some shortcuts.
i use notepad!
and one last thing: how would i compile it into a usable jar once i changed some stuff
i actually coded a forge mod with notepad once
i use intellij too!
completely with notepad, no ide used
@wet breach
should only need spigot-server to mess with packets
what about custom mob classes, item classes, and whatnot
same thing
so what would i need the work directory for?
when needing to look at vanilla class files and not spigot ones
spigot doesn't use all the class files, but uses a fair bit
so for the ones it doesn't use, will need to look there for them to get an idea of what it does etc
just because spigot doesn't use it, doesn't mean it isn't being used, just means spigot doesn't modify it thus no need to import it
hey, anyone know of a good mapping tool for minecraft worlds? I just need a 2d top down map of a world, not for real time (so not dynmap)
so i have theoretically modified the buildtools/build classes
how would i compile it into a new spigot.jar file?
just take a screenshot of dynmap’s loaded image with no one online
I don't use dynmap
@wet breach
install it then or fly up really high in ur world
you wouldn't unless you want a custom server instead
is it possible to get plugin list (bungee) from spigot plugin?
you would probably need to make use of channels or communicate between two plugins to get the plugin list on a bungee server
so when I add a custom mob class with all the stuff in the BuildTools/build folder, I can just start up my server from my server folder? (seperate folder) im guessing not, so how would I import the new + updated NMS + packet senders and recievers
btw, how should i add urls properly in config.yml? the upper version or the downward one?
both will get accepted
but when i use getConfig.getString("Plugins." + args[0] + ".Link") it shows null
How can I receive plugin messages from a BungeeCord plugin?
so how can I, for example, read the url from the string and send it to the player?
Like you would read any other string
If args[0] is "Test" it should not return null
dunno
but i think i found a workaround
i will just create strings with those links in config.yml and just read it from there
Is the other jar in the compile classpath?
If not, is it possible to add it to the compile classpath?
that's my other jar
i add in classpath
but when i set true just set on my first jar
the second jar still false
yes, that is because you create a new variable
juicyraspberrypie yummy
😋
assuming the .getInstance method works as intended, it is possible that you will have issues such as thiis one if you shade the jar
Show the plugin.yml of both plugins
and the other plugin.yml?
If I register an event listener inside a class that will be instantiated multiple times, it will register my event listener multiple times, right?
And if so, is there a way for me to unregister the event listener?
Then you need to define plugin A as a dependency of plugin B
i will try now
plugin A is loading too early and as such you are getting a var from plugin B before it is loaded
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
how do i check if command's argument is equal to the name of the string?
ima save you all the hassle and suggest that u'd try to read about pluginMessages
it's a special communication channel for plugins
cause i got
if (args.equals(config.getConfig().contains(args[0]))) { TextComponent component1 = Component.text("Error") .color(TextColor.color(255,0,0)) .hoverEvent(Component.text("error")) .clickEvent(ClickEvent.suggestCommand("/nhelp")); }
and it throws up internal server error
send the whole method
not just that bit
`public class Help implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Player player = (Player) sender;
if (sender instanceof Player) {
if (args.length == 1) {
TextComponent component = Component.text(args[0])
.hoverEvent(Component.text("press to get to the website").color(TextColor.color(0, 255, 0)))
.clickEvent(ClickEvent.openUrl(NesterosPlus.getPlugin(NesterosPlus.class).getConfig().getString(args[0])));
player.sendMessage(component);
if (args.equals(NesterosPlus.getPlugin(NesterosPlus.class).getConfig().contains(args[0]))) {
TextComponent component1 = Component.text("Error")
.color(TextColor.color(255,0,0))
.hoverEvent(Component.text("error"))
.clickEvent(ClickEvent.suggestCommand("/nhelp"));
}
}
else {
player.sendMessage("Sprecyzuj plugin");
}
}
return true;
}
}`
args is an array
u're essentially saying if an array is equals to a boolean
to different types
you should rephrase your code cause I doubt thats what you meant
wrap the entire code in ``` rather than single `s
```java
code
```
?paste it
or paste ^^
using dependency injection returns this
dont cast sender before you know its an actual player
java.lang.NullPointerException: Cannot invoke "org.wensheng.juicyraspberrypie.JuicyRaspberryPie.setEvento(boolean)" because "this.pie" is null
pie is null
ok
yeah, but i still working to call pie
wait are mc songs saved in an ogg file?
Minecraft uses vorbis (.ogg) for all sounds
Can anyone tell me how to make a specific command public to everyone?
So I want to make a command that resets the world.
Currently it resets the region files from a backup, but after a restart, the changes have not been applied. How do I make it so that my changes take effect?
maybe show code
try {
File regionFolder = new File(gameManager.getPlugin().lobbyFolder, "region");
Bukkit.unloadWorld("world", false);
FileUtil.copy(regionFolder,
new File(new File(Bukkit.getWorldContainer().getParentFile(), "world"), "region"));
Bukkit.createWorld(new WorldCreator("world"));
sender.sendMessage(ChatColor.GREEN + "Lobby reset");
} catch (IOException e) {
if (Bukkit.getWorld("world") == null) {
Bukkit.createWorld(new WorldCreator("world"));
}
sender.sendMessage(ChatColor.RED + "Failed to reset lobby");
Bukkit.getLogger().severe("Failed to reset lobby");
e.printStackTrace();
}
(FileUtil.copy(...) is a custom class, but it works)
Wtf
java.lang.NullPointerException: Cannot invoke "net.md_5.bungee.api.chat.BaseComponent.getExtra()" because "root" is null
public static void say(ClickEvent clickEvent, HoverEvent hoverEvent, TextComponent... messages) {
RanksLib.getRanksCache().forEach((loopUUID, loopID) -> {
ProxiedPlayer loopPlayer = Proxy.getInstance().getProxy().getPlayer(loopUUID);
if (loopID > 80 && loopPlayer != null && loopPlayer.isConnected()) {
if (clickEvent != null) {
for (TextComponent message : messages)
message.setClickEvent(clickEvent);
}
if (hoverEvent != null) {
for (TextComponent message : messages)
message.setHoverEvent(hoverEvent);
}
loopPlayer.sendMessage(messages);
Proxy.getInstance().getProxy().getConsole().sendMessage(messages);
}
});
}
What does "root" is null mean
You cannot unload the primary world
Send the full error
?paste
Can you recreate the issue using Bungeecord
I'll try
PrepareItemEnchantEvent gets fired twice, does anyone have any idea about reason?
Called when an ItemStack is inserted in an enchantment table - can be called multiple times
Sounds like it's working as intended
When I put my sword into enchanting table it should be called on time
