Plugin Help What went wrong?

Discussion in 'Plugin Help/Development/Requests' started by TheDiamond06, Dec 24, 2014.

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

    TheDiamond06

    Code:
    @EventHandler
        public void PickRightClickSell(PlayerInteractEvent e)
        {
            Player p = e.getPlayer();
            if(p.hasPermission("lightningcustom.sella"))
            {
            if(e.getPlayer().getItemInHand().getType() == (Material.DIAMOND_PICKAXE))
           {
        if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)
           {
            Player p1 = e.getPlayer();
            ItemStack i = p1.getItemInHand();
            ItemMeta im = i.getItemMeta();
            if (im.getDisplayName().equalsIgnoreCase("§c§lA-Pickaxe"))
            {
                Bukkit.dispatchCommand(p1, "sellall a");
            }
           }
        }
            }
            else
            {
               ItemStack item = p.getItemInHand();
               Action action = e.getAction();
               if (!(e.getAction() == Action.RIGHT_CLICK_AIR || action.equals(Action.RIGHT_CLICK_BLOCK))) return;
               if (!(e.getItem().getType() == Material.DIAMOND_PICKAXE)) return;
                  p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
                  p.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 20000000, 1));
                  p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20000000, 1));
                  p.getPlayer().setAllowFlight(true);
                  p.getPlayer().setFlying(true);
            }
        }
    [CODE] /CODE
    
    So I made an Event Handler so it checks if you have permission then checks for a certain item name and dispatches the command "sellall a". I don't know what went wrong here there is an error obviously. Here is the event handler.
     
    Last edited: Dec 24, 2014
  2. Offline

    nverdier

    Please post in code BB code rather than plain text
     
  3. Offline

    TheDiamond06

    well I don't know if that worked but code BB doesn't seem like its working for me... I pressed the button and even deleted it and repasted it in.
     
  4. Offline

    nverdier

    Put CODE in "[" and "]" before the code and /CODE in brackets after the code.
     
  5. Offline

    TheDiamond06

    did it Thanks, now hopefully you can help with the problem.
     
  6. Offline

    nverdier

    Is there an error? What's the problem?
     
  7. Offline

    TheDiamond06

    When I Right click the pickaxe with the correct permission [OP] it gives me a stack trace in the console:
    Code:
    [22:21:10] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to LightningEdit v1.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:226) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:196) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:605) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.a(SourceFile:60) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.PacketPlayInBlockPlace.handle(SourceFile:9) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:667) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
    Caused by: java.lang.NullPointerException
        at com.enjin.lightningedit.LightningEdit.PickBoost(LightningEdit.java:71) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-11-g3fd9db2-b3098jnks]
        ... 15 more
    [22:21:16] [Server thread/INFO]: CONSOLE: Stopping the server..[m
     
    Last edited: Dec 24, 2014
  8. Offline

    nverdier

    Again, put it in BB code, but on line 71 there is a variable or method that is/returns null.
     
Thread Status:
Not open for further replies.

Share This Page