Solved Help! Bug I cant squash!!

Discussion in 'Plugin Help/Development/Requests' started by Fluf3, Apr 29, 2015.

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

    Fluf3

    Hi I get this error!
    Code:
    [07:34:11 ERROR]: Could not load 'plugins/JoinSignsAPI.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.ExceptionInInitializerError
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:341) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:263) [craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:369) [craftbukkit.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.DedicatedServer.init(DedicatedServer.java:152) [craftbukkit.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:458) [craftbukkit.jar:git-Spigot-1649]
        at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Spigot-1649]
    Caused by: java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_25]
        at java.lang.Class.forName(Class.java:344) ~[?:1.8.0_25]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1649]
        ... 6 more
    Caused by: java.lang.IllegalArgumentException: Name cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.craftbukkit.v1_7_R4.CraftServer.getWorld(CraftServer.java:1119) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.Bukkit.getWorld(Bukkit.java:271) ~[craftbukkit.jar:git-Spigot-1649]
        at fluf3JoinSignsAPI.Signs.<clinit>(Signs.java:163) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:1.8.0_25]
        at java.lang.Class.forName(Class.java:344) ~[?:1.8.0_25]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[craftbukkit.jar:git-Spigot-1649]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Spigot-1649]
        ... 6 more
    
    This is my main class
    Code:
    package fluf3JoinSignsAPI;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.block.Sign;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.Location;
    
    
    public class Signs extends JavaPlugin implements Listener{
        @Override
        public void onEnable(){
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
            getLogger().info("-- Enabled");
        }
        public String s1;
        public String s2;
        public String s3;
        public String s4;
        public String s5;
        public String s6;
        public String s7;
        public String s8;
        public String s9;
        public String s10;
        public String s11;
        public String s12;
        public String s13;
        public String s14;
        public String s15;
        public String s16;
        public String s17;
        public String s18;
        public String s19;
        public String s20;
        public String s1n;
        public String s2n;
        public String s3n;
        public String s4n;
        public String s5n;
        public String s6n;
        public String s7n;
        public String s8n;
        public String s9n;
        public String s10n;
        public String s11n;
        public String s12n;
        public String s13n;
        public String s14n;
        public String s15n;
        public String s16n;
        public String s17n;
        public String s18n;
        public String s19n;
        public String s20n;
        public String s1s;
        public String s2s;
        public String s3s;
        public String s4s;
        public String s5s;
        public String s6s;
        public String s7s;
        public String s8s;
        public String s9s;
        public String s10s;
        public String s11s;
        public String s12s;
        public String s13s;
        public String s14s;
        public String s15s;
        public String s16s;
        public String s17s;
        public String s18s;
        public String s19s;
        public String s20s;
        public static int s1x;
        public static int s1y;
        public static int s1z;
        public static int s2x;
        public static int s2y;
        public static int s2z;
        public static int s3x;
        public static int s3y;
        public static int s3z;
        public static int s4x;
        public static int s4y;
        public static int s4z;
        public static int s5x;
        public static int s5y;
        public static int s5z;
        public static int s6x;
        public static int s6y;
        public static int s6z;
        public static int s7x;
        public static int s7y;
        public static int s7z;
        public static int s8x;
        public static int s8y;
        public static int s8z;
        public static int s9x;
        public static int s9y;
        public static int s9z;
        public static int s10x;
        public static int s10y;
        public static int s10z;
        public static int s11x;
        public static int s11y;
        public static int s11z;
        public static int s12x;
        public static int s12y;
        public static int s12z;
        public static int s13x;
        public static int s13y;
        public static int s13z;
        public static int s14x;
        public static int s14y;
        public static int s14z;
        public static int s15x;
        public static int s15y;
        public static int s15z;
        public static int s16x;
        public static int s16y;
        public static int s16z;
        public static int s17x;
        public static int s17y;
        public static int s17z;
        public static int s18x;
        public static int s18y;
        public static int s18z;
        public static int s19x;
        public static int s19y;
        public static int s19z;
        public static int s20x;
        public static int s20y;
        public static int s20z;
        public static String s1w;
        public static String s2w;
        public static String s3w;
        public static String s4w;
        public static String s5w;
        public static String s6w;
        public static String s7w;
        public static String s8w;
        public static String s9w;
        public static String s10w;
        public static String s11w;
        public static String s12w;
        public static String s13w;
        public static String s14w;
        public static String s15w;
        public static String s16w;
        public static String s17w;
        public static String s18w;
        public static String s19w;
        public static String s20w;
        private static Location s1l = new Location(
                Bukkit.getWorld(s1w), s1x, s1y, s1z);
        private static Location s2l = new Location(
                Bukkit.getWorld(s2w), s1x, s1y, s1z);
        private static Location s3l = new Location(
                Bukkit.getWorld(s3w), s1x, s1y, s1z);
        private static Location s4l = new Location(
                Bukkit.getWorld(s4w), s1x, s1y, s1z);
        private static Location s5l = new Location(
                Bukkit.getWorld(s5w), s1x, s1y, s1z);
        private static Location s6l = new Location(
                Bukkit.getWorld(s6w), s1x, s1y, s1z);
        private static Location s7l = new Location(
                Bukkit.getWorld(s7w), s1x, s1y, s1z);
        private static Location s8l = new Location(
                Bukkit.getWorld(s8w), s1x, s1y, s1z);
        private static Location s9l = new Location(
                Bukkit.getWorld(s9w), s1x, s1y, s1z);
        private static Location s10l = new Location(
                Bukkit.getWorld(s10w), s1x, s1y, s1z);
        private static Location s11l = new Location(
                Bukkit.getWorld(s11w), s1x, s1y, s1z);
        private static Location s12l = new Location(
                Bukkit.getWorld(s12w), s1x, s1y, s1z);
        private static Location s13l = new Location(
                Bukkit.getWorld(s13w), s1x, s1y, s1z);
        private static Location s14l = new Location(
                Bukkit.getWorld(s14w), s1x, s1y, s1z);
        private static Location s15l = new Location(
                Bukkit.getWorld(s15w), s1x, s1y, s1z);
        private static Location s16l = new Location(
                Bukkit.getWorld(s16w), s1x, s1y, s1z);
        private static Location s17l = new Location(
                Bukkit.getWorld(s17w), s1x, s1y, s1z);
        private static Location s18l = new Location(
                Bukkit.getWorld(s18w), s1x, s1y, s1z);
        private static Location s19l = new Location(
                Bukkit.getWorld(s19w), s1x, s1y, s1z);
        private static Location s20l = new Location(
                Bukkit.getWorld(s20w), s1x, s1y, s1z);
       
        @EventHandler
        public void onPlayerClick(PlayerInteractEvent e){
            Sign s = (Sign)e.getClickedBlock();
            if(s.getLine(0).equalsIgnoreCase(s1)){
            if(s.getLine(1).equalsIgnoreCase(s1n)){
            if(s.getLine(2).equalsIgnoreCase(s1s)){
                Player player = e.getPlayer();
                player.teleport(s1l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s2)){
            if(s.getLine(1).equalsIgnoreCase(s2n)){
            if(s.getLine(2).equalsIgnoreCase(s2s)){
                Player player = e.getPlayer();
                player.teleport(s2l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s3)){
            if(s.getLine(1).equalsIgnoreCase(s3n)){
            if(s.getLine(2).equalsIgnoreCase(s3s)){
                Player player = e.getPlayer();
                player.teleport(s3l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s5)){
            if(s.getLine(1).equalsIgnoreCase(s5n)){
            if(s.getLine(2).equalsIgnoreCase(s5s)){
                Player player = e.getPlayer();
                player.teleport(s5l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s4)){
            if(s.getLine(1).equalsIgnoreCase(s4n)){
            if(s.getLine(2).equalsIgnoreCase(s4s)){
                Player player = e.getPlayer();
                player.teleport(s4l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s6)){
            if(s.getLine(1).equalsIgnoreCase(s6n)){
            if(s.getLine(2).equalsIgnoreCase(s6s)){
                Player player = e.getPlayer();
                player.teleport(s6l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s7)){
            if(s.getLine(1).equalsIgnoreCase(s7n)){
            if(s.getLine(2).equalsIgnoreCase(s7s)){
                Player player = e.getPlayer();
                player.teleport(s7l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s8)){
            if(s.getLine(1).equalsIgnoreCase(s8n)){
            if(s.getLine(2).equalsIgnoreCase(s8s)){
                Player player = e.getPlayer();
                player.teleport(s8l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s9)){
            if(s.getLine(1).equalsIgnoreCase(s9n)){
            if(s.getLine(2).equalsIgnoreCase(s9s)){
                Player player = e.getPlayer();
                player.teleport(s9l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s10)){
            if(s.getLine(1).equalsIgnoreCase(s10n)){
            if(s.getLine(2).equalsIgnoreCase(s10s)){
                Player player = e.getPlayer();
                player.teleport(s10l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s11)){
            if(s.getLine(1).equalsIgnoreCase(s11n)){
            if(s.getLine(2).equalsIgnoreCase(s11s)){
                Player player = e.getPlayer();
                player.teleport(s11l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s12)){
            if(s.getLine(1).equalsIgnoreCase(s12n)){
            if(s.getLine(2).equalsIgnoreCase(s12s)){
                Player player = e.getPlayer();
                player.teleport(s12l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s13)){
            if(s.getLine(1).equalsIgnoreCase(s13n)){
            if(s.getLine(2).equalsIgnoreCase(s13s)){
                Player player = e.getPlayer();
                player.teleport(s13l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s14)){
            if(s.getLine(1).equalsIgnoreCase(s14n)){
            if(s.getLine(2).equalsIgnoreCase(s1s)){
                Player player = e.getPlayer();
                player.teleport(s14l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s15)){
            if(s.getLine(1).equalsIgnoreCase(s15n)){
            if(s.getLine(2).equalsIgnoreCase(s15s)){
                Player player = e.getPlayer();
                player.teleport(s15l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s16)){
            if(s.getLine(1).equalsIgnoreCase(s16n)){
            if(s.getLine(2).equalsIgnoreCase(s16s)){
                Player player = e.getPlayer();
                player.teleport(s16l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s17)){
            if(s.getLine(1).equalsIgnoreCase(s17n)){
            if(s.getLine(2).equalsIgnoreCase(s17s)){
                Player player = e.getPlayer();
                player.teleport(s17l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s18)){
            if(s.getLine(1).equalsIgnoreCase(s18n)){
            if(s.getLine(2).equalsIgnoreCase(s18s)){
                Player player = e.getPlayer();
                player.teleport(s18l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s19)){
            if(s.getLine(1).equalsIgnoreCase(s19n)){
            if(s.getLine(2).equalsIgnoreCase(s19s)){
                Player player = e.getPlayer();
                player.teleport(s19l);
            }
           
            }
        }else             if(s.getLine(0).equalsIgnoreCase(s20)){
            if(s.getLine(1).equalsIgnoreCase(s20n)){
            if(s.getLine(2).equalsIgnoreCase(s20s)){
                Player player = e.getPlayer();
                player.teleport(s20l);
            }
           
            }
        }else {
            return;
        }
               
        }
        public boolean onCommand(CommandSender sender, Command cmd, String label, String args){
            Player player = (Player) sender;
            if(label.equalsIgnoreCase("JoinSignsAPI")){
                sender.sendMessage("JoinSignsAPI is working " + ChatColor.GREEN + "FINE!");
                return true;
            }
            return false;
        }
    
    }
    
    Thanks! BTW its a API as well as a plugin!
     
  2. Offline

    mine-care

    Err you are kidding me aren't you...why are there >200 lines of variables?
    Take a look here:
    https://docs.oracle.com/javase/7/docs/api/java/util/List.html
    https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html

    Also take a look in objects and getters n setters, casting, static.
    After that your code will shrink to about 20-30 lines or less. Please post updated code so it is Easter for us to read it and point out issues.
     
    Last edited: Apr 29, 2015
  3. Offline

    megamichiel

    That is indeed not a very good looking class, but anyways, the error you are getting is because you didn't specify the name of the plugin in plugin.yml.
     
  4. Offline

    mine-care

    @megamichiel btw i dont think that jvm will be able to handle all those variables...
     
    Last edited: Apr 30, 2015
  5. Offline

    mythbusterma

    What?
     
  6. Offline

    mine-care

    @mythbusterma Woopsy :3 wrong thread :O i should take some rest i think... 0_0 It was intended for a conversation :/
    Thanks for pointing this out.
     
  7. Offline

    Fluf3

    @megamichiel
    Plugin.yml
    Code:
    name: JoinSignsAPI
    main: fluf3JoinSignsAPI.Signs
    author: fluf3
    version: 1.0
    commands:
      joinsignsapi:
        usage: /joinsignsapi
    BTW
    Its a API. All those variables are how the user defines stuff. Not clean ik.
     
  8. Offline

    mine-care

    @Fluf3 Ehh the fact that it is an api does not mean you need 200 lines of variables, check the links provided above (Lists, loops, Objects) and a few more like Casting, and acess modifiers.
     
  9. Offline

    megamichiel

    @Fluf3
    Wait woops I misread the stacktrace, the error is because you are making a location with a world that gets the world by a name, and the string it uses for the name isn't initialised, so it's null and it errors 'cause the world is then not found.
     
    Fluf3 likes this.
  10. Offline

    dlange

  11. Offline

    Fluf3

    Bump.
     
  12. Offline

    mine-care

    @Fluf3
    i think his solves your thread.
     
  13. Offline

    Fluf3

Thread Status:
Not open for further replies.

Share This Page