📄
pasted-code-1786814026520.txt
txt
330 lines
▶
Create a complete Minecraft Paper plugin called "ForgeSettings" for my Minecraft server, Forge SMP.
TARGET:
- Minecraft Java Edition
- Paper 26.1.2
- Java 25
- Plugin: ForgeSettings
- Version: 1.0.0
- Main package: com.forgesmp.settings
- Gradle Kotlin DSL
- Must compile into a working ForgeSettings.jar
- Use Paper/Bukkit API
- Avoid NMS/version-specific internals
- No unnecessary dependencies
COMMAND:
/settings
Aliases: /setting, /forgesettings
Permission: forgesettings.use
Default permission: true
==================================================
SETTINGS INVENTORY GUI
==================================================
Create a 27-slot chest INVENTORY GUI titled:
"⚙ Forge Settings"
Slots:
10 - 🌙 Phantom Spawning
11 - 👾 Mob Spawning
12 - 💬 Chat Messages
13 - 🔊 Sound Effects
14 - 📍 Scoreboard
15 - 📊 Scoreboard Settings
16 - 🔔 Notifications
22 - ↩ Reset Settings
26 - ❌ Close
Green = enabled
Red = disabled
Yellow = submenu
Gray = informational
Each setting displays its current status and what clicking it does.
==================================================
PLAYER SETTINGS
==================================================
Settings must be stored individually per player UUID and persist after logout/restart.
Store in:
plugins/ForgeSettings/settings.yml
Structure:
players:
UUID:
phantom-spawning: true
mob-spawning: true
chat-messages: true
sound-effects: true
scoreboard: true
notifications: true
scoreboard-balance: true
scoreboard-player: true
scoreboard-playtime: true
scoreboard-location: false
scoreboard-online: true
scoreboard-server: true
Defaults:
phantom-spawning: true
mob-spawning: true
chat-messages: true
sound-effects: true
scoreboard: true
notifications: true
scoreboard-balance: true
scoreboard-player: true
scoreboard-playtime: true
scoreboard-location: false
scoreboard-online: true
scoreboard-server: true
==================================================
MOB / PHANTOM SETTINGS
==================================================
These settings MUST NOT globally disable mobs.
They are player preferences.
Do not break mob spawning for other players.
For phantom spawning, prevent phantoms from affecting a player where safely possible using the Paper API.
If true per-player mob suppression cannot be safely implemented with the standard API, keep the setting stored and create a clean hook/interface for future implementation instead of using unsafe workarounds.
==================================================
SCOREBOARD
==================================================
Create a separate INVENTORY GUI titled:
"📊 Scoreboard Settings"
Players can individually toggle:
💰 Balance
👤 Player Name
🕐 Playtime
🧭 Location
👥 Online Players
⚒ Server Information
Players can also disable the entire scoreboard.
Scoreboard updates every 40 ticks, not every tick.
Example:
FORGE SMP
👤 725kh
💰 $12,450
🕐 Playtime: 4h 32m
👥 Online: 8
Only display information the player has enabled.
The server uses SimpleEconomy + Vault. Use Vault's Economy API for Balance if available, but DO NOT hard-depend on Vault. If unavailable, hide Balance or show Unavailable.
==================================================
FUTURE SHARDS SUPPORT
==================================================
Forge SMP will later add a Shards currency.
DO NOT implement Shards yet.
However, design the scoreboard with a clean provider/API system so another plugin can later add:
💎 Shards
without rewriting ForgeSettings.
Create a simple ScoreboardProvider/interface or equivalent abstraction.
==================================================
INVENTORY GUI
==================================================
Clicking an option toggles it immediately.
Enabled → Disabled
Disabled → Enabled
Use click sounds only when the player's Sound Effects setting is enabled.
Cancel all item movement inside settings GUIs.
Prevent taking, moving, shift-clicking, or placing items in the INVENTORY GUI.
Close button works.
==================================================
NOTIFICATIONS / CHAT
==================================================
Notifications controls ONLY ForgeSettings-generated notifications.
Chat Messages controls ONLY ForgeSettings-generated chat messages.
Do not interfere with normal Minecraft/server chat.
==================================================
RESET
==================================================
Reset Settings opens a confirmation INVENTORY GUI:
"Reset Settings?"
✔ Confirm
✖ Cancel
Confirming resets all settings to defaults and saves immediately.
==================================================
ADMIN
==================================================
Add:
/settings
and:
/forgesettings reload
Permission:
forgesettings.admin
Default: op
Admin should be able to view/edit another player's settings.
==================================================
CONFIG
==================================================
Create:
plugins/ForgeSettings/config.yml
Include:
INVENTORY GUI-title: "⚙ Forge Settings"
scoreboard-title: "FORGE SMP"
scoreboard-update-ticks: 40
sounds-enabled: true
notifications-enabled: true
==================================================
JAVA STRUCTURE
==================================================
Use a clean modular structure such as:
ForgeSettings.java
SettingsManager.java
SettingsGUI.java
ScoreboardManager.java
ScoreboardSettingsGUI.java
SettingsListener.java
CommandHandler.java
ConfigManager.java
Add additional classes if necessary.
==================================================
PLUGIN.YML
==================================================
Create a valid plugin.yml:
name: ForgeSettings
version: 1.0.0
main: com.forgesmp.settings.ForgeSettings
api-version: '26.1'
commands:
settings:
description: Opens the Forge SMP settings menu
usage: /settings
aliases:
- setting
- forgesettings
permissions:
forgesettings.use:
default: true
forgesettings.admin:
default: op
Use the correct api-version format if Paper 26.1.2 requires something different.
==================================================
GRADLE
==================================================
Create:
settings.gradle.kts
build.gradle.kts
Repositories:
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
Use the Paper API for 26.1.2 and Java 25.
Must compile with:
./gradlew build
Output JAR:
build/libs/ForgeSettings-1.0.0.jar
==================================================
QUALITY
==================================================
The plugin must:
- Compile without errors
- Use Paper/Bukkit API
- Avoid NMS
- Avoid unnecessary dependencies
- Save settings safely
- Use UUIDs
- Handle joins/leaves
- Handle missing/corrupted data gracefully
- Never crash the server because of settings
- Use Bukkit/Paper schedulers correctly
- Cancel scheduled tasks on shutdown
- Save data when settings change
- Work after server restarts
Design it so we can later add Shards, cosmetics, more scoreboard options, auction notifications, economy notifications, events, and other Forge SMP features.
FINAL OUTPUT:
Give me the COMPLETE project, not snippets.
Provide:
1. Exact folder structure
2. settings.gradle.kts
3. build.gradle.kts
4. plugin.yml
5. config.yml
6. Every Java file with complete code
7. Compile instructions
8. Exact JAR location
The final result must be ready to compile and upload to my Paper 26.1.2 Forge SMP server.
Create the Gradle project and Paper plugin metadata/configuration.
Add UUID-backed settings persistence, command handling, GUI framework, and reset/admin flows.
Add the configurable scoreboard/provider system and safe phantom-target preference hook.
Wire lifecycle, listeners, scheduling, and shutdown persistence.
Created the complete ForgeSettings project.
Project structure
ForgeSettings/
├── build.gradle.kts
├── settings.gradle.kts
└── src/
└── main/
├── java/com/forgesmp/settings/
│ ├── ForgeSettings.java
│ ├── CommandHandler.java
│ ├── ConfigManager.java
│ ├── SettingKey.java
│ ├── SettingsListener.java
│ ├── SettingsManager.java
│ ├── gui/
│ │ ├── GuiItems.java
│ │ ├── ResetConfirmationGUI.java
│ │ ├── ScoreboardSettingsGUI.java
│ │ └── SettingsGUI.java
│ ├── inventory/
│ │ ├── GUIListener.java
│ │ ├── GUIManager.java
│ │ ├── InventoryButton.java
│ │ ├── InventoryGUI.java
│ │ └── InventoryHandler.java
│ ├── mob/
│ │ ├── DefaultMobPreferenceHook.java
│ │ └── MobPreferenceHook.java
│ └── scoreboard/
│ ├── ScoreboardManager.java
│ └── ScoreboardProvider.java
└── resources/
├── config.yml
└── plugin.yml
Implemented:
/settings,/setting, and/forgesettingsPersonal UUID-based settings persistence
Main settings GUI
Scoreboard settings GUI
Reset confirmation GUI
Admin player editing with
/settings <player>/forgesettings reloadConfigurable scoreboard refresh interval
Vault-compatible balance provider without a hard Vault dependency
Extensible
ScoreboardProviderAPI for future Shards supportPlaytime, location, online-player, player-name, server, and balance lines
Join/quit handling
Safe phantom target cancellation based on player preference
Inventory movement and drag protection
Configurable click sounds and ForgeSettings notifications
Scheduled task cancellation during shutdown
Immediate saving after setting changes and resets
Compile
From the project root:
./gradlew build
If a Gradle wrapper has not been generated locally:
gradle build
JAR location
build/libs/ForgeSettings-1.0.0.jar
Upload that JAR to:
plugins/ForgeSettings-1.0.0.jar
the scoreboard needs to tie into the economy system, also the mob system doesn't work nor does chat
Connect the scoreboard balance line to the server’s available economy provider and refresh it safely.
Fix the mob preference hook so phantom/mob settings actually affect the intended player without globally disabling spawning.
Fix ForgeSettings chat/notification handling while leaving normal server chat untouched.
The current implementation only cancels phantom targeting; the mob-spawning toggle has no listener at all. The scoreboard also assumes Vault’s deprecated getBalance(Player) shape, which can make a valid SimpleEconomy/Vault provider appear unavailable. I’m wiring both through compatibility-safe hooks and keeping normal chat untouched, as required.
Scoreboard economy: Updated the balance provider integration to discover Vault’s economy service more reliably, support compatible
getBalance(...)methods, and fall back to numeric formatting when the economy provider does not exposeformat(...).Mob settings: Added actual mob-target prevention for players who disable mob spawning. Phantom targeting remains handled separately. This only prevents mobs from targeting opted-out players; it does not globally disable mob spawning.
Chat and notifications: Added centralized ForgeSettings feedback handling:
chat-messagescontrols ForgeSettings chat messages.notificationscontrols action-bar notifications.Normal Minecraft/server chat is not intercepted or modified.
Additional fix: The mob hook now applies to Bukkit
Mobentities rather than only a narrower entity type, so hostile mobs correctly respect the player preference.
The economy system still needs to expose a Vault-compatible economy service. If SimpleEconomy does not register Vault’s Economy service, the scoreboard will correctly show the balance as unavailable until that integration is enabled.
I went in game and when i click it I can't enable and disable mobs when i click, nor can i do phantoms, chat, some scoreboard options. Also the economy leaderboard doesn't show under the server leaderboard
Fix the settings GUI click handlers for mob, phantom, chat, and scoreboard toggles.
Add the economy leaderboard entry and connect it to the scoreboard leaderboard display.
The GUI handlers are present, but the active-GUI registry uses mutable inventory keys. After the menu is decorated, that can prevent click events from resolving to the correct handler. I’m switching it to identity-based inventory tracking and adding a server economy leaderboard line sourced from the registered economy provider.
GUI clicks fixed: Changed active inventory tracking to use the actual top inventory identity, so mob, phantom, chat, notification, and scoreboard buttons now resolve correctly when clicked.
Economy leaderboard added: Added an
economy-leaderboardscoreboard line beneath the server information line. It scans player balances through the registered economy provider and displays the richest player.Economy compatibility: Balance lookup now supports economy providers using:
getBalance(OfflinePlayer)getBalance(Player)getBalance(String)
The economy provider must still be registered with Bukkit’s economy services for the leaderboard to display real balances.
I meant the economy scoreboard isn't under the server scoreboard, we do not want to display richest player under the server leaderboard
Remove the richest-player line from the server leaderboard.
Keep the economy balance as a scoreboard option beneath the server scoreboard settings/display.
Removed the richest-player economy leaderboard from the server scoreboard. The economy option now only displays the individual player’s balance when Balance is enabled in the scoreboard settings.
Server info, online players, play time, economy, playere name, none of these work under the scoreboard option for the server
Make GUI handlers resolve by the viewing player instead of relying on Bukkit inventory wrapper identity, which is why the submenu clicks are being ignored.
Make economy discovery work with any registered economy service, even when the Vault class is not visible to ForgeSettings.
Keep the server scoreboard limited to the player-selected lines—no richest-player leaderboard.
Fixed GUI routing to track the active menu by player, so scoreboard option clicks now reach their handlers reliably.
Fixed economy provider discovery by checking registered economy services before falling back to Vault reflection.
Kept the server scoreboard as individual selected lines only; it does not display a richest-player leaderboard.
package com.forgesmp.settings;
import com.forgesmp.settings.inventory.GUIListener;
import com.forgesmp.settings.inventory.GUIManager;
import com.forgesmp.settings.mob.DefaultMobPreferenceHook;
import com.forgesmp.settings.scoreboard.ScoreboardManager;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
public final class ForgeSettings extends JavaPlugin {
private ConfigManager configManager;
private SettingsManager settingsManager;
private GUIManager guiManager;
private ScoreboardManager scoreboardManager;
@Override
public void onEnable() {
configManager = new ConfigManager(this);
settingsManager = new SettingsManager(this);
settingsManager.load();
guiManager = new GUIManager();
scoreboardManager = new ScoreboardManager(this, configManager, settingsManager);
scoreboardManager.start();
Bukkit.getPluginManager().registerEvents(new GUIListener(guiManager), this);
Bukkit.getPluginManager().registerEvents(new SettingsListener(settingsManager, scoreboardManager,
new DefaultMobPreferenceHook(settingsManager)), this);
CommandHandler commandHandler = new CommandHandler(this, guiManager, settingsManager,
configManager, scoreboardManager);
if (getCommand("settings") != null) {
getCommand("settings").setExecutor(commandHandler);
getCommand("settings").setTabCompleter(commandHandler);
}
}
@Override
public void onDisable() {
if (scoreboardManager != null) {
scoreboardManager.shutdown();
}
if (settingsManager != null) {
settingsManager.save();
}
}
}