Solved Error

Discussion in 'Plugin Help/Development/Requests' started by WPM, Jul 10, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    WPM

    I made a simple plugin to try out CommandExecutor and I keep getting this following error even when I have craftbukkit 1.8.3

    Code:
    [08:25:53 ERROR]: Error occurred while enabling Essentialsv2 v1.0 (Is it up to date?)
    java.lang.IllegalArgumentException: Plugin already initialized!
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:98) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at me.WPM.Essentialsv2.Burn.<init>(Burn.java:11) ~[?:?]
        at me.WPM.Essentialsv2.main.onEnable(main.java:8) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:327) [craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugin(CraftServer.java:341) [craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.enablePlugins(CraftServer.java:313) [craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.MinecraftServer.r(MinecraftServer.java:408) [craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.MinecraftServer.k(MinecraftServer.java:374) [craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.MinecraftServer.a(MinecraftServer.java:329) [craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.DedicatedServer.init(DedicatedServer.java:236) [craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.MinecraftServer.run(MinecraftServer.java:501) [craftbukkit.jar:git-Bukkit-0a645a2]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_31]
    Caused by: java.lang.IllegalStateException: Initial initialization
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:101) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at me.WPM.Essentialsv2.main.<init>(main.java:5) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_31]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_31]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_31]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) ~[?:1.8.0_31]
        at java.lang.Class.newInstance(Class.java:438) ~[?:1.8.0_31]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.loadPlugins(CraftServer.java:288) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at org.bukkit.craftbukkit.v1_8_R2.CraftServer.<init>(CraftServer.java:250) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.PlayerList.<init>(PlayerList.java:69) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.DedicatedPlayerList.<init>(SourceFile:14) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        at net.minecraft.server.v1_8_R2.DedicatedServer.init(DedicatedServer.java:180) ~[craftbukkit.jar:git-Bukkit-0a645a2]
        ... 2 more
    There is nothing wrong with my code. If you want it, here it is.

    Code:
    package me.WPM.Essentialsv2;
    
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class main extends JavaPlugin{
      
        public void onEnable(){
            this.getCommand("burn").setExecutor(new Burn());
        }
        public void onDisable(){
          
        }
    }
    Code:
    package me.WPM.Essentialsv2;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Burn extends JavaPlugin implements CommandExecutor {
            @Override
            public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                if(cmd.getName().equalsIgnoreCase("burn")){
                    if(args.length == 0){
                        sender.sendMessage(ChatColor.WHITE + "/burn <player> <seconds>");
                        return true;
                    }
                    if(args.length == 1){
                        sender.sendMessage(ChatColor.WHITE + "/burn <player> <seconds>");
                    }
                    Player target = Bukkit.getServer().getPlayer(args[0]);
                    if(target == null){
                        sender.sendMessage(ChatColor.DARK_RED + "That player is not online");
                        return true;
                    }
                    if(args.length == 2){
                        int seconds = Integer.parseInt(args[1])*20;
                        target.setFireTicks(seconds);
                        target.sendMessage(ChatColor.DARK_RED + sender.getName() + ChatColor.RED + " set you on fire for " + args[1] + ChatColor.RED + " second(s)!");
                    }
                }
                return false;
        }
    }
     
  2. Offline

    bwfcwalshy Retired Staff

    Moved to Bukkit Alternates.
     
  3. Offline

    WPM

    Ok thank you.
     
  4. Offline

    MrBlackIsBack

    Only your main class should extend JavaPlugin. Also, I would suggest following correct java naming conventions when naming your classes / packages.
     
  5. Offline

    WPM

    Thank you. Im retarded :(
     
Thread Status:
Not open for further replies.

Share This Page