skybo11

Make a plugin for 1.21 paper minecraft server. where if any one have op they Can't fly and cant use some Commands That the server owner add cmd on Config.yml files and add White list name on file The names on what list They can bypass the plugin

Kodari AI
KodariMay 22 at 8:08 pm 4,167 (v2)

I’ll create a plugin that restricts OP players from flying and using certain commands, with a whitelist bypass system.

OpRestrict
A security plugin that restricts operator players by preventing flight and blocking specific commands. OPs cannot fly or use blacklisted commands unless they are on the whitelist. Features configurable command blocking, whitelist system for trusted operators, automatic flight cancellation, and real-time reload support. Perfect for servers that need to limit OP abuse while allowing specific trusted players full access.

Created OpRestrict plugin with:

  • Flight prevention for OP players (unless whitelisted)

  • Configurable command blacklist that OPs cannot use

  • Whitelist system for trusted players who bypass all restrictions

  • /oprestrict reload command to reload configuration

  • Customizable messages for blocked actions

  • Caching system for performance

Configure the blocked-commands and whitelist sections in config.yml to fit your server’s needs.

skybo11

Change the name to CinderX

Kodari AI
KodariMay 22 at 8:19 pm 8,720 (v2)

I’ll rename the plugin from OpRestrict to CinderX, including package names, class names, and all references.

CinderX
A security plugin that restricts operator players by preventing flight and blocking specific commands. OPs cannot fly or use blacklisted commands unless they are on the whitelist. Features configurable command blocking, whitelist system for trusted operators, automatic flight cancellation, and real-time reload support. Perfect for servers that need to limit OP abuse while allowing specific trusted players full access.

Plugin renamed to CinderX! All references updated:

  • Package: com.example.cinderx

  • Main class: CinderX

  • Command: /cinderx (alias: /cx)

  • Permission: cinderx.admin

  • Configuration updated with CinderX branding

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 241
src/main/java/com/example/cinderx/CinderX.java
package com.example.cinderx;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;

import java.util.List;

public final class CinderX extends JavaPlugin {

    private CinderXListener listener;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        listener = new CinderXListener(this);
        getServer().getPluginManager().registerEvents(listener, this);
        
        getLogger().info("CinderX has been enabled!");
        getLogger().info("Whitelisted players: " + getWhitelist().size());
        getLogger().info("Blocked commands: " + getBlockedCommands().size());
    }

    @Override
    public void onDisable() {
        getLogger().info("CinderX has been disabled!");
    }

    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (command.getName().equalsIgnoreCase("cinderx")) {
            if (!sender.hasPermission("cinderx.admin")) {
                sender.sendMessage(colorize("&cYou don't have permission to use this command!"));
                return true;
            }

            if (args.length > 0 && args[0].equalsIgnoreCase("reload")) {
                reloadConfig();
                listener.reloadCache();
                sender.sendMessage(colorize(getConfig().getString("settings.reload-message", "&aConfiguration reloaded!")));
                return true;
            }

            sender.sendMessage(colorize("&aCinderX v" + getDescription().getVersion()));
            sender.sendMessage(colorize("&7Usage: /cinderx reload"));
            return true;
        }
        return false;
    }

    public List<String> getBlockedCommands() {
        return getConfig().getStringList("blocked-commands");
    }

    public List<String> getWhitelist() {
        return getConfig().getStringList("whitelist");
    }

    public boolean isFlightBlocked() {
        return getConfig().getBoolean("settings.block-flight", true);
    }

    public String getFlightBlockedMessage() {
        return getConfig().getString("settings.flight-blocked-message", "&cYou cannot fly as an OP!");
    }

    public String getCommandBlockedMessage() {
        return getConfig().getString("settings.command-blocked-message", "&cYou cannot use this command as an OP!");
    }

    public String colorize(String message) {
        return message.replace("&", "§");
    }
}