Weird scanning with ItemSpawnEvent on 1000 items spawn at a time

Discussion in 'Spigot Plugin Development' started by thienbao860, Sep 15, 2019.

  1. Code (Java):
    @EventHandler
        public void spawnItem(ItemSpawnEvent event) {
            Chunk chunk = event.getLocation().getChunk();
            World world = event.getLocation().getWorld();

            scan(event.getEntity(), chunk, world);
        }

        private void scan(Item item, Chunk chunk, World world) {
            Bukkit.broadcastMessage(String.valueOf(item.getItemStack().getAmount())); }
    I have the custom mob stacker plugin, if kill a 1000x mob will drop 1000x items (64x64x64x64... in one place). But the problem here is it only work with specific mob drops when kill.
    For example: Killing a 1000x creeper will spam in chat "64" and the last "24", but killing 1000x iron golem only send 1 message: "64". Is there a way to fix?