#Hello, i have a problem with this error and i don't know the problem :/ can someone help me pls ?

36 messages · Page 1 of 1 (latest)

golden roost
#

[15:22:27 ERROR]: Error occurred while enabling GalaxySkyblock v1.0 (Is it up to date?)
java.lang.IllegalArgumentException: Plugin already initialized!
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:98) ~[spigot-1.8.8.jar:git-Bukkit-741a1bd]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[spigot-1.8.8.jar:git-Bukkit-741a1bd]
at fr.electroking.galaxyskyblock.CustomItems.<init>(CustomItems.java:13) ~[?:?]

minor questBOT
#

This post has been reserved for your question.

Hey @golden roost! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

golden roost
lucid leaf
#

that happens when the class extending JavaPlugin is instantiated multiple times

golden roost
minor questBOT
lucid leaf
#

no just make sure that CustomItems is only instantiated once. Are you using Spigot ?

golden roost
#

last line

lucid leaf
#

yeah that is the problem

golden roost
lucid leaf
#

using static ? You have to register your CommandExecutor to your custom command

lucid leaf
#

why do you have two classes extending JavaPlugin?

golden roost
#

i was trying to add some customItem, like a custom manager, like this i will be able to call a new item when i want

lucid leaf
#

only one class should extend JavaPlugin

golden roost
golden roost
minor questBOT
lucid leaf
#

btw why are you using four different instances of AllCommands

golden roost
lucid leaf
#

they all still rely on the same method

golden roost
#

im new to java, but im ancient to c# x)

golden roost
lucid leaf
#

show me the onCommand method in your AllCommands class

golden roost
lucid leaf
#

yeah you are differentiating between the different commands by using their respective names. However, there is no need to create four instances of the class AllCommands for that. Instead you can just do:

AllCommands executor = new AllCommands();
getCommand().setExecutor(executor);
...
minor questBOT
# golden roost oh yes okey i see, thanks

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

golden roost
#

btw do you know an event to add stuff only when it's the first time a player join ?

lucid leaf
#

i'm not too sure. You can use the PlayerJoinEvent to detect if a player has joined. Maybe add some metadata to the player that let's you determine if the player has newly joined or has joined once before. Or you could check the username cache although I don't know how to do that in the context of a plugin

golden roost
minor questBOT
golden roost
#

thanks you so much 🙏