Awro PRO
📎 1 file 1,565 chars
📄
pasted-code-1789492938534.txt
txt 27 lines
▶
Create a brand new lightweight standalone Bukkit/Paper plugin named "DropCleaner" for Minecraft 1.20.4+ (Paper API).

Plugin Purpose:
A utility plugin for production/recording sets that cleans up dropped ground items across worlds on-demand via a single admin command, leaving all living entities, armor stands, item frames, and minecarts completely untouched.

Requirements:

1. Command & Permissions:
- Command: /itemyusun (aliases: [usunitemy, cleardrops])
- Permission: "dropcleaner.admin" (default: op)
- Behavior:
  * Can be executed from player chat or server console.
  * Scans all currently loaded worlds (or the executor's current world if preferred, but ideally iterates Bukkit.getWorlds()).
  * Identifies entities strictly matching `org.bukkit.entity.Item` (ground drops).
  * Explicitly ignores all other entities: living mobs, players, ArmorStands, ItemFrames, paintings, minecarts, and projectiles.
  * Removes the items (`itemEntity.remove()`) and counts the total amount removed.
  * Broadcasts a confirmation message to the command sender:
    "§a[DropCleaner] Usunieto {count} lezacych przedmiotow na serwerze!"
  * Plays sound "minecraft:entity.item.break" to the executing admin.

2. Files to create:
- pom.xml (Paper-API 1.20.4, Java 17+, clean Maven build).
- plugin.yml (register command /itemyusun with aliases and permission).
- DropCleaner.java (Main class, registers command executor).
- ClearDropsCommand.java (CommandExecutor & TabCompleter logic).

Ensure clean, compiling Java code with no missing imports.
Kodari AI
KodariSep 15 at 5:37 pm 1
DropCleaner
DropCleaner is a lightweight standalone Bukkit/Paper utility plugin for Minecraft 1.20.4+ that cleans up ground item drops across all loaded worlds via a single admin command. The plugin strictly targets org.bukkit.entity.Item entities, leaving living mobs, players, armor stands, item frames, paintings, minecarts, and projectiles completely untouched. Admins execute /itemyusun (aliases: usunitemy, cleardrops) with the dropcleaner.admin permission from chat or console. The plugin iterates Bukkit.getWorlds(), removes all ground items, counts the total removed, broadcasts a Polish confirmation message, and plays the item break sound to the executing admin. Includes Maven build configuration with Paper-API 1.20.4 and Java 17.
  1. Create the Maven project configuration and plugin descriptor.

  2. Implement the main plugin bootstrap and /itemyusun command with tab completion.

Created the standalone DropCleaner plugin with:

  • Maven build targeting Paper API 1.20.4 and Java 17

  • /itemyusun command with aliases:

    • /usunitemy

    • /cleardrops

  • dropcleaner.admin permission, defaulting to operators

  • Removal of only Item entities across all loaded worlds

  • Counting of individual dropped item quantities

  • Confirmation message in Polish

  • Break sound for player command executors

  • Console and player execution support

  • Tab completion support

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
4 136
src/main/java/com/dropcleaner/DropCleaner.java
package com.dropcleaner;

import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class DropCleaner extends JavaPlugin {

    @Override
    public void onEnable() {
        ClearDropsCommand clearDropsCommand = new ClearDropsCommand();
        PluginCommand command = getCommand("itemyusun");

        if (command == null) {
            getLogger().severe("Command itemyusun is not registered in plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        command.setExecutor(clearDropsCommand);
        command.setTabCompleter(clearDropsCommand);
    }
}