polite.lyf

Create a Minecraft Java plugin for Paper 1.21.1+ that detects when an operator (OP) player runs a command and broadcasts it to all players.

Format: [OP Command] PlayerName executed: /command args Use PlayerCommandPreprocessEvent, ignore players with opannounce.bypass, and add a configurable message in config.yml.

Include full code with main class, listener, plugin.yml, and config.yml.

Kodari AI
KodariMar 20 at 9:36 am 5,257 (v2)

I’ll create a plugin that announces when OP players run commands with a configurable broadcast message.

OpAnnounce
A lightweight Paper plugin that broadcasts when operator players execute commands. Features configurable message formats with placeholders, bypass permissions for privacy, and full color code support. Helps server staff monitor OP command usage transparently while allowing trusted operators to remain private.

Plugin created successfully!

The OpAnnounce plugin will now broadcast whenever an OP player runs a command. Key features:

  • Configurable message format with {player} and {command} placeholders

  • Bypass permission (opannounce.bypass) for trusted OPs who want privacy

  • Toggle on/off via enabled: true/false in config.yml

  • Full color code support using & color codes

  • Paper 1.21.1+ compatible using PlayerCommandPreprocessEvent

Players with the bypass permission won’t have their commands announced, while other OPs will have their commands visible to all players on the server.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 104
src/main/java/com/opannounce/OpAnnouncePlugin.java
package com.opannounce;

import org.bukkit.plugin.java.JavaPlugin;

public class OpAnnouncePlugin extends JavaPlugin {
    
    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        getServer().getPluginManager().registerEvents(new CommandListener(this), this);
        
        getLogger().info("OpAnnounce has been enabled!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("OpAnnounce has been disabled!");
    }
}