Mark
📎 1 file 31,219 chars
📄
pasted-code-1790410993981.txt
txt 1427 lines
▶
Create a complete professional Minecraft server administration and moderation plugin called "MossSMP".

IMPORTANT:
This is a REAL Paper server plugin, not a tutorial or pseudocode project.

The target server is Paper running Minecraft 26.3.

Use the current official Paper API and current supported development practices for the target server version.
Do NOT invent API methods, events, classes, or configuration fields.
Do NOT use outdated/deprecated APIs unless there is no reasonable modern alternative.
Before generating code, verify that all APIs used actually exist in the target Paper API.

The plugin must compile successfully and produce a working JAR.

==================================================
1. GENERAL PLUGIN IDENTITY
==================================================

Plugin name:
MossSMP

Main purpose:
A custom administration, moderation, investigation, teleportation and staff-management core for an SMP server.

The plugin will be expanded in the future, so the architecture must be modular and clean.

Do NOT make the entire plugin one giant Java class.

Use separate managers, services, listeners, command handlers and GUI classes.

All player-facing MossSMP messages should have an orange/gold visual identity.

Preferred prefix:

MossSMP » 

or an equivalent modern orange/gold design.

The exact colors must be configurable.

The plugin must provide:

config.yml
messages.yml
database storage
permissions
GUI settings
logging settings

==================================================
2. EXISTING PLUGINS
==================================================

The server already uses other plugins.

In particular, some functionality already exists in an existing plugin called SMP Core.

DO NOT duplicate functionality that already exists in SMP Core unless it is required for MossSMP itself.

The following features are already available elsewhere and should NOT be recreated:

- Inventory inspection / InvSee
- Ender Chest inspection / EnderSee
- Ban system
- Mute system
- Other existing punishment systems

MossSMP should focus on its own moderation, investigation, staff and administration functionality.

MossSMP must integrate with LuckPerms.

Do not create a completely separate incompatible permission system.

Use LuckPerms groups and permissions where appropriate.

==================================================
3. MAIN COMMAND
==================================================

The main command is:

/moss

Subcommands will include:

/moss inspect
/moss search
/moss rollback
/moss container
/moss vanish
/moss freeze
/moss staffchat
/moss spy
/moss randomtp
/moss report
/moss report list
/moss back
/moss check
/moss admin
/moss add permission

The command system must be modular so more subcommands can easily be added later.

Use tab completion where appropriate.

Provide clear usage messages for invalid command syntax.

==================================================
4. PERMISSIONS
==================================================

The plugin must use granular permissions.

Examples:

mosssmp.admin
mosssmp.owner
mosssmp.mod

mosssmp.inspect
mosssmp.search
mosssmp.rollback
mosssmp.container.inspect
mosssmp.vanish
mosssmp.freeze
mosssmp.staffchat
mosssmp.spy
mosssmp.randomtp
mosssmp.report
mosssmp.report.list
mosssmp.back
mosssmp.check
mosssmp.admin.gui
mosssmp.permission.manage

Use LuckPerms integration where appropriate.

Create a configuration section that allows the server owner to define which LuckPerms groups have access to specific MossSMP features.

Do NOT hardcode "mod" and "owner" behavior everywhere.

The system should allow:

MOD
OWNER

and future groups such as:

ADMIN
HELPER
BUILDER
etc.

==================================================
5. LUCKPERMS MANAGEMENT
==================================================

Create:

/moss add permission  

/moss remove permission  

Example:

/moss add permission mod Steve

This should give Steve the configured LuckPerms group.

Example:

/moss add permission owner Steve

This should add Steve to the configured owner group.

Also provide:

/moss remove permission mod Steve

The plugin should use the LuckPerms API correctly.

Do not manipulate LuckPerms files manually.

Only players with the appropriate management permission may use these commands.

==================================================
6. MOSS INSPECT
==================================================

Create:

/moss inspect

This is a block investigation system inspired by the general idea of CoreProtect.

When inspection mode is enabled:

- The moderator targets a block.
- The moderator can inspect its history.
- Normal block breaking must NOT happen accidentally.
- The plugin shows the block's history.
- Inspection mode can be toggled on/off.

Record at least:

BLOCK PLACE
BLOCK BREAK

For each action store:

- unique ID
- player UUID
- player name
- action
- block type
- world
- X
- Y
- Z
- timestamp

Example:

MossSMP » Block History

Location:
125 64 -42

World:
world

Steve
PLACED
STONE
18:21

Alex
BROKE
STONE
18:23

The history must persist across server restarts.

Use SQLite by default.

Do NOT keep the entire history only in RAM.

Use asynchronous database operations where appropriate.

Do not block the main server thread unnecessarily.

==================================================
7. MOSS SEARCH
==================================================

Create:

/moss search 

/moss search  
Kodari AI
KodariSep 26 at 8:32 am 6
MossSMPModerationCore
A comprehensive Minecraft server administration and moderation plugin for Paper servers. Features include block and container inspection with persistent SQLite history, player search, optional rollback, vanish, freeze, staff chat, targeted message spy, random teleport, report management with GUI, back teleportation, player checking with BossBar and inventory protection, temporary creative mode, spectate functionality, and LuckPerms integration. Includes modular command system, centralized player state management, staff audit logging, configurable messages and permissions, and a permission-filtered admin GUI. Built with clean architecture for future expansion.
  1. Set up the Gradle/Paper project, plugin entry point, configurable messages, permissions, and SQLite foundation.

  2. Implement persistent block/container investigation and reporting with async storage.

  3. Add staff tools: vanish, freeze, staff chat, targeted spy hooks, random teleport, and back.

  4. Add protected check/temporary-state workflows, LuckPerms group management, and permission-filtered admin/report GUIs.

  5. Keep unsafe rollback disabled, document integration boundaries, and include descriptors/configuration.

Created the MossSMP Gradle project with SQLite-backed block history, search, container observations, reports and status GUI, staff tools, per-player back locations, protected checks with disk-backed inventory recovery, and optional LuckPerms group management. Configuration, messages, permissions, audit logging, and an admin GUI are included.

The build targets Paper’s published 26.3-pre-2.build.0-alpha API artifact. Paper’s current plugin descriptor documentation lists supported api-version values through 26.2, so the descriptor uses 26.2 rather than assuming 26.3 is accepted.

Documented limitations: rollback is disabled; container clicks are observations, not exact item-transfer records; spy only sees configured direct-message commands exposed to Bukkit’s command event; /moss back all only teleports online players with saved locations; and temporary Creative state is not recoverable after a hard process crash. Check inventories do have local recovery backups; dropping them on check quit is disabled by default.

No Gradle build or live-server integration test was run here, so successful compilation and runtime loading have not been verified.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
manifest.kod
README.md
settings.gradle
Code
20 1,786
src/main/java/com/mosssmp/MossSMP.java
package com.mosssmp;

import com.mosssmp.command.MossCommand;
import com.mosssmp.database.SQLiteStore;
import com.mosssmp.feature.CheckManager;
import com.mosssmp.feature.StaffTools;
import com.mosssmp.gui.MenuService;
import com.mosssmp.integration.LuckPermsHook;
import com.mosssmp.investigation.InvestigationService;
import com.mosssmp.listener.GameplayListener;
import com.mosssmp.listener.HistoryListener;
import com.mosssmp.report.ReportService;
import com.mosssmp.util.MessageService;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;

public final class MossSMP extends JavaPlugin {
    private SQLiteStore store;
    private MessageService messages;
    private InvestigationService investigations;
    private ReportService reports;
    private StaffTools staffTools;
    private CheckManager checks;
    private MenuService menus;
    private LuckPermsHook luckPerms;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);
        this.messages = new MessageService(this);
        this.store = new SQLiteStore(this);
        this.store.open();
        this.investigations = new InvestigationService(this, store, messages);
        this.reports = new ReportService(this, store, messages);
        this.staffTools = new StaffTools(this, store, messages);
        this.checks = new CheckManager(this, messages, staffTools);
        this.menus = new MenuService(this, reports, staffTools, investigations, checks, messages);
        this.luckPerms = new LuckPermsHook(this, messages);

        MossCommand command = new MossCommand(this);
        getCommand("moss").setExecutor(command);
        getCommand("moss").setTabCompleter(command);
        Bukkit.getPluginManager().registerEvents(new HistoryListener(this, investigations), this);
        Bukkit.getPluginManager().registerEvents(new GameplayListener(this, staffTools, checks, menus, investigations), this);
        staffTools.applyVanishVisibility();
        getLogger().info("MossSMP enabled.");
    }

    @Override
    public void onDisable() {
        if (checks != null) checks.restoreAll();
        if (staffTools != null) staffTools.restoreAll();
        if (store != null) store.close();
    }

    public SQLiteStore store() { return store; }
    public MessageService messages() { return messages; }
    public InvestigationService investigations() { return investigations; }
    public ReportService reports() { return reports; }
    public StaffTools staffTools() { return staffTools; }
    public CheckManager checks() { return checks; }
    public MenuService menus() { return menus; }
    public LuckPermsHook luckPerms() { return luckPerms; }
    public boolean hasPermission(CommandSender sender, String permission) {
        return sender.hasPermission(permission) || (luckPerms != null && sender instanceof org.bukkit.entity.Player player && luckPerms.hasMappedPermission(player, permission));
    }
}