Saphal-1

Create a complete, production-ready Paper Minecraft 1.21.11 plugin that integrates the Minecraft server with Discord using webhooks.

Plugin Name

SaphaL Discord Bridge

Main Requirements

  1. Minecraft Survival Chat → Discord
  • Send all survival/server chat messages to a configurable Discord webhook.
  • Format should be attractive and customizable.
  • Example:

"💬 SaphaL | PlayerName: Hello everyone!"

  • Support Minecraft color codes where appropriate.
  • Discord webhook username should default to SaphaL.
  • Webhook avatar should be configurable through "config.yml".
  1. Console → Discord
  • Send Minecraft console/server logs to a separate Discord webhook.
  • Make the console webhook configurable.
  • Avoid excessive spam where possible.
  • Include useful events such as:

- Server startup/shutdown - Player join/leave - Important warnings/errors - Console commands, if configurable

  • Console webhook should use the configured SaphaL name and avatar.
  1. "/set" Command

Create a command:

"/set <name> [x] [y] [z]"

Behavior:

  • "/set <name>" → automatically use the player's current coordinates.
  • "/set <name> <x> <y> <z>" → use the coordinates provided by the player.
  • Include the following information in the Discord webhook:

- Set name - Player name - World - X, Y, Z coordinates - Timestamp

  • Send the information to a dedicated configurable Discord webhook/channel.
  • Add permission:

"saphal.set"

  • Add tab completion where possible.
  • Example Discord message:

📍 New Location Set

- Name: spawn - Player: SaphaL - World: world - Coordinates: "125, 72, -340"

  1. Anti-Swear System

Implement a configurable anti-swear system.

Requirements:

  • Detect configurable banned/swear words.
  • Remove or replace the detected word from the player's Minecraft message.
  • Prevent the original offensive word from appearing in normal chat.
  • Send a log to a separate Discord webhook.
  • Discord log should contain:

- Player name - Original message - Detected word(s) - Date/time

  • Make the replacement configurable, for example:

"****", "[censored]", or another configured replacement.

  • Banned words must be stored in a separate configurable file such as:

"banned-words.yml"

  • Do NOT hard-code the word list into Java source code.
  • Add an option to enable/disable the anti-swear system.
  1. Discord Webhook Configuration

All webhook URLs must be configurable.

Create separate webhook settings for:

webhooks: chat: "YOUR_CHAT_WEBHOOK" console: "YOUR_CONSOLE_WEBHOOK" set: "YOUR_SET_WEBHOOK" antiswear: "YOUR_ANTISWEAR_WEBHOOK" status: "YOUR_STATUS_WEBHOOK"

The administrator must be able to change these URLs directly in "config.yml" without modifying the plugin source code.

Webhook Username & Avatar

Default webhook name:

"SaphaL"

Add:

webhook: username: "SaphaL" avatar-url: "https://example.com/avatar.png"

The avatar URL must be completely configurable.

If the avatar URL is empty, allow Discord's default webhook avatar behavior.

  1. Server Status System

Create an attractive Discord status system.

Send/update server status through the configured "status" webhook.

Display information such as:

  • 🟢 Server Online
  • 👥 Online players / maximum players
  • 🌍 Server/world information
  • ⏱️ Server uptime
  • ⚡ TPS
  • 📡 Server IP
  • 🎮 Minecraft version
  • 📊 Player list

Example:

🟢 SERVER ONLINE

«🎮 Minecraft: 1.21.11 👥 Players: 12/50 ⚡ TPS: 20.0 ⏱️ Uptime: 2h 34m 🌐 IP: play.example.com»

Make the status message update automatically at a configurable interval.

Example:

status: enabled: true update-interval-seconds: 60

Avoid creating a new Discord message every update if possible. Prefer editing/updating one existing status message.

Store the Discord status message ID locally so it can be updated after restarts.

  1. Attractive & Customizable Discord Formatting

Use Discord embeds wherever appropriate.

Allow customization of:

  • Embed title
  • Description
  • Footer
  • Timestamp
  • Username
  • Avatar
  • Status text
  • Field names
  • Field values

Use placeholders such as:

"%player%" "%message%" "%world%" "%x%" "%y%" "%z%" "%online%" "%max_players%" "%tps%" "%uptime%" "%server_ip%" "%version%"

  1. Configuration

Create a clean "config.yml" with comments explaining every option.

Example structure:

webhook: username: "SaphaL" avatar-url: "https://example.com/avatar.png"

webhooks: chat: "YOUR_CHAT_WEBHOOK" console: "YOUR_CONSOLE_WEBHOOK" set: "YOUR_SET_WEBHOOK" antiswear: "YOUR_ANTISWEAR_WEBHOOK" status: "YOUR_STATUS_WEBHOOK"

features: chat: true console: true set-command: true antiswear: true status: true

status: enabled: true update-interval-seconds: 60

antiswear: enabled: true replacement: "[censored]" log-original-message: true

set-command: permission: "saphal.set"

  1. Commands

Implement:

"/set <name> [x] [y] [z]"

Optional administration command:

"/saphal reload"

Permission:

"saphal.admin"

The reload command should reload configuration files without requiring a server restart.

  1. Technical Requirements
  • Target Paper 1.21.11.
  • Use Java compatible with the required Paper 1.21.11 runtime.
  • Use a proper Gradle or Maven project.
  • Use Paper API.
  • Use asynchronous HTTP requests for Discord webhook communication so Discord requests never freeze the Minecraft main thread.
  • Properly handle webhook failures, invalid URLs, rate limits, timeouts, and Discord API errors.
  • Do not crash the server if a webhook is unavailable.
  • Log useful errors to the console.
  • Use clean, modular Java classes.
  • Avoid blocking operations on the main server thread.
  • Prevent webhook spam where appropriate.
  • Properly escape Discord Markdown and user-generated content.
  • Validate configuration values.
  • Use secure configuration practices and never expose webhook URLs in normal server messages.
  1. Project Output

Generate the complete plugin project, including:

  • "build.gradle" or "pom.xml"
  • "plugin.yml"
  • "config.yml"
  • "banned-words.yml"
  • Complete Java source code
  • All required classes
  • Event listeners
  • Commands
  • Discord webhook manager
  • Status manager
  • Anti-swear manager
  • Configuration manager
  • README with installation and configuration instructions

The final result should compile successfully into a ".jar" and be ready to place inside the Paper server's "plugins/" folder.

Prioritize stability, performance, clean code, easy configuration, attractive Discord embeds, and Paper 1.21.11 compatibility.

Kodari AI
KodariAug 17 at 2:47 am 2
SaphaLDiscordBridge
A Paper 1.21.11 Minecraft plugin that bridges server chat, console logs, player-set locations, and anti-swear filtering to Discord via configurable webhooks. Features include customizable Discord embeds with placeholders, a /set command for saving coordinates, automatic server status updates with message editing, and a configurable anti-swear system with banned words stored in a separate YAML file. All webhooks, usernames, avatars, and features are configurable through config.yml, with asynchronous HTTP requests to prevent server lag.
  1. Build the Gradle/Paper project and default configuration files.

  2. Add modular webhook, formatting, anti-swear, status, command, and event components.

  3. Register permissions, commands, lifecycle hooks, and provide installation/configuration documentation.

Created the complete SaphaL Discord Bridge Paper 1.21.11 project with:

  • Gradle build targeting Java 21 and Paper 1.21.11

  • Configurable Discord webhooks for chat, console, /set, anti-swear, and status

  • Asynchronous Discord HTTP requests with timeout, validation, retry, and rate-limit handling

  • Editable persistent Discord server-status message

  • /set <name> [x] [y] [z] command with permissions and tab completion

  • Configurable anti-swear filtering using banned-words.yml

  • Player join/leave, startup/shutdown, and optional command logging

  • Discord embeds with configurable formatting and placeholders

  • /saphal reload

  • plugin.yml, config.yml, banned-words.yml, Java source, Gradle files, and README instructions

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
README.md
settings.gradle
Code
19 1,159
src/main/java/com/saphal/discordbridge/SaphaLDiscordBridge.java
package com.saphal.discordbridge;

import com.saphal.discordbridge.command.SaphaLCommand;
import com.saphal.discordbridge.command.SetCommand;
import com.saphal.discordbridge.config.ConfigurationManager;
import com.saphal.discordbridge.discord.DiscordWebhookManager;
import com.saphal.discordbridge.format.MessageFormatter;
import com.saphal.discordbridge.listener.ChatListener;
import com.saphal.discordbridge.listener.ServerListener;
import com.saphal.discordbridge.moderation.AntiSwearManager;
import com.saphal.discordbridge.status.StatusManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public final class SaphaLDiscordBridge extends JavaPlugin {
    private ConfigurationManager configurationManager;
    private DiscordWebhookManager webhookManager;
    private MessageFormatter messageFormatter;
    private AntiSwearManager antiSwearManager;
    private StatusManager statusManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("banned-words.yml", false);

        configurationManager = new ConfigurationManager(this);
        webhookManager = new DiscordWebhookManager(this);
        messageFormatter = new MessageFormatter(configurationManager);
        antiSwearManager = new AntiSwearManager(this, configurationManager, webhookManager, messageFormatter);
        statusManager = new StatusManager(this, configurationManager, webhookManager, messageFormatter);

        Bukkit.getPluginManager().registerEvents(
                new ChatListener(configurationManager, webhookManager, messageFormatter, antiSwearManager), this);
        Bukkit.getPluginManager().registerEvents(
                new ServerListener(configurationManager, webhookManager, messageFormatter), this);

        SetCommand setCommand = new SetCommand(configurationManager, webhookManager, messageFormatter);
        if (getCommand("set") != null) {
            getCommand("set").setExecutor(setCommand);
            getCommand("set").setTabCompleter(setCommand);
        }
        SaphaLCommand adminCommand = new SaphaLCommand(this);
        if (getCommand("saphal") != null) {
            getCommand("saphal").setExecutor(adminCommand);
            getCommand("saphal").setTabCompleter(adminCommand);
        }

        webhookManager.sendConsole("Server startup", "SaphaL Discord Bridge is enabled.");
        statusManager.start();
        getLogger().info("SaphaL Discord Bridge enabled.");
    }

    @Override
    public void onDisable() {
        if (statusManager != null) {
            statusManager.sendOffline();
            statusManager.stop();
        }
        if (webhookManager != null) {
            webhookManager.sendConsole("Server shutdown", "SaphaL Discord Bridge is shutting down.");
        }
    }

    public void reloadPlugin() {
        configurationManager.reload();
        antiSwearManager.reload();
        statusManager.restart();
    }
}