mrgameryt777

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

IMPORTANT:

  • This plugin should ONLY include:

- Sit command - Auto restart system - Hopper limiter system

  • Do NOT include any ban or punishment systems
  • All messages and settings must be configurable

---

FEATURE 1: SIT COMMAND

Command: /sit

Behavior:

  • Player sits using invisible armor stand
  • Toggle system (sit/stand)
  • Auto stand if:

- Player moves - Player jumps - Player takes damage

CONFIG:

sit: command: "sit" message-sit: "&aYou are now sitting" message-stand: "&cYou stood up"

---

FEATURE 2: AUTO RESTART SYSTEM

Command: /dngrrestart

Behavior:

  • Send messages:

30 sec → wait 10 sec → wait 5 → 4 → 3 → 2 → 1

  • Then:

Execute /restart

CONFIG:

restart: command: "dngrrestart"

messages: start: "&c[Alert] SERVER RESTART IN 30 SECOND" sec10: "&cSERVER RESTART IN 10 SECOND" sec5: "&cSERVER RESTART IN 5" sec4: "&c4" sec3: "&c3" sec2: "&c2" sec1: "&c1" final: "&4SERVER IS RESTARTING"

---

FEATURE 3: HOPPER LIMITER SYSTEM (FULL)

GOAL:

Prevent server lag caused by too many hoppers.

---

CORE FEATURES

  1. Chunk Hopper Limit:
  • Limit number of hoppers per chunk
  1. Placement Check:
  • When player places hopper:

- Check chunk hopper count - If limit exceeded → cancel placement

  1. Break Support:
  • When hopper is broken:

- Reduce count

  1. Auto Scan:
  • On chunk load:

- Count hoppers correctly

  1. Optional Remove System:
  • If chunk exceeds limit:

- Remove extra hoppers (config option)

---

CONFIG

hopper: enabled: true max-per-chunk: 10

remove-extra: false

message-limit: "&cToo many hoppers in this chunk!"

bypass-permission: "dngrutils.hopper.bypass"

---

BEHAVIOR

  • If player tries to place hopper:

- If count >= limit: → Cancel event → Send message

  • If remove-extra = true:

- Automatically remove extra hoppers

---

EVENTS

  • BlockPlaceEvent (hopper)
  • BlockBreakEvent (hopper)
  • ChunkLoadEvent (scan)
  • Optional repeating scan task

---

PERFORMANCE (VERY IMPORTANT)

  • Use HashMap or cache for chunk hopper counts
  • Do NOT scan entire world repeatedly
  • Only update on events
  • Optimize for large SMP servers

---

PERMISSIONS

  • dngrutils.sit
  • dngrutils.restart
  • dngrutils.hopper.bypass

---

CODE REQUIREMENTS

  • Clean Java code
  • No lag
  • Efficient chunk tracking
  • No memory leaks
  • Use listeners properly
  • Use scheduler for restart countdown

---

OUTPUT

Provide full source code:

  • Main class
  • Sit command class
  • Restart command class
  • Hopper limiter class
  • Event listeners
  • plugin.yml
  • config.yml
  • Ready to compile without errors
Kodari AI
KodariMar 25 at 6:10 am 14,618 (v2)

I’ll create a complete DNGR-UTILS plugin with sit command, auto restart, and hopper limiter system.

DngrUtils
Essential server utilities plugin featuring a sit command with automatic stand detection, configurable auto-restart system with countdown messages, and intelligent hopper limiter to prevent lag from excessive hopper usage. Includes per-chunk hopper tracking, bypass permissions, and optional auto-removal of excess hoppers. Optimized for large SMP servers with efficient caching and minimal performance impact.

DNGR-UTILS plugin created successfully!

✅ Features Implemented:

  • Sit Command - Toggle sitting with invisible armor stand, auto-stand on move/damage

  • Auto Restart - 30-second countdown with configurable messages and /restart execution

  • Hopper Limiter - Per-chunk hopper limits with efficient caching, optional auto-removal, bypass permission

✅ Performance Optimized:

  • HashMap-based chunk tracking (no repeated world scans)

  • Event-driven updates (only counts on place/break/load)

  • Efficient ChunkKey class for proper Map storage

✅ All configurable - Every message and setting in config.yml

Ready to compile and use on Paper/Spigot 1.20+ servers!

mrgameryt777

Change Plugin name dngr-restart

Kodari AI
KodariMar 25 at 6:12 am 4,991 (v2)

I’ll read the current project files to understand the structure and then change the plugin name to “dngr-restart”.

I’ll update the plugin name to “dngr-restart” in the plugin.yml file.

Plugin name changed to “dngr-restart” in plugin.yml.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
12 668
src/main/java/com/dngrutils/DngrUtils.java
package com.dngrutils;

import com.dngrutils.command.RestartCommand;
import com.dngrutils.command.SitCommand;
import com.dngrutils.listener.HopperListener;
import com.dngrutils.listener.SitListener;
import com.dngrutils.manager.HopperLimitManager;
import com.dngrutils.manager.RestartManager;
import com.dngrutils.manager.SitManager;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class DngrUtils extends JavaPlugin {
    
    private SitManager sitManager;
    private RestartManager restartManager;
    private HopperLimitManager hopperLimitManager;
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.sitManager = new SitManager(this);
        this.restartManager = new RestartManager(this);
        this.hopperLimitManager = new HopperLimitManager(this);
        
        registerCommands();
        registerListeners();
        
        getLogger().info("DNGR-UTILS has been enabled!");
    }
    
    @Override
    public void onDisable() {
        if (this.sitManager != null) {
            this.sitManager.removeAllStands();
        }
        
        getLogger().info("DNGR-UTILS has been disabled!");
    }
    
    private void registerCommands() {
        String sitCmd = getConfig().getString("sit.command", "sit");
        String restartCmd = getConfig().getString("restart.command", "dngrrestart");
        
        getCommand(sitCmd).setExecutor(new SitCommand(this));
        getCommand(restartCmd).setExecutor(new RestartCommand(this));
    }
    
    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new SitListener(this), this);
        Bukkit.getPluginManager().registerEvents(new HopperListener(this), this);
    }
    
    public FileConfiguration cfg() {
        return getConfig();
    }
}