Solved dropItemNaturally() Help

Discussion in 'Plugin Help/Development/Requests' started by AngryCupcake274, Dec 21, 2014.

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

    AngryCupcake274

    Hello all, I am crating a plugin that needs to drop items in the world, but it throws an error. Here is the error:
    Code:
    [22:18:34] [Server thread/ERROR]: Could not pass event BlockBreakEvent to SpecialTools v1.0.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerInteractManager.breakBlock(PlayerInteractManager.java:285) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerInteractManager.a(PlayerInteractManager.java:214) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:587) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockDig.a(SourceFile:40) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockDig.a(SourceFile:10) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit.jar:git-Bukkit-6b061e2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_60]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_60]
        at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:643) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:598) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:506) [craftbukkit.jar:git-Bukkit-6b061e2]
        at java.lang.Thread.run(Unknown Source) [?:1.7.0_60]
    Caused by: java.lang.IllegalArgumentException: Cannot drop AIR.
        at org.apache.commons.lang.Validate.isTrue(Validate.java:157) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.craftbukkit.v1_8_R1.CraftWorld.dropItem(CraftWorld.java:303) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.craftbukkit.v1_8_R1.CraftWorld.dropItemNaturally(CraftWorld.java:320) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at me.AngryCupcake274.SpecialTools.ListenerHandler.onMine(ListenerHandler.java:214) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        ... 16 more
    [22:18:53]
    and the code where the error is thrown:
    Code:
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b1));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b2));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b3));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b4));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b5));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b6));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b7));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b8));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b9));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b10));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b11));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b12));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b13));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b14));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b15));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b16));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b17));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b18));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b19));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b20));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b21));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b22));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b23));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b24));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b25));
    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b26));
    P.S. b1, b2, etc. are not null.
     
  2. Offline

    Skionz

  3. Offline

    AngryCupcake274

    @Skionz how could I tell the plugin to ignore the lines that aren't air?
     
  4. Offline

    Skionz

  5. Offline

    AngryCupcake274

  6. Offline

    mythbusterma

    AdamQpzm and teej107 like this.
  7. Offline

    Skionz

    @AngryCupcake274
    Code:
    for(Material myMaterial : myMaterialArray) {
        if(myMaterial != Material.AIR) {
            myCoolWorld.dropItemNaturally(myLocation, new ItemStack(myMaterial);
        }
    }
    EDIT: Ninjad
     
  8. Offline

    AngryCupcake274

    @Skionz so the myMaterialArray would contain all b1, b2, b3, etc. What would myMaterial equal?
     
  9. Offline

    Skionz

  10. Offline

    teej107

    @AngryCupcake274 It would be the current material that you are iterating through.
     
  11. Offline

    AngryCupcake274

    @Skionz @teej107 but there are about 20 different materials I am comparing the 26 blocks to.
     
  12. Offline

    Skionz

  13. Offline

    AngryCupcake274

    Class:
    Code:
    package me.AngryCupcake274.SpecialTools;
    
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Random;
    
    import org.bukkit.ChatColor;
    import org.bukkit.GameMode;
    import org.bukkit.Location;
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.BlockBreakEvent;
    import org.bukkit.event.player.PlayerLoginEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.PlayerInventory;
    import org.bukkit.inventory.meta.ItemMeta;
    
    public class ListenerHandler implements Listener {
    
        private final Main plugin;
       
        int test = 1;
        int loot = 1;
        int loot2 = 1;
        int loot3 = 1;
        int loot4 = 1;
       
        Boolean st = false;
       
        Random random = new Random();
    
        public static Material[] SmeltList = { Material.IRON_ORE,
                Material.GOLD_ORE, Material.STONE, Material.LOG };
    
        public ListenerHandler(Main plugin) {
            this.plugin = plugin;
        }
    
        @EventHandler
        public void onLogin(PlayerLoginEvent event) {
            String temp = event.getPlayer().getName();
            Player pl = event.getPlayer();
    
            if (plugin.expick.contains(temp)) {
                String pickName = "Explosive Pickaxe";
                List<String> pickLores = new ArrayList<String>();
                pickLores.add("Blast Your Way to the Top!");
                PlayerInventory inventory = pl.getInventory();
                ItemStack pick = new ItemStack(Material.DIAMOND_PICKAXE);
                ItemMeta pickMeta = pick.getItemMeta();
                pickMeta.setDisplayName(pickName);
                pickMeta.setLore(pickLores);
                pick.setItemMeta(pickMeta);
                pl.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD
                        + "Here is your pickaxe.");
                inventory.addItem(pick);
    
                plugin.expick.remove(temp);
            }
        }
    
        @EventHandler
        private void onMine(BlockBreakEvent e) {
            Player p = e.getPlayer();
            Location loc = e.getBlock().getLocation();
            GameMode gm = p.getGameMode();
    
            /*
             * top of cuboid 1 2 3 4 5 6 7 8 9
             */
            Location block1 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() + 1, e.getBlock().getZ() - 1);
            Location block2 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() + 1, e.getBlock().getZ());
            Location block3 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() + 1, e.getBlock().getZ() + 1);
            Location block4 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() + 1, e.getBlock().getZ() - 1);
            Location block5 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() + 1, e.getBlock().getZ());
            Location block6 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() + 1, e.getBlock().getZ() + 1);
            Location block7 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() + 1, e.getBlock().getZ() - 1);
            Location block8 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() + 1, e.getBlock().getZ());
            Location block9 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() + 1, e.getBlock().getZ() + 1);
    
            /*
             * bottom of cuboid 10 11 12 13 14 15 16 17 18
             */
            Location block10 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() - 1, e.getBlock().getZ() - 1);
            Location block11 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() - 1, e.getBlock().getZ());
            Location block12 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY() - 1, e.getBlock().getZ() + 1);
            Location block13 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() - 1, e.getBlock().getZ() - 1);
            Location block14 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() - 1, e.getBlock().getZ());
            Location block15 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY() - 1, e.getBlock().getZ() + 1);
            Location block16 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() - 1, e.getBlock().getZ() - 1);
            Location block17 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() - 1, e.getBlock().getZ());
            Location block18 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY() - 1, e.getBlock().getZ() + 1);
    
            /*
             * side 1 of cuboid XX XX XX 19 20 21 XX XX XX
             */
            Location block19 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY(), e.getBlock().getZ() - 1);
            Location block20 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY(), e.getBlock().getZ());
            Location block21 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() - 1, e.getBlock().getY(), e.getBlock().getZ() + 1);
    
            /*
             * side 2 of cuboid XX XX XX XX 22 23 XX XX XX
             */
            Location block22 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY(), e.getBlock().getZ() + 1);
            Location block23 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY(), e.getBlock().getZ() + 1);
    
            /*
             * side 3 of cuboid XX XX XX XX 24 25 XX XX XX
             */
            Location block24 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY(), e.getBlock().getZ());
            Location block25 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX() + 1, e.getBlock().getY(), e.getBlock().getZ() - 1);
    
            /*
             * side 4 of cuboid XX XX XX XX 26 XX XX XX XX
             */
            Location block26 = new Location(e.getBlock().getWorld(), e.getBlock()
                    .getX(), e.getBlock().getY(), e.getBlock().getZ() - 1);
    
            Material b1 = block1.getBlock().getType();
            Material b2 = block2.getBlock().getType();
            Material b3 = block3.getBlock().getType();
            Material b4 = block4.getBlock().getType();
            Material b5 = block5.getBlock().getType();
            Material b6 = block6.getBlock().getType();
            Material b7 = block7.getBlock().getType();
            Material b8 = block8.getBlock().getType();
            Material b9 = block9.getBlock().getType();
            Material b10 = block10.getBlock().getType();
            Material b11 = block11.getBlock().getType();
            Material b12 = block12.getBlock().getType();
            Material b13 = block13.getBlock().getType();
            Material b14 = block14.getBlock().getType();
            Material b15 = block15.getBlock().getType();
            Material b16 = block16.getBlock().getType();
            Material b17 = block17.getBlock().getType();
            Material b18 = block18.getBlock().getType();
            Material b19 = block19.getBlock().getType();
            Material b20 = block20.getBlock().getType();
            Material b21 = block21.getBlock().getType();
            Material b22 = block22.getBlock().getType();
            Material b23 = block23.getBlock().getType();
            Material b24 = block24.getBlock().getType();
            Material b25 = block25.getBlock().getType();
            Material b26 = block26.getBlock().getType();
    
            if (gm == GameMode.SURVIVAL) {
                // player is in gamemode 0
    
                if (e.getPlayer().getInventory().getItemInHand().getItemMeta()
                        .getLore().contains("Blast Your Way to the Top!")) {
                    // explosive pickaxe in slot
                   
                    if (e.getPlayer().getInventory().getItemInHand().containsEnchantment(Enchantment.LOOT_BONUS_BLOCKS)) {
                        // pickaxe has fortune
                       
                        int elevel = e.getPlayer().getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
                        if(elevel == 1) {
                            loot = 2;
                        } else if(elevel == 2) {
                            loot = random.nextInt(1)+2;
                        } else if(elevel == 3) {
                            loot = random.nextInt(2)+2;
                        } else {
                            loot = 1;
                        }
                       
                        if (plugin.lores == true) {
                            loot2 = loot;
                        }
                       
                        if (plugin.lblocks == true) {
                            loot3 = loot;
                        }
                       
                        if (plugin.lstone == true) {
                            loot4 = loot;
                        }
                    }
                   
                    if (e.getPlayer().getInventory().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)) {
                        st = true;
                    }
    
                    p.getWorld().createExplosion(loc, 0);
                   
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b1));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b2));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b3));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b4));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b5));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b6));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b7));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b8));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b9));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b10));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b11));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b12));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b13));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b14));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b15));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b16));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b17));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b18));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b19));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b20));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b21));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b22));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b23));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b24));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b25));
                    e.getPlayer().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(b26));
                }
            }
        }
    }
    
     
  14. Offline

    teej107

    @AngryCupcake274 Put your materials in an Array or a Collection. Then
     
  15. Offline

    Skionz

  16. Offline

    AngryCupcake274

    @Skionz @teej107 don't hate me, but I'm still confused for what material to put in myMaterial.

    I shouldn't be up this late.
     
  17. Offline

    teej107

    @AngryCupcake274 Again....
    Sorry mythbusterma for quoting your post for the 3rd time.
     
  18. Offline

    AngryCupcake274

    @Skionz @teej107 facepalm. I don't have to assign myMaterial....OH MY GOSH I NEED COFFEE!

    @Skionz @teej107 I'm still getting an error in the main line of:
    Code:
                    for(Material somemat : blocklist) {
                        if(somemat != Material.AIR) {
                            e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), new ItemStack(somemat));
                        }
                    }
    Here is where I define that array:
    Code:
                    Material[] blocklist = new Material[26];
                    b1 = blocklist[0];
                    b2 = blocklist[1];
                    b3 = blocklist[2];
                    b4 = blocklist[3];
                    b5 = blocklist[4];
                    b6 = blocklist[5];
                    b7 = blocklist[6];
                    b8 = blocklist[7];
                    b9 = blocklist[8];
                    b10 = blocklist[9];
                    b11 = blocklist[10];
                    b12 = blocklist[11];
                    b13 = blocklist[12];
                    b14 = blocklist[13];
                    b15 = blocklist[14];
                    b16 = blocklist[15];
                    b17 = blocklist[16];
                    b18 = blocklist[17];
                    b19 = blocklist[18];
                    b20 = blocklist[19];
                    b21 = blocklist[20];
                    b22 = blocklist[21];
                    b23 = blocklist[22];
                    b24 = blocklist[23];
                    b25 = blocklist[24];
                    b26 = blocklist[25];
    <Edited by bwfcwalshy: Merged posts, please use the edit button rather than double posting.>
     
    Last edited by a moderator: Dec 22, 2014
  19. Offline

    teej107

    @AngryCupcake274 What error?

    EDIT: Btw you can also create arrays like this
    Code:
    new Object[]{someObject, otherObject, thatObject};
     
  20. Offline

    AngryCupcake274

    @teej107
    Code:
    [Server thread/ERROR]: Could not pass event BlockBreakEvent to SpecialTools v1.0.0
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:297) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:486) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerInteractManager.breakBlock(PlayerInteractManager.java:285) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerInteractManager.a(PlayerInteractManager.java:214) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:587) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockDig.a(SourceFile:40) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockDig.a(SourceFile:10) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [craftbukkit.jar:git-Bukkit-6b061e2]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_60]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_60]
        at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:643) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:284) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:598) [craftbukkit.jar:git-Bukkit-6b061e2]
        at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:506) [craftbukkit.jar:git-Bukkit-6b061e2]
        at java.lang.Thread.run(Unknown Source) [?:1.7.0_60]
    Caused by: java.lang.NullPointerException
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:68) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:46) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        at me.AngryCupcake274.SpecialTools.ListenerHandler.onMine(ListenerHandler.java:245) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:295) ~[craftbukkit.jar:git-Bukkit-6b061e2]
        ... 16 more
     
  21. Offline

    teej107

  22. Offline

    AngryCupcake274

  23. Offline

    Skionz

  24. Offline

    AngryCupcake274

    @Skionz @teej107 I read the post, and found a NullPointerException at line 259. The problem is, that's the line that executes when there is an air block.
     
  25. Offline

    teej107

    @AngryCupcake274 That line is trying to get something from a null variable. Make sure you initialize your variables before you try to do anything else to them.
     
  26. Offline

    Bloxcraft

    You put it in backwards. It should be blocklist[#] = b#, what you are doing is setting the b# values to what's in the array you just created, which is full of null values.
     
    teej107 likes this.
  27. Offline

    AdamQpzm

    @AngryCupcake274 I've spotted the real problem here: You're new at Java, yes? That's why you're getting confused here and the advice wasn't really making much sense to you. You need to learn more Java to make plugins, because plugins are written in Java. Please learn the basics from either the Oracle tutorials or a Java book. :)
     
    TigerHix and Skionz like this.
  28. Offline

    AngryCupcake274

    @AdamQpzm I know Java, but the thing is, my first language was BASIC, so the arrays are a little different. Also, I've used different loops before, but never the type of loop above. Anyways, thank you all for helping me on this!
     
  29. Offline

    mrCookieSlime Retired Staff

    Moved to Alternatives Section.
     
Thread Status:
Not open for further replies.

Share This Page