ahsan habib
📎 1 file 2,754 chars
📄
pasted-code-1791090225412.txt
txt 39 lines
▶
Act as an expert Minecraft Plugin Developer. I need you to create a complete, fully functional Minecraft plugin for PaperMC version 1.21.1.

Plugin Details:
- Name: OPSMPManager
- Main Command: /smp
- Target Platform: PaperMC (Minecraft 1.21.1)
- Language: Java (using Paper-API)

Requirements & System Architecture:
1. Base Command Hierarchy: 
The primary command must be `/smp`. It should handle subcommands exactly like SpunkySMPEssentials. Provide full TabCompleter support for all subcommands.

2. Implement the following Core Subcommands and Features under /smp:
   - /smp fly [player] -> Toggles flight mode for self or targeted player.
   - /smp vanish -> Toggles invisibility/vanish mode, hiding the admin from other players.
   - /smp rtp -> Randomly teleports the player to safe coordinates.
   - /smp mute/unmute  -> Mutes or unmutes a player from public chat.
   - /smp ban/tempban/unban  [reason/duration] -> Basic moderation features with custom kick messages.
   - /smp kick/warn   -> Kicks or warns a player.
   - /smp invsee  -> Opens the real-time inventory preview of another player.
   - /smp god -> Toggles invincibility mode.
   - /smp spawn & setspawn -> Sets and teleports players to the server spawn point.
   - /smp nick/unnick   -> Changes player display name with hex color support.
   - /smp pvp -> Toggles global or per-player PvP status.
   - /smp seen  -> Shows when the player was last online in a human-readable format (e.g., "10 minutes ago").

3. Essential Sub-Systems to include:
   - Multi-Home System: /smp sethome [name], /smp home [name], /smp delhome [name] (with configurable limits per player).
   - Teleport Request (TPA) System: /smp tpa , /smp tpaccept, /smp tpdeny (with a 30-second expiry timeout).
   - Back System: Tracks player deaths/teleports so `/smp back` returns them to their previous location.
   - AFK System: /smp afk [message], automatically sets players AFK on inactivity, broadcasts status, and auto-kicks after a configurable idle time.
   - Utility Commands: /smp scoreboard (toggle sidebar), /smp bossbar (display admin messages), and /smp reload (reloads config).

4. Configuration & Extras:
   - Include a complete 'config.yml' template with fully customizable messages, color codes (MiniMessage/Legacy formats), AFK timers, and home limits.
   - Secure all commands behind a universal permission node structure (e.g., opsmpmanager.admin, opsmpmanager.user, opsmpmanager.command.[subcommand]).

Please generate the complete Java source code files (Main Class, Command Executors, Tab Completers, and Event Listeners) along with the 'plugin.yml' and 'config.yml' files structured correctly for Minecraft 1.21.1.
Kodari AI
KodariOct 4 at 5:13 am 3
OPSMPManager
Comprehensive PaperMC 1.21.1 admin and player utility plugin providing /smp command with fly, vanish, rtp, moderation (mute/ban/kick/warn), invsee, god mode, spawn management, nicknames with hex colors, PvP toggling, last-seen tracking, multi-home system with configurable limits, TPA requests with 30-second expiry, back teleport tracking, AFK detection with auto-kick, scoreboard toggling, bossbar messages, and config reload. Features full tab completion, universal permission hierarchy, and customizable config.yml with MiniMessage support.
  1. Add the Paper 1.21.1 plugin setup, permission/config templates, and persistence/message utilities.

  2. Implement /smp commands, tab completion, and listeners for moderation, travel, AFK, and PvP.

  3. Register everything in the plugin bootstrap.

Implemented the OPSMPManager Paper 1.21.1 project with /smp command handling, tab completion, moderation and player utilities, persistent homes/bans/mutes, TPA requests, back locations, AFK tracking, and configurable messages and limits.

The project setup, plugin.yml, config.yml, and Java sources are in place. Commands use opsmpmanager.admin, opsmpmanager.user, and per-command permission nodes.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
9 1,105
src/main/java/com/opsmpmanager/OPSMPManager.java
package com.opsmpmanager;

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

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

public final class OPSMPManager extends JavaPlugin {
    private PlayerDataStore dataStore;
    private MessageUtil messages;
    private SMPCommand smpCommand;
    private SMPListener smpListener;
    private final Set<UUID> vanishedPlayers = new HashSet<>();
    private final Set<UUID> godPlayers = new HashSet<>();

    @Override
    public void onEnable() {
        saveDefaultConfig();
        dataStore = new PlayerDataStore(this);
        messages = new MessageUtil(this);
        smpCommand = new SMPCommand(this);
        smpListener = new SMPListener(this);

        if (getCommand("smp") == null) {
            getLogger().severe("The /smp command is missing from plugin.yml.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }
        getCommand("smp").setExecutor(smpCommand);
        getCommand("smp").setTabCompleter(smpCommand);
        Bukkit.getPluginManager().registerEvents(smpListener, this);
        long period = Math.max(1L, getConfig().getLong("afk.check-period-seconds", 1L)) * 20L;
        Bukkit.getScheduler().runTaskTimer(this, smpListener::tickAfk, period, period);
    }

    public PlayerDataStore getDataStore() { return dataStore; }
    public MessageUtil getMessages() { return messages; }
    public SMPCommand getSmpCommand() { return smpCommand; }
    public SMPListener getSmpListener() { return smpListener; }
    public Set<UUID> getVanishedPlayers() { return vanishedPlayers; }
    public Set<UUID> getGodPlayers() { return godPlayers; }
    public boolean isPvpEnabled() { return getConfig().getBoolean("pvp.enabled", true); }

    public void setPvpEnabled(boolean enabled) {
        getConfig().set("pvp.enabled", enabled);
        saveConfig();
    }
}