spiderzenit-cell

Create a production-ready Minecraft Paper 1.21.x plugin using Java 21 and Maven.

Plugin Name SMP EssentialsX Goal Create a plugin that protects designated server-owner accounts from accidentally losing operator status. The plugin must be transparent and must not hide operator status, modify logs, or conceal permissions from other administrators.

Requirements Configuration Create a config.yml with: protected-users: - L4yzGG

settings: auto-op-on-startup: true auto-op-on-join: true block-deop: true

messages: restored-op: "&aRestored operator status for %player%." blocked: "&cThis player is protected." Features Automatically grant OP to all protected users when the plugin starts.

Automatically restore OP whenever a protected user joins if they are not already OP.

Prevent /deop <player> from affecting protected users.

Add permission: protectedadmin.override Players with this permission may bypass the protection.

Commands: /protectedadmin reload /protectedadmin list /protectedadmin add <player> /protectedadmin remove <player> Tab completion for all commands.

Console logging:

Log every automatic OP restoration.

Log blocked /deop attempts.

Log configuration reloads.

Follow Paper API best practices.

Use dependency injection where appropriate and keep the code modular.

Project structure:

ProtectedAdmin.java ConfigManager.java ProtectedUserManager.java CommandManager.java PlayerListener.java plugin.yml config.yml pom.xml The project must compile successfully without warnings.

Include detailed comments explaining the important logic.

Use the latest Paper API compatible with Paper 1.21.x and Java 21.

Generate the complete Maven project with all source files, resources, and build configuration

Kodari AI
KodariJul 20 at 5:12 pm 7
SmpEssentialsX
SMP EssentialsX protects designated server-owner accounts from accidental operator removal without hiding permissions, changing logs, or concealing administrative status. It automatically restores operator status on startup and join, blocks unauthorized de-op attempts, supports override permissions, and provides reload, list, add, remove, and tab-completion commands. Configuration and protection changes are persisted through a modular Paper API implementation.
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
8 564
src/main/java/com/kodari/protectedadmin/ProtectedAdmin.java
package com.kodari.protectedadmin;

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

/**
 * Main plugin entry point. Dependencies are constructed here and passed into
 * the managers and listeners that need them.
 */
public final class ProtectedAdmin extends JavaPlugin {

    private ConfigManager configManager;
    private ProtectedUserManager protectedUserManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.configManager = new ConfigManager(this);
        this.protectedUserManager = new ProtectedUserManager(this, this.configManager);

        CommandManager commandManager = new CommandManager(
                this,
                this.configManager,
                this.protectedUserManager
        );

        PluginCommand protectedAdminCommand = getCommand("protectedadmin");
        if (protectedAdminCommand == null) {
            getLogger().severe("The protectedadmin command is missing from plugin.yml. Disabling plugin.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }

        protectedAdminCommand.setExecutor(commandManager);
        protectedAdminCommand.setTabCompleter(commandManager);

        PlayerListener playerListener = new PlayerListener(
                this.configManager,
                this.protectedUserManager
        );
        Bukkit.getPluginManager().registerEvents(playerListener, this);

        this.protectedUserManager.restoreProtectedUsersOnStartup();

        getLogger().info("SMP EssentialsX has been enabled.");
    }
}