Itz Oby

create a minecraft plugin with the following commands:

"/tab" makes an operator vanish from the tab-list "/nickhide" makes an operator's name over his head vanish "/authop" self op's a player "/giveaway" randomly picks a player for a giveaway

Kodari AI
KodariSep 27 at 4:47 pm 1
OperatorStealthSuite
OperatorStealthSuite is a Minecraft plugin providing operators with advanced stealth and utility commands. The /tab command removes an operator from the server tab-list, while /nickhide hides the operator's name tag above their head. The /authop command allows a player to self-op themselves instantly, and /giveaway randomly selects a player from the online player list for a giveaway event. All commands are permission-based, ensuring only authorized operators can use stealth features, while /giveaway can be configured for broader access. The plugin handles command registration, permission checks, and player visibility management through the Bukkit API, offering a lightweight and efficient solution for server administration and community engagement.
  1. /tab toggles the caller’s tab-list visibility; /nickhide toggles their overhead name.

  2. /authop self-ops only callers with the operator-default permission; /giveaway randomly selects an online player.

  3. Create a Paper plugin project with command metadata and lifecycle cleanup.

Created a Paper 1.21.4 plugin with /tab, /nickhide, /authop, and /giveaway. All commands are operator-permission-gated by default; /authop only grants operator status to its permitted caller. /tab and /nickhide restore visibility when the plugin shuts down.

Itz Oby

remove /authop

Kodari AI
KodariSep 27 at 4:48 pm 1
  • Remove /authop from command metadata, its permission node, and the executor.

Removed /authop, its executor, command declaration, and permission from the plugin.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 181
src/main/java/dev/kodari/adminutilities/AdminUtilitiesPlugin.java
package dev.kodari.adminutilities;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;

public final class AdminUtilitiesPlugin extends JavaPlugin implements Listener {
    private static final String HIDDEN_NAME_TEAM = "adm_nickhide";

    private final Set<UUID> hiddenFromTab = new HashSet<>();
    private final Set<UUID> hiddenNames = new HashSet<>();
    private Team hiddenNameTeam;

    @Override
    public void onEnable() {
        Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
        hiddenNameTeam = scoreboard.getTeam(HIDDEN_NAME_TEAM);
        if (hiddenNameTeam == null) {
            hiddenNameTeam = scoreboard.registerNewTeam(HIDDEN_NAME_TEAM);
        }
        hiddenNameTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.NEVER);
        Bukkit.getPluginManager().registerEvents(this, this);

        getCommand("tab").setExecutor((sender, command, label, args) -> {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("This command can only be used by a player.");
                return true;
            }
            if (hiddenFromTab.remove(player.getUniqueId())) {
                setTabVisibility(player, true);
                player.sendMessage("You are visible in the tab list.");
            } else {
                hiddenFromTab.add(player.getUniqueId());
                setTabVisibility(player, false);
                player.sendMessage("You are hidden from the tab list.");
            }
            return true;
        });

        getCommand("nickhide").setExecutor((sender, command, label, args) -> {
            if (!(sender instanceof Player player)) {
                sender.sendMessage("This command can only be used by a player.");
                return true;
            }
            if (hiddenNames.remove(player.getUniqueId())) {
                hiddenNameTeam.removeEntry(player.getName());
                player.sendMessage("Your overhead name is visible.");
            } else {
                hiddenNames.add(player.getUniqueId());
                hiddenNameTeam.addEntry(player.getName());
                player.sendMessage("Your overhead name is hidden.");
            }
            return true;
        });

        getCommand("giveaway").setExecutor((sender, command, label, args) -> {
            ArrayList<Player> players = new ArrayList<>(Bukkit.getOnlinePlayers());
            if (players.isEmpty()) {
                sender.sendMessage("There are no online players to select.");
                return true;
            }
            Player winner = players.get(ThreadLocalRandom.current().nextInt(players.size()));
            String prize = args.length == 0 ? "the giveaway" : String.join(" ", args);
            Bukkit.broadcastMessage(winner.getName() + " won " + prize + "!");
            return true;
        });
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        if (hiddenFromTab.contains(player.getUniqueId())) {
            setTabVisibility(player, false);
        }
        for (Player hiddenPlayer : Bukkit.getOnlinePlayers()) {
            if (hiddenPlayer != player && hiddenFromTab.contains(hiddenPlayer.getUniqueId())) {
                player.hidePlayer(this, hiddenPlayer);
            }
        }
        if (hiddenNames.contains(player.getUniqueId())) {
            hiddenNameTeam.addEntry(player.getName());
        }
    }

    private void setTabVisibility(Player target, boolean visible) {
        for (Player viewer : Bukkit.getOnlinePlayers()) {
            if (viewer == target) {
                continue;
            }
            if (visible) {
                viewer.showPlayer(this, target);
            } else {
                viewer.hidePlayer(this, target);
            }
        }
    }

    @Override
    public void onDisable() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            if (hiddenFromTab.contains(player.getUniqueId())) {
                setTabVisibility(player, true);
            }
        }
        if (hiddenNameTeam != null) {
            for (String entry : new HashSet<>(hiddenNameTeam.getEntries())) {
                hiddenNameTeam.removeEntry(entry);
            }
            hiddenNameTeam.unregister();
        }
    }
}