Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-1478

Getting drops for certain blocks not returning correct values.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • Linux Centos, 1 gb ram, Java 1.8.0_71, Latest Build of spigot (Right from Build tools)

    • AutoHarvest (Custom)

      Basically it doesn't return any items for Cocoa (Yes tested a ton of times), Returns not the normal items when you break Crops (No Seeds) And it doesn't support Nether_Wart (No items returned)

          @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
          public void onHarvest(BlockBreakEvent event) {
              Player player = event.getPlayer();
              Block block = event.getBlock();
              Bukkit.broadcastMessage(block.getType().name() + plants.contains(block.getType()));
              if (!plants.contains(block.getType()) || autoHarvest.getPlayerManager().hasPlayer(player)) return;
              Location location = block.getLocation();
              Collection<ItemStack> drops = block.getDrops();
              if(block.getType() == Material.CROPS) drops.add(new ItemStack(Material.SEEDS, 2));
              for(ItemStack itemStack : drops) Bukkit.broadcastMessage(itemStack.getType().name());
              HashMap<Integer, ItemStack> stack = player.getInventory().addItem(drops.toArray(new ItemStack[drops.size()]));
              block.setType(Material.AIR);
              if (stack.size() != 0) {
                  for (int i : stack.keySet()) location.getWorld().dropItem(location, stack.get(i));
                  player.sendMessage(chatUtils.format(message));
              }
          }
      

      Method I used ^

      Any help would be nice

            md_5 md_5
            camdenorrb Camden b
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: