Solved Sudden noClassDefFound?

Discussion in 'Spigot Plugin Development' started by Wilsoon, Mar 11, 2020.

Thread Status:
Not open for further replies.
  1. I have one plugin which is named JavaMod that has about 26 command classes and like 12 event classes.
    I exported all the classes into a jar file and everytime the server starts, at random, some of the commands inside would just return me this error, it makes me wonder if it's actually a good idea to pack my entire code into one. The classes missing are always at random, sometimes command 1 could be there but command 2 is gone, and sometimes it's the other way round.
    Code (Text):

    org.bukkit.command.CommandException: Unhandled exception executing command 'doomworld' in plugin JavaMod v6.0
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_241]
            at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_241]
            at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
    Caused by: java.lang.NoClassDefFoundError: commands/DoomWorldSeverity
            at commands.DoomWorldCommand.onCommand(DoomWorldCommand.java:253) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[spigot.jar:git-Spigot-db6de12-18fbb24]
            ... 15 more
     
  2. drives_a_ford

    Moderator

    Have you checked the jar to make sure the class is actually there or not?

    How are you building your jar? Are you using a build automation tool such as maven or gradle?
     
  3. Are you running your server in a debugger?
     
  4. The class is existent, it's worked multiple times before, just suddenly when I add new commands and classes, It just disappears. Same with other commands.

    I'm using Maven.

    I don't get what you mean but I'm quite sure it's a no. Just a Spigot 1.8.8 server. Startup flags:
    -Xmx4050M
    -Xms128M
    That's all. And if you mean whether I debugged my code, yes, multiple times.


    EDIT: It seemed to have happened with another command, but instead of NoClassDefFound, I got a ClassNotFoundException instead. Weird...
     
    #4 Wilsoon, Mar 11, 2020
    Last edited: Mar 11, 2020
  5. Did You shade it? using maven?
     
    • Like Like x 1
  6. This happened to me once, I fixed it by renaming the class that was missing in the IDE
     
  7. I don't get what you mean by shading? Never did it before.


    Hmm okay I'll try this when I'm home.
     
  8. Are you reloading the server frequently, especially when you are inserting a new version of your plugin?
    This happened to me a couple of times and the solution was to just restart the server completely (since reload is not supported anyway)
     
  9. You said you are using maven right? If so send me your pom.xml
     
    • Like Like x 1
  10. My pom.xml is basically empty.
    I didn't bother to add any dependencies etc. because I would add the spigot JAR and everything else manually.
    So basically my pom.xml is the basic default.
    If you still wish to view, here it is:
    Code (XML):

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.gmail.calorious</groupId>
      <artifactId>JavaMod</artifactId>
      <version>0.0.1-SNAPSHOT</version>
    </project>
     
    @Schottky I always restarted the server while adding the new version.
     
  11. How are your command classes being registered?
     
  12. This is the command class registration inside my onEnable() method. They are all imported into this class for registration as such:
    Code (Java):

    getCommand("op").setExecutor(new OpCommand());
            getCommand("javamod").setExecutor(new BaseCommand());
            getCommand("opall").setExecutor(new OpAllCommand());
            getCommand("deopall").setExecutor(new DeOpAllCommand());
            getCommand("setgamemode").setExecutor(new SetGamemodeCommand());
            getCommand("freeze").setExecutor(new FreezeCommand());
            getCommand("unfreeze").setExecutor(new UnfreezeCommand());
            getCommand("kick").setExecutor(new KickCommand());
            getCommand("switch").setExecutor(new SwitchCommand());
            getCommand("disableflight").setExecutor(new DisableFlightCommand());
            getCommand("nightvision").setExecutor(new NVCommand());
            getCommand("wither").setExecutor(new WitherCommand());
            getCommand("breakexplode").setExecutor(new BlockBreakExplodeCommand());
            getCommand("placeexplode").setExecutor(new BlockPlaceExplodeCommand());
            getCommand("cage").setExecutor(new CageCommand());
            getCommand("invreplicate").setExecutor(new InventoryReplicationCommand());
            getCommand("oreonly").setExecutor(new OreOnlyCommand());
            getCommand("uncage").setExecutor(new UncageCommand());
            getCommand("drown").setExecutor(new DrownCommand());
            getCommand("build").setExecutor(new BuildCommand());
            getCommand("god").setExecutor(new GodCommand());
            getCommand("blockcmd").setExecutor(new BlockCommandsCommand());
            getCommand("doomworld").setExecutor(new DoomWorldCommand());
            getCommand("stop").setExecutor(new StopCommand());
            getCommand("restart").setExecutor(new RestartCommand());
            getCommand("nohitdelay").setExecutor(new NoHitDelayCommand());
            getCommand("cast").setExecutor(new CastCommand());
     
    Then, my plugin.yml is:
    Code (YAML):

    main
    : com.gmail.calorious.JavaMod
    name
    : JavaMod
    version
    : 6.0
    description
    : Meant for Private Server, features many commands.
    author
    : Wilsoon
    softdepend
    : [AdvancedBan]
    commands
    :
       javamod
    :
         description
    : Base command for JavaMod.
         usage
    : /<command>
       
       opall
    :
         description
    : OP all players on the server.
         usage
    : /<command>
       
       op
    :
         description
    : OP a player.
         usage
    : /<command> [player]
         
       deopall
    :
         description
    : De-OP all players on the server.
         usage
    : /<command>
       
       setgamemode
    :
         description
    : Set all players' gamemodes.
         usage
    : /<command> [-c] [-s] [-a] [-sp]
         
       freeze
    :
         description
    : Freeze a player
         usage
    : /<command> [player]
       unfreeze
    :
         description
    : Unfreeze a player
         usage
    : /<command> [frozen player]
         
       togglebuild
    :
         description
    : Toggle the build mode for one's self.
         usage
    : /<command>
     
       togglebreak
    :
         description
    : Toggle the block breaking for one's self.
         usage
    : /<command>
       
       initialize
    :
         description
    : Initialize the plugin's variables and add players.
         usage
    : /<command>
       kick
    :
         description
    : Kicks a player from the server.
         usage
    : /<command> (Player)
       switch
    :
         description
    : Switches a player's position with another.
         usage
    : /<command> (Player 1) (Player 2)
       build
    :
         description
    : Build Mode
         usage
    : /<command>
       disableflight
    :
         description
    : Disable flight server-wide
         usage
    : /<command>
       nightvision
    :
         description
    : Give night vision to someone
         usage
    : /<command>
         aliases
    : [nv]
       wither
    :
         description
    : Wither a player
         usage
    : /<command>
       drown
    :
         description
    : Drown a player
         usage
    : /<command>
       breakexplode
    :
         description
    : BreakExplode function
         usage
    : /<command> [arguments]
       placeexplode
    :
         description
    : PlaceExplode function
         usage
    : /<command> [arguments]
       cage
    :
         description
    : Cage a player
         usage
    : /<command>
       uncage
    :
         description
    : Uncage a player
         usage
    : /<command>
       invreplicate
    :
         description
    : Replicate your inventory and give it to the player indicated.
         usage
    : /<command> (Player)
       god
    :
         description
    : Enable god mode
         usage
    : /<command> [Player]
       oreonly
    :
         description
    : Makes a player only able to mine ores.
         usage
    : /<command> (Player)
       doomworld
    :
         description
    : Doom the world you are currently in.
         usage
    : /<command>
       blockcmd
    :
         description
    : Block/unblock a command.
         usage
    : /<command> (Command/Argument)
       stop
    :
         description
    : Stop the server with a reason.
         usage
    : /<command> [Reason]
       restart
    :
         description
    : Restart the server with a reason.
         usage
    : /<command> [Reason]
       nohitdelay
    :
         description
    : NoHitDelay
         usage
    : /<command> [arguments]
       cast
    :
         description
    : Cast a spell
         usage
    : /<command> [argument]
     
     
  13. Are you reloading while compiling? I’ve had this issue while being to hasty with my reloads.
     
  14. Can you show DoomWorldCommand code?
     
  15. What do you mean? During compiling I just save the entire project then export it into a JAR file directly into my server folder.

    I'll give it to you later.
     
  16. DoomWorldCommand:
    Code (Java):
     package commands;
    public class DoomWorldCommand implements CommandExecutor {
        Location ploc = null;
        private String doomseverity = "";
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args ) {
            if(cmd.getName().equalsIgnoreCase("doomworld")) {
                if(args.length == 0) {
                    sender.sendMessage(ChatColor.RED + "You are required to state a severity level when dooming. Available choices are LOWEST/LOW/MEDIUM/FATAL.");
                    return true;
                }
                if(args.length > 0) {
                    if(args[0].equalsIgnoreCase("fatal")) {
                        if(sender instanceof Player) {
                            DoomWorldSeverity severity = DoomWorldSeverity.FATAL;
                            switch(severity) {
                            case FATAL:
                                doomseverity = ChatColor.DARK_RED + "FATAL";
                                break;
                            case LOW:
                                doomseverity = ChatColor.GREEN + "LOW";
                                break;
                            case MEDIUM:
                                doomseverity = ChatColor.GOLD + "MEDIUM";
                                break;
                            case LOWEST:
                                doomseverity = ChatColor.GREEN + "" + ChatColor.BOLD + "LOWEST";
                                break;
                            case NONE:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            }
                            sender.sendMessage(ChatColor.GREEN + "Attempting to doom world: " + ChatColor.GOLD + ((Player) sender).getWorld().getName() + ". Severity Level: " + doomseverity);
                            for(Player p : Bukkit.getOnlinePlayers()) {
                                if(p.hasPermission("javamod.notify")) {
                                    p.sendMessage(ChatColor.RED + "[!] Notice: " + ChatColor.GOLD + "Player " + sender.getName() + " is attempting to doom the world: " + ((Player) sender).getWorld().getName() + " with a level of " + doomseverity);
                                }
                            }
                            if(sender.hasPermission("javamod.admin")) {
                                final Player p = (Player) sender;
                                sender.sendMessage(ChatColor.GOLD + "Permission granted with the permission node found: javamod.admin... Continuing with dooming world.");
                                p.getWorld().setGameRuleValue("mobGriefing", "false");
                                Bukkit.getLogger().info("MobGriefing has been disabled in " + p.getWorld().getName() + " for world doom by " + p.getName());
                                sender.sendMessage(ChatColor.GREEN + "Ready to obliterate world.");
                                Bukkit.getLogger().info(ChatColor.GREEN + "Ready to obliterate world.");
                                final Location ploc = p.getLocation();
                                p.getWorld().strikeLightningEffect(ploc);
                                for(int i = 0; i < 20; i++) {
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                }
                                for (int x = -10; x <= 40; x += 5) {
                                    for (int z = -10; z <= 40; z += 5) {
                                      Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                      for(int i = 0; i < 1; i++) {
                                         p.getWorld().spawn(tntloc, TNTPrimed.class);
                                    }
                                  }
                                }
                                p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Do NOT return to the main spawn. Your location is currently being used for obliteration of world: " + p.getWorld().getName());
                                Bukkit.getScheduler().scheduleSyncDelayedTask(JavaMod.getInstance(), new Runnable() {
                                    public void run() {
                                        for (int x = -40; x <= 50; x += 5) {
                                            for (int z = -40; z <= 50; z += 5) {
                                              Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                              for(int i = 0; i < 1; i++) {
                                                 p.getWorld().spawn(tntloc, TNTPrimed.class);
                                            }
                                          }
                                        }
                                    }
                                }, 40L);
                                Bukkit.getScheduler().scheduleSyncDelayedTask(JavaMod.getInstance(), new Runnable() {
                                    public void run() {
                                        for (int x = -60; x <= 60; x += 5) {
                                            for (int z = -60; z <= 60; z += 5) {
                                              Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                              for(int i = 0; i < 1; i++) {
                                                 p.getWorld().spawn(tntloc, TNTPrimed.class);
                                            }
                                          }
                                        }
                                    }
                                }, 50L);
                                Bukkit.getScheduler().scheduleSyncDelayedTask(JavaMod.getInstance(), new Runnable() {
                                    public void run() {
                                        for (int x = -40; x <= 50; x += 5) {
                                            for (int z = -40; z <= 50; z += 5) {
                                              Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                              for(int i = 0; i < 1; i++) {
                                                 p.getWorld().spawn(tntloc, TNTPrimed.class);
                                            }
                                          }
                                        }
                                        p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "You may now return to the main spawn. Your location is no longer used.");
                                    }
                                }, 50L);
                                Bukkit.getLogger().info(ChatColor.GOLD + "World " + ploc.getWorld().getName() + " obliterated.");
                                return true;
                            }
                            } else {
                                    sender.sendMessage(ChatColor.RED + "Only players can use /" + label + ".");
                                    return true;
                            }
                        }
                    if(args[0].equalsIgnoreCase("medium")) {
                        if(sender instanceof Player) {
                            DoomWorldSeverity severity = DoomWorldSeverity.MEDIUM;
                            switch(severity) {
                            case FATAL:
                                doomseverity = ChatColor.DARK_RED + "FATAL";
                                break;
                            case LOW:
                                doomseverity = ChatColor.GREEN + "LOW";
                                break;
                            case MEDIUM:
                                doomseverity = ChatColor.GOLD + "MEDIUM";
                                break;
                            case NONE:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            case LOWEST:
                                doomseverity = ChatColor.GREEN + "" + ChatColor.BOLD + "LOWEST";
                                break;
                            default:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            }
                            sender.sendMessage(ChatColor.GREEN + "Attempting to doom world: " + ChatColor.GOLD + ((Player) sender).getWorld().getName() + ". Severity Level: " + doomseverity);
                            for(Player p : Bukkit.getOnlinePlayers()) {
                                if(p.hasPermission("javamod.notify")) {
                                    p.sendMessage(ChatColor.RED + "[!] Notice: " + ChatColor.GOLD + "Player " + sender.getName() + " is attempting to doom the world: " + ((Player) sender).getWorld().getName() + " with a level of " + doomseverity);
                                }
                            }
                            if(sender.hasPermission("javamod.admin")) {
                                final Player p = (Player) sender;
                                sender.sendMessage(ChatColor.GOLD + "Permission granted with the permission node found: javamod.admin... Continuing with dooming world.");
                                p.getWorld().setGameRuleValue("mobGriefing", "false");
                                Bukkit.getLogger().info("MobGriefing has been disabled in " + p.getWorld().getName() + " for world doom by " + p.getName());
                                sender.sendMessage(ChatColor.GREEN + "Ready to obliterate world.");
                                Bukkit.getLogger().info(ChatColor.GREEN + "Ready to obliterate world.");
                                Location ploc = p.getLocation();
                                p.getWorld().strikeLightningEffect(ploc);
                                for(int i = 0; i < 20; i++) {
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                }
                                for (int x = -10; x <= 40; x += 5) {
                                    for (int z = -10; z <= 40; z += 5) {
                                      Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                      for(int i = 0; i < 1; i++) {
                                         p.getWorld().spawn(tntloc, TNTPrimed.class);
                                    }
                                  }
                                }
                                p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Do NOT return to the main spawn. Your location is currently being used for obliteration of world: " + p.getWorld().getName());
                                Bukkit.getScheduler().scheduleSyncDelayedTask(JavaMod.getInstance(), new Runnable() {
                                    public void run() {
                                        for (int x = -20; x <= 40; x += 5) {
                                            for (int z = -20; z <= 40; z += 5) {
                                              Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                              for(int i = 0; i < 1; i++) {
                                                 p.getWorld().spawn(tntloc, TNTPrimed.class);
                                            }
                                          }
                                        }
                                    }
                                }, 40L);
                                p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "You may now return to the main spawn. Your location is no longer being used.");
                                    }
                            }
                }
                    if(args[0].equalsIgnoreCase("low")) {
                        if(sender instanceof Player) {
                            DoomWorldSeverity severity = DoomWorldSeverity.LOW;
                            switch(severity) {
                            case FATAL:
                                doomseverity = ChatColor.DARK_RED + "FATAL";
                                break;
                            case LOW:
                                doomseverity = ChatColor.GREEN + "LOW";
                                break;
                            case MEDIUM:
                                doomseverity = ChatColor.GOLD + "MEDIUM";
                                break;
                            case NONE:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            case LOWEST:
                                doomseverity = ChatColor.GREEN + "" + ChatColor.BOLD + "LOWEST";
                                break;
                            default:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            }
                            sender.sendMessage(ChatColor.GREEN + "Attempting to doom world: " + ChatColor.GOLD + ((Player) sender).getWorld().getName() + ". Severity Level: " + doomseverity);
                            for(Player p : Bukkit.getOnlinePlayers()) {
                                if(p.hasPermission("javamod.notify")) {
                                    p.sendMessage(ChatColor.RED + "[!] Notice: " + ChatColor.GOLD + "Player " + sender.getName() + " is attempting to doom the world: " + ((Player) sender).getWorld().getName() + " with a level of " + doomseverity);
                                }
                            }
                            if(sender.hasPermission("javamod.admin")) {
                                final Player p = (Player) sender;
                                sender.sendMessage(ChatColor.GOLD + "Permission granted with the permission node found: javamod.admin... Continuing with dooming world.");
                                p.getWorld().setGameRuleValue("mobGriefing", "false");
                                Bukkit.getLogger().info("MobGriefing has been disabled in " + p.getWorld().getName() + " for world doom by " + p.getName());
                                sender.sendMessage(ChatColor.GREEN + "Ready to obliterate world.");
                                Bukkit.getLogger().info(ChatColor.GREEN + "Ready to obliterate world.");
                                Location ploc = p.getLocation();
                                p.getWorld().strikeLightningEffect(ploc);
                                for(int i = 0; i < 20; i++) {
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                }
                                for (int x = -10; x <= 40; x += 5) {
                                    for (int z = -10; z <= 40; z += 5) {
                                      Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                      for(int i = 0; i < 1; i++) {
                                         p.getWorld().spawn(tntloc, TNTPrimed.class);
                                    }
                                  }
                                }
                            }
                        }
                    }
                    if(args[0].equalsIgnoreCase("lowest")) {
                        if(sender instanceof Player) {
                            DoomWorldSeverity severity = DoomWorldSeverity.LOWEST;
                            switch(severity) {
                            case FATAL:
                                doomseverity = ChatColor.DARK_RED + "FATAL";
                                break;
                            case LOW:
                                doomseverity = ChatColor.GREEN + "LOW";
                                break;
                            case MEDIUM:
                                doomseverity = ChatColor.GOLD + "MEDIUM";
                                break;
                            case NONE:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            case LOWEST:
                                doomseverity = ChatColor.GREEN + "" + ChatColor.BOLD + "LOWEST";
                                break;
                            default:
                                doomseverity = ChatColor.WHITE + "NONE";
                                break;
                            }
                            sender.sendMessage(ChatColor.GREEN + "Attempting to doom world: " + ChatColor.GOLD + ((Player) sender).getWorld().getName() + ". Severity Level: " + doomseverity);
                            for(Player p : Bukkit.getOnlinePlayers()) {
                                if(p.hasPermission("javamod.notify")) {
                                    p.sendMessage(ChatColor.RED + "[!] Notice: " + ChatColor.GOLD + "Player " + sender.getName() + " is attempting to doom the world: " + ((Player) sender).getWorld().getName() + " with a level of " + doomseverity);
                                }
                            }
                            if(sender.hasPermission("javamod.admin")) {
                                final Player p = (Player) sender;
                                sender.sendMessage(ChatColor.GOLD + "Permission granted with the permission node found: javamod.admin... Continuing with dooming world.");
                                p.getWorld().setGameRuleValue("mobGriefing", "false");
                                Bukkit.getLogger().info("MobGriefing has been disabled in " + p.getWorld().getName() + " for world doom by " + p.getName());
                                sender.sendMessage(ChatColor.GREEN + "Ready to obliterate world.");
                                Bukkit.getLogger().info(ChatColor.GREEN + "Ready to obliterate world.");
                                Location ploc = p.getLocation();
                                p.getWorld().strikeLightningEffect(ploc);
                                for(int i = 0; i < 20; i++) {
                                    p.getWorld().playEffect(ploc, Effect.ENDER_SIGNAL, 100, 200);
                                    p.getWorld().playEffect(ploc, Effect.PARTICLE_SMOKE, 100, 200);
                                }
                                for (int x = -5; x <= 20; x += 5) {
                                    for (int z = -5; z <= 20; z += 5) {
                                      Location tntloc = new Location(p.getWorld(), (ploc.getBlockX() + x), (p.getWorld().getHighestBlockYAt(ploc) + 64), (ploc.getBlockZ() + z));
                                      for(int i = 0; i < 1; i++) {
                                         p.getWorld().spawn(tntloc, TNTPrimed.class);
                                    }
                                  }
                                }
                            }
                        }
                    }
                }
            }
            return true;
        }
    }
     
  17. DoomWorldSeverity:
    Code (Java):

    package commands;

    enum DoomWorldSeverity {
        NONE,
        LOW,
        MEDIUM,
        FATAL,
        LOWEST
    }
    (another classical mistake of showing code)

    DoomWorldCommand was made with the for statements from Commandnuke inside Essentials /nuke command. I just changed the values.

    (Removed imports from DoomWorldCommand - Had to keep within 200,000 characters.)
     
  18. Hmh... Try to surround command registration with try-catch. Don't ignore exception - print it.
     
  19. Wouldn't the error pop itself up during registration if there's an issue?
     
  20. Sometimes it's ignored, not sure why.
     
Thread Status:
Not open for further replies.