P

Add Tab Completer on admin commands

📎 1 file 1,181 chars
📄
pasted-code-1771966823242.txt
txt 60 lines
▶
❄ FrostHide

FrostHide is a lightweight, high-performance staff hide plugin designed for SMP and PvP servers.
It allows staff members to completely disguise themselves with zero lag using PacketEvents.

🔹 Main Command
/hide

Toggles hide mode on or off.

When a player uses /hide:

✅ Their skin changes to the UUID set in config.yml

✅ Their username becomes fully scrambled using &e&k

✅ Their tab priority is set to highest, placing them at the top of the tablist

✅ All changes are handled using PacketEvents (no respawns, no reloads, no lag)

When /hide is used again:

🔄 Their original skin is restored

🔄 Their real username is restored

🔄 Their tab priority returns to normal

🔄 Hide mode is fully removed

🔹 Admin Commands
/hide admin check 

Checks whether a player is currently in hide mode.

/hide admin list

Opens a INVENTORY GUI showing all currently hidden players.

/hide admin remove 

Force-removes hide mode from a player.

Restores their original skin

Restores their original name

Resets tab priority

⚡ Performance

Built using PacketEvents

No scoreboard conflicts

No respawn glitches

No lag spikes

Pure packet-based disguise system
Kodari AI
KodariFeb 24 at 9:04 pm 10,246 (v2)

I’ll add tab completion for the admin commands. First, let me check the current project structure.

This is a new project. I’ll initialize it and create the FrostHide plugin with tab completion for admin commands.

FrostHide
A lightweight, high-performance staff hide plugin for SMP and PvP servers. Allows staff members to completely disguise themselves using PacketEvents with packet-based skin changes, scrambled usernames, and tab priority modifications. Features include admin commands to check, list, and force-remove hide mode from players with zero lag and no respawn glitches.

I’ll create the FrostHide plugin with tab completion for admin commands.

Tab completion has been added to the FrostHide plugin with intelligent suggestions for all admin commands - /hide admin suggests check/list/remove, and check/remove commands auto-complete with online player names.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
14 744
src/main/java/com/frosthide/FrostHide.java
package com.frosthide;

import com.frosthide.command.HideCommand;
import com.frosthide.inventory.gui.GUIListener;
import com.frosthide.inventory.gui.GUIManager;
import com.frosthide.listener.FrostPacketListener;
import com.frosthide.manager.HideManager;
import com.github.retrooper.packetevents.PacketEvents;
import io.github.retrooper.packetevents.factory.spigot.SpigotPacketEventsBuilder;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class FrostHide extends JavaPlugin {
    private HideManager hideManager;
    private GUIManager guiManager;

    @Override
    public void onLoad() {
        // Prepare PacketEvents API early (load only)
        PacketEvents.setAPI(SpigotPacketEventsBuilder.build(this));
        PacketEvents.getAPI().load();
    }

    @Override
    public void onEnable() {
        // Ensure config exists on disk & is loaded
        saveDefaultConfig();

        // initialize managers
        this.hideManager = new HideManager(this);
        this.guiManager = new GUIManager();

        // init PacketEvents and register packet listener
        PacketEvents.getAPI().init();
        PacketEvents.getAPI().getEventManager().registerListener(new FrostPacketListener(this));

        // Register command only after plugin enable initialization
        HideCommand hideCommand = new HideCommand(this);
        if (getCommand("hide") != null) {
            getCommand("hide").setExecutor(hideCommand);
            getCommand("hide").setTabCompleter(hideCommand);
        } else {
            getLogger().warning("Command 'hide' not defined in plugin.yml!");
        }

        // Register GUI listener
        Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);

        getLogger().info("FrostHide has been enabled!");
    }

    @Override
    public void onDisable() {
        if (hideManager != null) {
            hideManager.disableAllHides();
        }
        // ensure PacketEvents terminates gracefully
        try {
            PacketEvents.getAPI().terminate();
        } catch (Exception e) {
            getLogger().warning("Error terminating PacketEvents: " + e.getMessage());
        }
        getLogger().info("FrostHide has been disabled!");
    }

    /**
     * Safe getMessage: uses getConfig() directly to avoid a stored-null field.
     */
    public String getMessage(String key) {
        FileConfiguration cfg = getConfig();
        String raw = cfg.getString("messages." + key, "&cMessage not found: " + key);
        return raw.replace("&", "§");
    }

    public String getHideSkinUUID() {
        return getConfig().getString("hide-skin-uuid", "069a79f4-44e9-4726-a5be-fca90e38aaf5");
    }
}