Solved error

Discussion in 'Spigot Plugin Development' started by M7MDMCGamer, Apr 26, 2017.

  1. i get this error when my plugin enabled

    [15:09:33 ERROR]: Error occurred while enabling M7MDCraft v1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: Plugin already initialized!
    at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:122) ~[spigot.
    jar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:67) ~[spigot.jar:git-Spigot-d276
    ab1-1f6c04c]
    at gd.rf.m7md.m7mdcraft.fly.Fly.<init>(Fly.java:10) ~[?:?]
    at gd.rf.m7md.m7mdcraft.M7MDCraft.onEnable(M7MDCraft.java:14) ~[?:?]
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:271) ~[spigot.jar:git-Spigot
    -d276ab1-1f6c04c]
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [spigot.j
    ar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.
    jar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugin(CraftServer.java:376) [spigot.ja
    r:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugins(CraftServer.java:326) [spigot.j
    ar:git-Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.MinecraftServer.t(MinecraftServer.java:421) [spigot.jar:git
    -Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.MinecraftServer.l(MinecraftServer.java:382) [spigot.jar:git
    -Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.MinecraftServer.a(MinecraftServer.java:337) [spigot.jar:git
    -Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.DedicatedServer.init(DedicatedServer.java:272) [spigot.jar:
    git-Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:544) [spigot.jar:g
    it-Spigot-d276ab1-1f6c04c]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
    Caused by: java.lang.IllegalStateException: Initial initialization
    at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:125) ~[spigot.
    jar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:67) ~[spigot.jar:git-Spigot-d276
    ab1-1f6c04c]
    at gd.rf.m7md.m7mdcraft.M7MDCraft.<init>(M7MDCraft.java:11) ~[?:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_121]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
    62) ~[?:1.8.0_121]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorIm
    pl.java:45) ~[?:1.8.0_121]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_121]
    at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_121]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot.jar:g
    it-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[spigot.ja
    r:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.j
    ar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[spigot.
    jar:git-Spigot-d276ab1-1f6c04c]
    at org.bukkit.craftbukkit.v1_11_R1.CraftServer.loadPlugins(CraftServer.java:301) ~[spigot.ja
    r:git-Spigot-d276ab1-1f6c04c]
    at net.minecraft.server.v1_11_R1.DedicatedServer.init(DedicatedServer.java:204) ~[spigot.jar
    :git-Spigot-d276ab1-1f6c04c]
    ... 2 more
     
  2. Do you have two copies of the plugin in the server's folder or something?
     
  3. Maybe you have multiple jar files of your plugin in the plugins directory
     
  4. If you don't have two copies of the same plugin, you have two plugins with the same base packages path (The packages your main class use)
     
  5. no this is the only plugin in my plugins folder
     
  6. Is there more than one class extending JavaPlugin?
     
  7. thank you it worked <3
     
  8. Just a note for the OP, sometimes if you have multiple plugins which all have a class extending JavaPlugin simply called "main", or having a similar class in two separate plugins with the same name, it can throw the same exception.
     
    #8 FergyEsHere, Apr 26, 2017
    Last edited: Apr 26, 2017
  9. For anyone else reading this who may have a similar error, also make sure that you're not accessing a command or listener more than once in your onEnable method (also happens when you do something like 1 when 2 works.

    1:
    Code (Text):
    getCommand("test").setExecutor(new mainClass());
    2:
    Code (Text):
    getCommand("test").setExecutor(this);