Solved ERROR with NBT Codes (NBTBase?)

Discussion in 'Plugin Development' started by mine2012craft, Nov 27, 2016.

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

    mine2012craft

    Hello Fellow Coders,

    So I have been working on my plugin for a long time (4 months is probably not a long time) and now all of a sudden, this error pops up:

    Code:
    [12:11:49] [Server thread/INFO]: [MyPlugin] Enabling HiddenPluginNameLol v1.1
    [12:11:49] [Server thread/INFO]: [MyPlugin] >>A config.yml has been detected! Loading config.yml...<<
    [12:11:49] [Server thread/ERROR]: Error occurred while enabling HiddenPluginNameLol v1.1 (Is it up to date?)
    java.lang.NoClassDefFoundError: net/minecraft/server/v1_11_R1/NBTBase
        at testPackage.Core.onEnable(Core.java:122) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:292) ~[spigot.jar:git-Spigot-c3e4052-1953f52]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.loadPlugin(CraftServer.java:362) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at org.bukkit.craftbukkit.v1_10_R1.CraftServer.enablePlugins(CraftServer.java:322) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at net.minecraft.server.v1_10_R1.MinecraftServer.t(MinecraftServer.java:416) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at net.minecraft.server.v1_10_R1.MinecraftServer.l(MinecraftServer.java:381) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at net.minecraft.server.v1_10_R1.MinecraftServer.a(MinecraftServer.java:336) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at net.minecraft.server.v1_10_R1.DedicatedServer.init(DedicatedServer.java:270) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at net.minecraft.server.v1_10_R1.MinecraftServer.run(MinecraftServer.java:539) [spigot.jar:git-Spigot-c3e4052-1953f52]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_101]
    Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_11_R1.NBTBase
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:91) ~[spigot.jar:git-Spigot-c3e4052-1953f52]
        at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot.jar:git-Spigot-c3e4052-1953f52]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_101]
        at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_101]
        ... 12 more
    [12:11:49] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
    [12:11:50] [Server thread/INFO]: Done (20.464s)! For help, type "help" or "?"
    
    Now this has never happened before in the time I've worked on this. This is the first time I am seeing this error.

    After putting in some debugging lines I realized that it stops at the "4 1/4" line here:

    Code:
    public void onEnable(){       
            Bukkit.broadcastMessage("1");
            try {
                if (!getDataFolder().exists()) {
                    getDataFolder().mkdirs();
                }
                File file = new File(getDataFolder(), "config.yml");
                if (!file.exists()) {
                    getLogger().info(">>A config.yml has not been detected! Writing up a new config.yml...<<");
                    saveDefaultConfig();
                } else {
                    getLogger().info(">>A config.yml has been detected! Loading config.yml...<<");
                }
            } catch (Exception e) {
                e.printStackTrace();
    
            }
            Bukkit.broadcastMessage("2");
            message = getConfig().getString("message");
            instance = this; 
            Bukkit.broadcastMessage("3");
            //Command Executors
            Bukkit.broadcastMessage("4");
            getCommand("knight").setExecutor(new KitNormal());
            Bukkit.broadcastMessage("4 1/4"); //Here is where the last debug line is printed out
            getCommand("hunter").setExecutor(new KitArcher()); // Possible Culprit
            Bukkit.broadcastMessage("4 1/2"); //This is the line that is not played at all
            getCommand("soup").setExecutor(new ReplenishSoup());
            getCommand("menu").setExecutor(new OpenKitMenu());
            getCommand("upgrade").setExecutor(new OpenUpgradeMenu());
            getCommand("upgrades").setExecutor(new OpenUpgradeMenu());
            getCommand("spell").setExecutor(new OpenSpellMenu());
            getCommand("spells").setExecutor(new OpenSpellMenu());
            getCommand("assassin").setExecutor(new KitAssassin());
            getCommand("mage").setExecutor(new KitMage());
            getCommand("elytrawars").setExecutor(new KitElytraWars());
            Bukkit.broadcastMessage("5");
            //---------------------------------------------------------
    In the line that saids "Possible Culprit" the class that is executed does have NBT codes in it for customizing attack damage and speeed for an Axe.

    Now keep in mind that I have recently updated it to 1.11 so I had to change these lines:

    Code:
    import net.minecraft.server.v1_10_R1.NBTTagCompound;
    import net.minecraft.server.v1_10_R1.NBTTagDouble;
    import net.minecraft.server.v1_10_R1.NBTTagInt;
    import net.minecraft.server.v1_10_R1.NBTTagList;
    import net.minecraft.server.v1_10_R1.NBTTagString;
    to these:

    Code:
    import net.minecraft.server.v1_11_R1.NBTTagCompound;
    import net.minecraft.server.v1_11_R1.NBTTagDouble;
    import net.minecraft.server.v1_11_R1.NBTTagInt;
    import net.minecraft.server.v1_11_R1.NBTTagList;
    import net.minecraft.server.v1_11_R1.NBTTagString;
    Now obviously this has something to do with not having a NBTBase (Yes I even tried to add that too) but I do not know what it means.

    If anyone has any ideas on what this is causing, please respond. If you need the class that has the NBT codes I will post them without hesitation.

    Thank you,
    WarlordWeaponry
     
  2. Offline

    Zombie_Striker

    @mine2012craft
    The reason you are getting these errors are because you are not on 1.11!
    Notice how all these lines (from the error) have "1_10" written on them? These lines are saying there was an error At these sections, so these are the ones that do exist.

    To fix this problem: Use the same bukkit version as your server. If you're using a 1.10 server, make sure your plugins support 1.10. If on 1.11, do the same for 1.11
     
  3. Offline

    mine2012craft

    Wow uh... I feel stupid... I used 1.10 to load up a map to play with a friend heh... uh...

    *Slowly walks away* [Thanks :)]
     
  4. @mine2012craft Also note you can make this version independent, you can make this work on multiple versions without having to recompile every time. As long as methods stay the same your code will work.
     
Thread Status:
Not open for further replies.

Share This Page