Fehler ItemClickEvent

Dieses Thema im Forum "Programmierung" wurde erstellt von Dortmundminer, 8. Mai 2016.

  1. Dortmundminer
    Offline

    Dortmundminer

    Registriert seit:
    11. September 2014
    Beiträge:
    5
    Hallo brauche eure hilfe kommt immer ein fehler !

    Code (Text):
    1. public class Event_InventoryMove implements Listener {
    2.  
    3.  
    4.     @EventHandler
    5.     public void onInv(InventoryClickEvent e) {
    6.     Player p = (Player) e.getWhoClicked();
    7.  
    8.     if(e.getCurrentItem().getType() == null) {
    9.         e.setCancelled(false);
    10.     }
    11.  
    12.     if(p.isOp()) {
    13.         return;
    14.     }
    15.  
    16.     if(p.hasPermission("crackburn.build")) {
    17.         return;
    18.     }
    19.  
    20.     if(e.getCurrentItem().getType() == Material.ENDER_CHEST) {
    21.     e.setCancelled(true);
    22.  
    23.     } else if(e.getCurrentItem().getType() == Material.WATCH) {
    24.     e.setCancelled(true);
    25.     }else if(e.getCurrentItem().getType() == Material.BLAZE_ROD) {
    26.     e.setCancelled(true);
    27.     }else if(e.getCurrentItem().getType() == Material.ENDER_PEARL) {
    28.     e.setCancelled(true);
    29.     }else if(e.getCurrentItem().getType() == Material.COMPASS) {
    30.     e.setCancelled(true);
    31.  
    32.     }
    33.     }
    34.    
    35.  
    36. }
    Code (Text):
    1. org.bukkit.event.EventException
    2.         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]
    3.         at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]
    4.         at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    5.         at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    6.         at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:1588) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    7.         at net.minecraft.server.v1_8_R1.PacketPlayInWindowClick.a(SourceFile:31) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    8.         at net.minecraft.server.v1_8_R1.PacketPlayInWindowClick.a(SourceFile:9) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    9.         at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    10.         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_25]
    11.         at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_25]
    12.         at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    13.         at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    14.         at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    15.         at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
    16.         at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
    17. Caused by: java.lang.NullPointerException
    18.         at de.crackburn.events.Event_InventoryMove.onInv(Event_InventoryMove.java:16) ~[?:?]
    19.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
    20.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25]
    21.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25]
    22.         at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25]
    23.         at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]
    24.         ... 14 more
    Danke
     
    #1
  2. GPSforLEGENDS
    Offline

    GPSforLEGENDS

    Registriert seit:
    21. März 2014
    Beiträge:
    295
    Ort:
    Bürostuhl
    Minecraft:
    GPSforLEGENDS
     
    #2
    jensIO gefällt das.
  3. akaBuzzi
    Offline

    akaBuzzi

    Registriert seit:
    4. Mai 2016
    Beiträge:
    1
    Kleiner Tipp: Zeile 16 ;)
     
    #3