[HELP] My NickPlugin don't work :(

Discussion in 'Spigot Plugin Development' started by Callecrafter, May 21, 2017.

  1. I have coded a Nick Plugin for Spigot 1.8

    I rightclick my Random-Nick Tool (Nametag) and then the Console error.

    And at the NickEvent is an PlayerInteractEvent error.

    My Main-Class:

    public void onEnable() {
    this.getCommand("nick").setExecutor(new NickCommand());
    Bukkit.getPluginManager().registerEvents(new NickEvent(), this);


    NickUtil.Nicks.add("Nick1");
    NickUtil.Nicks.add("Nick2");
    super.onEnable();
    }

    My NickEvent:

    @EventHandler
    public void onInteract(PlayerInteractEvent e) {
    Player p = e.getPlayer();
    Block block = e.getClickedBlock();
    if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    if(block != null) {
    if(e.getItem().equals(ItemCreator.createItem(Material.NAME_TAG, "§2Random-Nick"))) {
    if(NickUtil.nicked.contains(p)) { <==== LINE 34!!!!! where the Error is
    NickUtil.nicked.remove(p);
    p.sendMessage(Main.Prefix + ChatColor.GREEN + " Removed");
    NickUtil.unNick(p);
    } else {
    NickUtil.nicked.add(p);
    int zufall = NickUtil.rndm.nextInt(NickUtil.Nicks.size());
    String Nick = NickUtil.Nicks.get(zufall);
    p.sendMessage(Main.Prefix + ChatColor.GREEN + " New Nick: " + ChatColor.BLUE + "[" + ChatColor.RESET + Nick + ChatColor.BLUE + "]");
    NickUtil.setNick(p, Nick);
    }
    }
    }
    }
    }

    Error at the Console:

    [17:02:39] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to CreepyNick v1.0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-044d928-e8c6403]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-044d928-e8c6403]
    at org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:227) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.PlayerInteractManager.interact(PlayerInteractManager.java:463) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:736) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:52) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot.jar:git-Spigot-044d928-e8c6403]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_121]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_121]
    at net.minecraft.server.v1_8_R3.SystemUtils.a(SystemUtils.java:19) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:718) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:367) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:657) [spigot.jar:git-Spigot-044d928-e8c6403]
    at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:560) [spigot.jar:git-Spigot-044d928-e8c6403]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_121]
    Caused by: java.lang.NoClassDefFoundError: net/minecraft/server/v1_8_R1/EntityHuman
    at de.creepygames.callecrafter.main.event.NickEvent.onInteract(NickEvent.java:34) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    ... 17 more
    Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_8_R1.EntityHuman
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:91) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_121]
    at de.creepygames.callecrafter.main.event.NickEvent.onInteract(NickEvent.java:34) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_121]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_121]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot.jar:git-Spigot-044d928-e8c6403]
    ... 17 more
     
  2. You're using the wrong NMS version
     
  3. Sorry , but i dont know what NMS is can you say it me :D
     
  4. Code (Text):
    Caused by: java.lang.ClassNotFoundException: net.minecraft.server.v1_8_R1.EntityHuman
    The server jar you added to your build path
     
  5. I have added Spigot-1.8 to The server and to the project,
    should i add 1.8.8-Spigot to the server and project?
     
  6. electronicboy

    IRC Staff

    You need to add the server version that you're actually using and modify your code to work for that NMS revision.
     
  7. *advertising*
    Hello,

    I can recommend you to use my API. It has no bugs and is useful for other advanced methods and it doesn't have NMS problems (Only works on 1.8.8 and above).
    Your problem:
    The NMS package of Spigot 1.8.0 is net.minecraft.server.v1_8_R1 and the spigot.jar you added on your project is 1.8.8, this means v1_8_R3. Because of this, it won't work. Your plugin can only find v1_8_R3, but your server uses v1_8_R1.
     
  8. use [code] and [/code] variables so its clearer