[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) ~[?:?]
#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)
⌛ This post has been reserved for your question.
Hey @golden roost! Please use
/closeor theClose Postbutton 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.
that happens when the class extending JavaPlugin is instantiated multiple times
oh, thanks, and how do i fix it ? i have to remove extends ?
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.
no just make sure that CustomItems is only instantiated once. Are you using Spigot ?
yes i am, huh, if i got what you said it's this the problem ?
last line
yeah that is the problem
the right way to do it is using static no ? but im not sure how to do it, can you help me ?
using static ? You have to register your CommandExecutor to your custom command
but it is all done :3
why do you have two classes extending JavaPlugin?
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
only one class should extend JavaPlugin
oh okey
oh yes i just removed it thats was purely a misstake ^^' 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.
btw why are you using four different instances of AllCommands
cause i got 4 commands ^^' ?
they all still rely on the same method
im new to java, but im ancient to c# x)
but what do i put in getcommand("") so ?
show me the onCommand method in your AllCommands class
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);
...
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.
btw do you know an event to add stuff only when it's the first time a player join ?
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
okey thanks you, im already using this event, so i just have to look for solution with cache or smtg
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.
thanks you so much 🙏