mrdangerous_official

Create a Minecraft plugin for Paper/Spigot (1.20+ compatible) named "DNGR-CLEARLAG".

IMPORTANT:

  • Focus ONLY on lag optimization
  • Do NOT include hopper limiter
  • All messages MUST be configurable
  • Use ActionBar (hotbar above) for countdown
  • Include sound effects
  • Optimized for large SMP servers

---

FEATURE 1: SMART ITEM CLEAR SYSTEM

  • Automatically clear dropped items after interval
  • Countdown MUST be shown in ActionBar

Countdown sequence:

  • 60 seconds
  • 30 seconds
  • 10 seconds
  • 3
  • 2
  • 1
  • After countdown:

- Remove all ground items - Broadcast message - Show total removed items

---

ACTIONBAR + SOUND SYSTEM

  • Show countdown in ActionBar:

"&cClearing items in {time}s"

  • Play sound at each countdown:

- Configurable sound (default: BLOCK_NOTE_BLOCK_PLING)

  • At final clear:

- Play different sound (default: ENTITY_GENERIC_EXPLODE)

---

CONFIG

items: enabled: true clear-interval: 300

countdown: times:

  • 60
  • 30
  • 10
  • 3
  • 2
  • 1

actionbar: "&cClearing items in {time}s" sound: "BLOCK_NOTE_BLOCK_PLING"

clear: message: "&aRemoved {amount} items to reduce lag!" sound: "ENTITY_GENERIC_EXPLODE"

whitelist:

  • DIAMOND
  • NETHERITE_INGOT

---

FEATURE 2: ENTITY LIMITER SYSTEM

  • Limit entities per chunk
  • Support per-entity-type limits
  • If limit exceeded:

- Remove extra entities

CONFIG:

entities: enabled: true

limits:

VILLAGER: 10 COW: 20 SHEEP: 20 PIG: 20 CHICKEN: 25

message: "&cRemoved extra entities in chunk!"

---

FEATURE 3: TPS MONITOR SYSTEM

  • Monitor server TPS continuously
  • If TPS drops below threshold:

- Trigger emergency cleanup: - Clear items - Remove entities

CONFIG:

tps: enabled: true threshold: 18.0 check-interval: 5

---

FEATURE 4: LAG SPIKE DETECTION

  • Detect sudden TPS drop
  • Instantly trigger cleanup

CONFIG:

lag-spike: enabled: true spike-threshold: 3.0

---

FEATURE 5: COMMANDS

  1. /dngrclearlag
  • Instantly clear items and entities
  1. /dngrclearlag reload
  • Reload config.yml without restarting server
  • Apply new messages, sounds, and timings instantly

Permissions:

  • dngrclearlag.use
  • dngrclearlag.reload

Message:

  • "&aDNGR-CLEARLAG config reloaded successfully!"

---

FEATURE 6: ALERT SYSTEM

CONFIG:

alerts: lag-detected: "&cLag detected! Optimizing..." cleanup-done: "&aCleanup complete!"

---

FEATURE 7: REDSTONE CONTROL SYSTEM

  • Add config option to enable/disable all redstone functionality

CONFIG:

redstone: enabled: true

BEHAVIOR:

  • If redstone.enabled = true:

- Game works normally

  • If redstone.enabled = false:

- Disable ALL redstone interactions including: - Lever - Button - Pressure plates - Redstone dust - Repeaters - Comparators - Pistons - Sticky pistons - Observers - Redstone torches

IMPLEMENTATION:

  • Cancel BlockRedstoneEvent when disabled
  • Cancel PlayerInteractEvent for redstone items
  • Cancel piston extend/retract events
  • Cancel redstone power changes
  • Ensure ZERO redstone updates occur

---

PERMISSIONS

  • dngrclearlag.use
  • dngrclearlag.reload
  • dngrclearlag.bypass

---

CODE REQUIREMENTS

  • Clean Java code
  • Use ActionBar API
  • Use Bukkit Scheduler for countdown
  • No heavy loops
  • No full world scans
  • Optimized entity filtering
  • No memory leaks

---

OUTPUT

Provide full source code:

  • Main class
  • Item clear system
  • Entity limiter system
  • TPS monitor class
  • Countdown system (ActionBar + Sound)
  • Redstone control listener
  • Command class (including reload)
  • Event listeners
  • plugin.yml
  • config.yml
  • Must compile without errors
Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code