greatestbanana13

---

ItemLimiter Per Chunk

Author: Dexer

ItemLimiter Per Chunk is a Minecraft plugin that allows server owners to control how many specific items can be dropped within each chunk. Using a simple configuration file, you can whitelist items by their official Minecraft item IDs (such as BONE, SEA_PICKLE, etc.) and set a maximum drop limit per chunk.

Once the limit is reached, no additional items of that type can be dropped in the same chunk, helping to reduce lag and prevent item farming abuse.

Configuration Example

yaml
LIMITED-ITEMS:
  BONE: 1000

This example limits BONE drops to 1,000 per chunk.

---

Make it so when the items disappear they get reset in the counter so it doesnt bug

Kodari AI
KodariJan 1 at 4:53 pm 4,161 (v2)

I’ll create an ItemLimiter plugin that tracks item drops per chunk and resets the counter when items despawn.

ItemLimiterPerChunk
A lightweight Minecraft plugin that limits specific item drops per chunk to reduce lag and prevent farming abuse. Server owners can configure maximum drop limits for each item type using Minecraft item IDs. The plugin automatically tracks dropped items and resets counters when items despawn, ensuring accurate limit enforcement without permanent blocking.

Plugin created! Key features:

  • Tracks items per chunk using chunk coordinates and world name

  • Prevents drops when limit is reached for that item type in the chunk

  • Removes from counter when items despawn, get picked up, or merge

  • Thread-safe using ConcurrentHashMap for multi-threaded environments

  • Configurable limits via config.yml for any item type

  • Automatic cleanup when items disappear, preventing the bug you mentioned

The counter accurately tracks item amounts and decrements when items are removed from the world by any means.

greatestbanana13

Add messages when reached entity limit

greatestbanana13

Add messages

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 247
src/main/java/com/dexer/itemlimiter/ItemLimiterPlugin.java
package com.dexer.itemlimiter;

import com.dexer.itemlimiter.listener.ItemDespawnListener;
import com.dexer.itemlimiter.listener.ItemDropListener;
import com.dexer.itemlimiter.manager.ChunkItemTracker;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ItemLimiterPlugin extends JavaPlugin {
    
    private ChunkItemTracker chunkItemTracker;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.chunkItemTracker = new ChunkItemTracker(this);
        
        getServer().getPluginManager().registerEvents(new ItemDropListener(this), this);
        getServer().getPluginManager().registerEvents(new ItemDespawnListener(this), this);
        
        getLogger().info("ItemLimiterPerChunk has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (chunkItemTracker != null) {
            chunkItemTracker.clearAll();
        }
        getLogger().info("ItemLimiterPerChunk has been disabled!");
    }
}