Clear Netherlands
📎 1 file 16,368 chars
📄
pasted-code-1793558479777.txt
txt 612 lines
▶
# UNSTABLE SMP — Advanced Punishment Plugin

## Project Overview

Create a fully functional, production-ready Minecraft Paper plugin named **UnstablePunish** for the Minecraft server **Unstable SMP**.

The plugin must include a complete punishment management system with bans, mutes, kicks, warnings, advanced staff activity logs, Discord webhook integration, unique punishment IDs, and an automated chat moderation system.

**Technical requirements:**
- Language: Java 21 or the version required by the target Paper build.
- Server software: Paper, targeting our Paper 26.2 build. Verify API compatibility.
- Build system: Maven.
- Database: No MySQL, MongoDB, or external database.
- Storage: YAML configuration and data files.
- Formatting: MiniMessage, including HEX gradients.
- Permissions: LuckPerms-compatible Bukkit permissions.
- Discord logging: Configurable webhooks.
- All features must be configurable.
- No paid APIs or mandatory external services.
- No pseudocode, placeholder implementations, or unfinished features.

---

# 1. Punishment Commands

Implement these commands:

| Command | Description |
|---|---|
| `/punish ` | Opens punishment GUI |
| `/ban  [reason]` | Ban a player |
| `/tempban   [reason]` | Temporary ban |
| `/unban ` | Remove a ban |
| `/mute  [reason]` | Mute a player |
| `/tempmute   [reason]` | Temporary mute |
| `/unmute ` | Remove a mute |
| `/kick  [reason]` | Kick a player |
| `/warn  [reason]` | Warn a player |
| `/history ` | View punishment history |
| `/banlookup ` | Search by punishment ID |
| `/punishlogs [player]` | View staff activity |
| `/punishadmin reload` | Reload configurations |
| `/punishadmin reasons` | Manage reasons |
| `/chatfilter` | Manage automatic chat moderation |

Support online and offline players for applicable commands.

Use UUIDs for player identification, not just usernames.

# 2. Custom Punishment GUI

When a staff member executes `/punish `, open a professional inventory GUI.

Main categories:

- 🔨 Bans
- 🔇 Mutes
- 👢 Kicks
- ⚠️ Warnings
- 📋 Punishment History

**CRITICAL: Every category must have its OWN reasons.**

When clicking Bans, show ONLY ban reasons.

When clicking Mutes, show ONLY mute reasons.

When clicking Kicks, show ONLY kick reasons.

When clicking Warnings, show ONLY warning reasons.

Never combine all reasons into one menu.

Each reason must have:
- Custom display name
- Configurable material/icon
- Description/lore
- Duration
- Required permission
- Optional confirmation screen
- Optional escalation rules

Include Back, Next Page, Previous Page, and Cancel buttons.

# 3. Default Ban Reasons

| Reason | First Offense | Second Offense | Third Offense |
|---|---|---|---|
| Cheating / Hacked Client | 30 days | 90 days | Permanent |
| X-Ray / Exploiting | 14 days | 30 days | Permanent |
| Duplication Exploit | 30 days | 90 days | Permanent |
| Bug Abuse | 7 days | 30 days | Permanent |
| IRL Trading | Permanent | Permanent | Permanent |
| Account Compromise / Security | Until review | Until review | Until review |
| Ban Evasion | 30 days | 90 days | Permanent |
| Severe Harassment | 7 days | 30 days | Permanent |
| Threats / Doxxing | Permanent | Permanent | Permanent |
| Advertising Other Servers | 7 days | 30 days | Permanent |
| Inappropriate Builds | 3 days | 7 days | 30 days |
| Repeated Rule Violations | 7 days | 30 days | Permanent |
| Management Placed Ban | Another Millennium | Another Millennium | Another Millennium |

**Management Placed Ban:**
- Only available to management with a special permission.
- Cannot be removed using normal `/unban`.
- Must be removed using `/punishadmin managementunban  `.
- Every management unban must be logged.
- Requires a separate permission.
- Display duration as `Another Millennium`.
- Internally use a permanent ban, not a real 1,000-year timer.
- Mark the punishment as management-locked.

IRL Trading bans should also be management-locked by default, with configurable removal permissions.

# 4. Default Mute Reasons

| Reason | First Offense | Second Offense | Third Offense |
|---|---|---|---|
| Spam | 15 minutes | 1 hour | 1 day |
| Flooding Chat | 10 minutes | 30 minutes | 12 hours |
| Excessive Caps | Warning | 15 minutes | 1 hour |
| Toxic Behavior | 1 hour | 12 hours | 3 days |
| Harassment | 12 hours | 3 days | 7 days |
| Discrimination / Hate Speech | 7 days | 30 days | Permanent |
| Advertising | 1 day | 7 days | 30 days |
| Inappropriate Language | 30 minutes | 3 hours | 1 day |
| Bypassing Chat Filter | 1 hour | 12 hours | 3 days |
| Staff Disrespect / Abuse | 1 hour | 12 hours | 3 days |
| Repeated Chat Violations | 1 day | 7 days | Permanent |

All mute reasons and durations must be editable.

# 5. Default Kick Reasons

Kicks must have their own category and NEVER show ban or mute reasons.

Default kick reasons:
- Disruptive Behavior
- Inappropriate Skin
- Inappropriate Username
- Chat Disruption
- Refusing Staff Instructions
- AFK Abuse
- Suspicious Activity
- Exploit Investigation
- Server Interference
- General Rule Violation
- Management Requested Kick

Kicks do not have durations.

Allow staff to add custom explanations.

# 6. Unique Punishment IDs

Every punishment must receive its own unique ID.

Examples:

`#84jd48`

`#9ka73m`

`#7mx21q`

Requirements:
- Generate a random six-character alphanumeric ID.
- Prefix it with `#`.
- Never reuse an existing ID.
- Case-insensitive lookup.
- Store IDs permanently.
- Apply IDs to bans, mutes, kicks, and warnings.
- Display the ID in punishment screens, history, and Discord logs.

The `/banlookup` command must accept IDs with or without `#`.

# 7. Custom Ban Screen

Create a fully configurable Minecraft disconnect screen using MiniMessage.

Default design:

**UNSTABLE SMP**

You have been banned from this server.

**Reason:** Cheating / Hacked Client

**Duration:** 30 Days

**Punishment ID:** #84jd48

**Banned By:** StaffName

**Expires:** 30 November 2026

Think this punishment was unfair?

**Appeal:** discord.gg/nUSVsMeHYZ

Use a bold pink/purple gradient for the title:
- #FF4FD8
- #B84DFF
- #FF65D4

All other text should be clean, professional, and readable.

The ban screen must support:
- Permanent bans
- Temporary bans
- Management-locked bans
- Dynamic expiration dates
- Dynamic staff names
- Dynamic punishment IDs
- Custom reasons
- Configurable appeal links

Also create custom mute notifications and kick disconnect screens.

# 8. Advanced Discord Webhook Logging

Create a complete Discord webhook logging system.

Every category must support a separate webhook URL.

Configuration example:

```yaml
webhooks:
  enabled: true

  bans:
    enabled: true
    url: ""
  unbans:
    enabled: true
    url: ""
  mutes:
    enabled: true
    url: ""
  unmutes:
    enabled: true
    url: ""
  kicks:
    enabled: true
    url: ""
  warnings:
    enabled: true
    url: ""
  staff-commands:
    enabled: true
    url: ""
  chat-filter:
    enabled: true
    url: ""
  management-actions:
    enabled: true
    url: ""
  config-changes:
    enabled: true
    url: ""
```

Every webhook embed must show:
- Action type
- Target username
- Target UUID
- Staff member
- Staff UUID, if applicable
- Reason
- Duration
- Punishment ID
- Offense number
- Date and time
- Expiration date
- Server name
- Action source: GUI, command, console, or automated moderation

Use Discord embed colors matching the action.

**Advanced staff command logging:**

Log every execution attempt of a command belonging to this plugin, including failed commands.

Examples:
- `/ban`
- `/mute`
- `/kick`
- `/unban`
- `/unmute`
- `/punish`
- `/punishadmin`
- `/chatfilter`

Record:
- Executor
- Full command arguments, with sensitive data redacted
- Timestamp
- Whether it succeeded or failed
- Permission denial
- Affected player
- Result
- Whether executed from console or in-game

Also log GUI actions, punishment removals, reason changes, filter changes, reloads, and management overrides.

Keep a local audit trail even when Discord is unavailable.

Webhook requests must be asynchronous, with timeouts, rate-limit handling, and bounded retries. Never block the main server thread.

# 9. Free Automated Chat Moderation

Create a built-in automated chat moderation system.

It must be completely free to operate.

Do NOT require:
- OpenAI API keys
- Paid AI services
- External subscriptions
- Third-party moderation APIs

Implement a local, rule-based moderation engine with optional contextual heuristics.

Do not falsely describe this as a trained AI model. If a genuinely free, locally runnable model is supported, make it optional and disabled by default.

The moderation engine must detect:
- Configured prohibited words
- Common spelling variations
- Repeated characters
- Spam
- Flooding
- Excessive caps
- Advertising links
- Suspicious repeated messages
- Configurable bypass patterns

Support normalization of Unicode characters and common substitutions, while avoiding excessive false positives.

**Configurable actions per word or rule:**
- Allow
- Block message
- Warn player
- Notify staff
- Temporary mute
- Permanent mute
- Kick
- Escalate based on repeated violations

Example:

```yaml
chat-filter:
  enabled: true
  log-violations: true

  default-action: BLOCK

  words:
    exampleword:
      enabled: true
      match-mode: WHOLE_WORD
      action: WARN
      reason: "Inappropriate Language"
      notify-staff: true

    forbiddenphrase:
      enabled: true
      match-mode: PHRASE
      action: MUTE
      duration: "1h"
      reason: "Chat Filter Violation"
      notify-staff: true

  spam:
    enabled: true
    max-messages: 5
    interval-seconds: 10
    action: WARN

  caps:
    enabled: true
    minimum-letters: 12
    max-percentage: 80
    action: BLOCK
```

The example words are placeholders, not actual prohibited words.

Use a default warning or message-blocking action rather than immediately banning players for uncertain matches.

**In-game filter commands:**

`/chatfilter addword   [duration]`

`/chatfilter removeword `

`/chatfilter list`

`/chatfilter enable`

`/chatfilter disable`

`/chatfilter reload`

`/chatfilter info `

`/chatfilter setaction   [duration]`

Changes made in-game must be saved to YAML immediately.

Support multiword phrases using quoted arguments.

Allow staff exemptions through permissions.

All automated actions must be logged with:
- Triggered rule
- Matched word or phrase
- Player
- Action taken
- Timestamp
- Whether the message was blocked
- Automated punishment ID, if created

Restrict sensitive chat content in Discord logs by default. Allow configurable redaction.

# 10. Punishment History & Lookup

Every punishment must be stored permanently.

Use files such as:

```text
plugins/UnstablePunish/
├── config.yml
├── reasons/
│   ├── bans.yml
│   ├── mutes.yml
│   ├── kicks.yml
│   └── warnings.yml
├── chat-filter.yml
├── messages.yml
├── gui.yml
├── webhooks.yml
├── permissions.yml
├── data/
│   ├── players/
│   ├── punishments/
│   └── indexes/
└── logs/
    ├── commands/
    ├── punishments/
    ├── chat-filter/
    └── management/
```

Use safe file writes, caching, and asynchronous disk I/O where appropriate.

Prevent duplicate IDs and corrupted records.

Implement `/history ` as a paginated GUI displaying:
- All punishments
- Active punishments
- Expired punishments
- Removed punishments
- Punishment IDs
- Reasons
- Staff members
- Dates
- Durations
- Removal reasons

Support clickable punishment details.

Never delete historical punishment records when a player is unbanned or unmuted.

# 11. Offense Tracking

Create configurable escalation based on previous offenses.

Example:

First spam offense → 15-minute mute.

Second spam offense → 1-hour mute.

Third spam offense → 1-day mute.

Track offenses separately by punishment reason or configurable offense group.

Expired punishments must remain in history.

Support configurable offense reset periods, such as 30 or 90 days.

Staff must be able to view offense counts and manually correct them with a permission-controlled, logged command.

# 12. Permissions

```text
unstablepunish.punish
unstablepunish.ban
unstablepunish.tempban
unstablepunish.unban
unstablepunish.mute
unstablepunish.tempmute
unstablepunish.unmute
unstablepunish.kick
unstablepunish.warn
unstablepunish.history
unstablepunish.lookup
unstablepunish.logs
unstablepunish.reload
unstablepunish.reasons.manage
unstablepunish.chatfilter.manage
unstablepunish.chatfilter.bypass
unstablepunish.management.ban
unstablepunish.management.unban
unstablepunish.notify
unstablepunish.admin
```

All staff commands must require appropriate permissions.

The management permission must NOT automatically be given to ordinary moderators or administrators.

Support configurable punishment hierarchies so staff cannot punish users of equal or higher authority unless explicitly authorized.

Protect console access and prevent permission bypasses.

# 13. Additional Features

Implement these features:

**Silent punishments**

Allow `-s` on punishment commands.

Silent punishments should not broadcast publicly but must still be recorded and logged.

**Staff notifications**

Send online staff notifications when punishments occur.

**Punishment confirmation**

Optionally require confirmation before permanent bans and management bans.

**Offline punishments**

Support banning and muting offline players by UUID.

**Automatic expiration**

Automatically expire temporary bans and mutes, including when the server restarts.

**Staff notes**

Allow authorized staff to add internal notes to punishment records.

**Custom reasons**

Allow staff to select a predefined reason or enter a custom reason when permitted.

**Configuration reload**

Reload configurations without losing active punishments or requiring a full restart.

**Discord reliability**

Queue webhook events safely and retry temporary failures without creating duplicate logs.

# 14. Plugin Quality & Security

The plugin must:
- Never perform blocking file or HTTP operations on the main thread.
- Be safe against command injection and malformed user input.
- Validate durations and permissions.
- Sanitize Discord webhook content and mentions.
- Protect against YAML corruption.
- Handle player disconnects and server restarts.
- Avoid duplicate punishments from concurrent actions.
- Support safe reload behavior.
- Include useful console error messages.
- Avoid unnecessary dependencies.
- Be optimized for a busy multiplayer server.
- Avoid storing player IP addresses unless explicitly enabled.
- Restrict access to sensitive logs.
- Preserve a tamper-evident audit trail where practical.

# 15. Final Deliverables

Generate a complete, buildable Maven project.

Include:
1. Complete Java source code.
2. `plugin.yml`.
3. `pom.xml`.
4. All default YAML configuration files.
5. Fully functional punishment GUIs.
6. Ban, mute, kick, and warning systems.
7. Chat moderation engine.
8. Discord webhook integration.
9. Punishment history and unique ID system.
10. README with installation instructions.
11. Commands and permissions documentation.
12. Tests for punishment IDs, durations, escalation, permissions, and chat filter rules.

If the build environment supports Maven, compile the plugin and resolve compilation errors.

**IMPORTANT:** Do not stop after creating the project structure. Implement every system fully, including the GUIs, persistent storage, command executors, event listeners, logging, and webhook integration.

The final result must be a working Paper plugin suitable for deployment on Unstable SMP.
Kodari AI
KodariNov 1 at 7:14 pm 7
UnstablePunish
A comprehensive Paper plugin for Unstable SMP providing advanced punishment management. Features include GUI-based punishment system with separate ban, mute, kick, and warning reason menus, unique punishment IDs, offense tracking with escalation, permanent YAML storage, MiniMessage formatting with HEX gradients, Discord webhook logging with per-category URLs, and a free rule-based chat moderation engine. Supports temporary and permanent punishments, management-locked bans, offline player handling, silent punishments, staff notifications, paginated history GUI, and full configuration reload. Includes comprehensive permissions system, staff command logging, and automated expiration handling.
  1. Create the Maven/Paper project, default configuration, reason catalogs, and documentation.

  2. Implement persistent punishments, IDs/escalation, command handling, GUIs, audit/webhook logging, and chat moderation.

  3. Add focused unit tests for IDs, durations, escalation, hierarchy, and filter matching.

Created UnstablePunish as a Maven plugin targeting Paper 26.2 and Java 25. It includes YAML-backed punishment history and IDs, commands and GUIs, escalation and management locks, MiniMessage screens, rule-based chat moderation, audit logging, configurable webhooks, default configs, documentation, and unit tests.

I haven’t run the Maven build or tests in this environment.

Clear Netherlands

fix error

Kodari AI
KodariNov 1 at 7:18 pm 1

I couldn’t identify a confirmed code error from the project alone. Please paste the build error output (especially the first error and its file/line), and I’ll fix the cause.

Clear Netherlands

The compilation failed with this error:

code
Compilation failed with 7 error(s):

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 3: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
                            ^

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 7: package org.junit.jupiter.api does not exist
import static org.junit.jupiter.api.Assertions.*;
                                   ^

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 10: cannot find symbol
    @Test void punishmentIdsAreSixCharacterAndNeverCollideWithExistingIds() {
     ^
  symbol: class Test
  location: class PunishmentCoreTest

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 20: cannot find symbol
    @Test void durationParserSupportsCompoundUnitsAndRejectsMalformedValues() {
     ^
  symbol: class Test
  location: class PunishmentCoreTest

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 28: cannot find symbol
    @Test void escalationUsesOffenseTierAndCapsAtLastTier() {
     ^
  symbol: class Test
  location: class PunishmentCoreTest

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 36: cannot find symbol
    @Test void hierarchyBlocksEqualOrHigherStaffUnlessBypassed() {
     ^
  symbol: class Test
  location: class PunishmentCoreTest

ERROR in src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java at line 43: cannot find symbol
    @Test void localFilterNormalizesEvasionAndRespectsMatchModes() {
     ^
  symbol: class Test
  location: class PunishmentCoreTest


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - Test
ACTION: Create these classes or check imports

FILES TO INVESTIGATE:
  - src/main/java/test/java/net/unstablesmp/punish/PunishmentCoreTest.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariNov 1 at 7:20 pm 1
  • Keep the tests and their JUnit API intact.

  • Make JUnit available on the compile classpath without packaging it into the plugin.

Changed JUnit’s Maven scope from test to provided in pom.xml. This makes JUnit available to the compilation step while keeping it out of the plugin’s packaged runtime dependencies.

Clear Netherlands

It doesnt work it dont do anything ingame + it doesnt do a config file

Kodari AI
KodariNov 1 at 7:29 pm 1
  1. Find why punishment commands have no in-game effect and fix the flow.

  2. Add and connect the missing configuration file.

Punishment commands now default to operators, and active mutes are enforced even if chat filtering is disabled. Next I’m checking which config resources are missing so startup can generate them properly.

Updated the plugin so operators can use punishment commands by default, and active mutes still block chat when the chat filter is disabled. I also restored JUnit to the compile classpath to address the build blocker.

config.yml already exists in src/main/resources, and startup calls saveDefaultConfig() to copy it to plugins/UnstablePunish/config.yml. If it’s still missing after installing the rebuilt JAR, check the server startup log—the plugin may not be enabling.

Clear Netherlands

It still didnt create a config file

Kodari AI
KodariNov 1 at 7:31 pm 1
  • Create the data directory explicitly before initializing configuration.

  • Copy the bundled config.yml only when the server-side file is missing, and log its full path so it’s clear where it was created.

Updated startup to create the plugin data folder and copy the bundled config.yml if it’s missing. On startup, the console now logs the exact path where it created the file—typically plugins/UnstablePunish/config.yml.

Recompile the plugin and replace the JAR on your server; existing config files won’t be overwritten.

Clear Netherlands

It dont work your a stupid AI fuck you

Kodari AI
KodariNov 1 at 7:35 pm 1

You’re right to be frustrated—I shouldn’t have repeated the fix without confirming why it failed. The current startup code creates plugins/UnstablePunish/config.yml as soon as the plugin enables, so if the file is absent, the plugin likely isn’t loading or the server is still using an older JAR.

Please paste the server startup log lines mentioning UnstablePunish, especially any load error. That will show what’s stopping it; the compile output alone won’t reveal it.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
README.md
Code
27 1,346
src/main/java/net/unstablesmp/punish/UnstablePunish.java
package net.unstablesmp.punish;

import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public final class UnstablePunish extends JavaPlugin {
    private YamlConfiguration messages, webhooksConfig, chatFilterConfig;
    private YamlConfiguration[] reasons;
    private PunishmentStore store;
    private AuditLogger audit;
    private WebhookLogger webhooks;
    private PunishmentService service;
    private PunishGUI gui;
    private ChatModerationListener chatFilter;
    private CommandHandler commands;
    private final ExecutorService configWriter = Executors.newSingleThreadExecutor(r -> { Thread t = new Thread(r, "UnstablePunish-ConfigWriter"); t.setDaemon(true); return t; });

    @Override public void onEnable() {
        ensureConfigFile();
        for (String path : new String[]{"messages.yml", "webhooks.yml", "chat-filter.yml", "reasons/bans.yml", "reasons/mutes.yml", "reasons/kicks.yml", "reasons/warnings.yml"}) {
            File file = new File(getDataFolder(), path);
            if (!file.exists()) { file.getParentFile().mkdirs(); saveResource(path, false); }
        }
        loadAuxiliary();
        store = new PunishmentStore(getDataFolder().toPath());
        audit = new AuditLogger(getDataFolder().toPath());
        webhooks = new WebhookLogger(this, webhooksConfig);
        service = new PunishmentService(this, store, audit, webhooks);
        gui = new PunishGUI(this, service);
        chatFilter = new ChatModerationListener(this, service, audit, webhooks);
        commands = new CommandHandler(this, service, gui, chatFilter, audit, webhooks);
        for (String command : new String[]{"punish", "ban", "tempban", "unban", "mute", "tempmute", "unmute", "kick", "warn", "history", "banlookup", "punishlogs", "punishadmin", "chatfilter"}) {
            if (getCommand(command) != null) getCommand(command).setExecutor(commands);
        }
        Bukkit.getPluginManager().registerEvents(gui, this);
        Bukkit.getPluginManager().registerEvents(chatFilter, this);
        Bukkit.getPluginManager().registerEvents(service, this);
        getLogger().info("UnstablePunish enabled with " + store.all().size() + " historical records.");
    }
    private void ensureConfigFile() {
        File configFile = new File(getDataFolder(), "config.yml");
        try {
            Files.createDirectories(getDataFolder().toPath());
            if (configFile.exists()) return;
            var resource = getResource("config.yml");
            if (resource == null) throw new IOException("Bundled config.yml is missing from the plugin JAR.");
            try (resource) {
                Files.copy(resource, configFile.toPath());
            }
            getLogger().info("Created configuration file: " + configFile.getAbsolutePath());
        } catch (IOException ex) {
            throw new IllegalStateException("Could not create " + configFile.getAbsolutePath(), ex);
        }
    }
    private void loadAuxiliary() {
        reloadConfig();
        messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));
        webhooksConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "webhooks.yml"));
        chatFilterConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "chat-filter.yml"));
        reasons = new YamlConfiguration[]{YamlConfiguration.loadConfiguration(new File(getDataFolder(), "reasons/bans.yml")), YamlConfiguration.loadConfiguration(new File(getDataFolder(), "reasons/mutes.yml")), YamlConfiguration.loadConfiguration(new File(getDataFolder(), "reasons/kicks.yml")), YamlConfiguration.loadConfiguration(new File(getDataFolder(), "reasons/warnings.yml"))};
    }
    public void reloadAll() { loadAuxiliary(); webhooks.reload(webhooksConfig); chatFilter.reload(chatFilterConfig); gui.reloadReasons(reasons); }
    public void saveYamlAsync(String relativePath, YamlConfiguration yaml) {
        String snapshot = yaml.saveToString(); Path destination = getDataFolder().toPath().resolve(relativePath);
        configWriter.execute(() -> {
            Path temporary = destination.resolveSibling(destination.getFileName() + ".tmp");
            try {
                Files.createDirectories(destination.getParent()); Files.writeString(temporary, snapshot, StandardCharsets.UTF_8);
                try { Files.move(temporary, destination, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); }
                catch (java.nio.file.AtomicMoveNotSupportedException ignored) { Files.move(temporary, destination, StandardCopyOption.REPLACE_EXISTING); }
            } catch (IOException ex) { getLogger().severe("Could not save " + relativePath + ": " + ex.getMessage()); }
        });
    }
    public YamlConfiguration messages() { return messages; }
    public YamlConfiguration webhooksConfig() { return webhooksConfig; }
    public YamlConfiguration chatFilterConfig() { return chatFilterConfig; }
    public YamlConfiguration reasonFile(Punishment.Type type) { return reasons[switch (type) { case BAN -> 0; case MUTE -> 1; case KICK -> 2; case WARNING -> 3; }]; }
    public PunishmentStore store() { return store; }
    public PunishmentService service() { return service; }
    public void send(org.bukkit.command.CommandSender sender, String key, Map<String, String> values) { Text.send(this, sender, key, values); }
    @Override public void onDisable() { if (store != null) store.close(); if (audit != null) audit.close(); if (webhooks != null) webhooks.close(); if (chatFilter != null) chatFilter.close(); configWriter.shutdown(); }
}