Build a Complete Minecraft Plugin Called Mchat
Develop a complete, production-quality Minecraft plugin named Mchat for my Pixelia SMP server.
- Server Compatibility and Core Rules
- Server software: Paper 1.21.11.
- Java version: Java 21.
- Plugin name: Mchat.
- All player-facing text, GUI titles, item names, descriptions, error messages, and help text must be in Turkish.
- The plugin must be lightweight, reliable, and easy to maintain.
- Deliver the complete source project and a compiled, functional "Mchat.jar".
CRITICAL REQUIREMENT: DO NOT INTERFERE WITH NORMAL CHAT
Mchat must NOT replace, reformat, recolor, cancel, intercept, or otherwise modify the server's normal chat system.
Do not register a general chat formatter. Do not replace chat prefixes, suffixes, rank formatting, player names, or message formatting. Do not interfere with existing chat plugins.
Implement only the specific interactive features described below.
For recognized shortcuts, transform only the relevant shortcut into its configured interactive component while preserving the rest of the player's original message exactly as handled by the existing chat system.
For example, if a player writes:
"Hello everyone! [para]"
the normal chat system must continue to handle "Hello everyone!" exactly as before, and only "[para]" should become the configured clickable balance display.
If the existing chat API cannot safely support this without interfering with the normal chat pipeline, investigate the compatible Paper API and implement the least invasive solution. Do not silently introduce a custom chat formatter.
If a particular feature cannot be implemented without violating this requirement, document the limitation instead of breaking normal chat.
- Clean and Easy-to-Edit Project Structure
The project and configuration files must be organized vertically and logically. Do not put unrelated settings together in one enormous file.
Use a structure similar to this:
Mchat/ ├── pom.xml ├── src/ │ └── main/ │ ├── java/ │ │ └── .../ │ │ └── mchat/ │ │ ├── Mchat.java │ │ ├── commands/ │ │ │ └── HelpCommand.java │ │ ├── listeners/ │ │ │ ├── ShortcutListener.java │ │ │ └── PlayerInteractionListener.java │ │ ├── placeholders/ │ │ │ ├── BalanceProvider.java │ │ │ ├── CrystalProvider.java │ │ │ ├── PcProvider.java │ │ │ ├── PlaytimeProvider.java │ │ │ ├── TeamProvider.java │ │ │ └── ItemProvider.java │ │ ├── gui/ │ │ │ ├── InventoryViewGui.java │ │ │ └── ShulkerViewGui.java │ │ ├── integrations/ │ │ │ ├── VaultIntegration.java │ │ │ ├── PlaceholderApiIntegration.java │ │ │ ├── SimpleTeamsIntegration.java │ │ │ └── ShardsIntegration.java │ │ └── utils/ │ │ ├── TextFormatter.java │ │ └── DurationFormatter.java │ └── resources/ │ ├── plugin.yml │ ├── config.yml │ ├── messages.yml │ ├── shortcuts/ │ │ ├── item.yml │ │ ├── inventory.yml │ │ ├── balance.yml │ │ ├── crystal.yml │ │ ├── playtime.yml │ │ ├── team.yml │ │ ├── shulker.yml │ │ ├── pc.yml │ │ ├── server-address.yml │ │ └── website.yml │ └── gui/ │ ├── inventory.yml │ └── shulker.yml └── README.md
This is the intended organizational design, not a requirement to create empty classes. Implement each class only when it has a real responsibility.
Keep the code modular, readable, and consistently formatted. Each feature must have a clear place in the project.
Configuration principles
- All player-facing shortcut text and formatting must be editable in the corresponding file inside "shortcuts/".
- Inventory and shulker GUI titles, layouts, item names, descriptions, and filler items must be editable in their respective GUI files.
- General help and error messages belong in "messages.yml".
- Shared technical settings belong in "config.yml".
- Use direct configuration values rather than indirect localization keys when a direct value makes editing easier.
- Do not hardcode colors, message layouts, item names, or display strings in Java when they can be configured.
- Use clear YAML comments to explain each setting in Turkish.
- Preserve custom configuration values on restart and plugin updates.
- Automatically create missing default files without overwriting existing customized files.
Use a consistent supported formatting system, preferably MiniMessage through the Adventure API. Colors such as blue and green must be configurable. Do not use "&l" anywhere in generated user-facing text or configuration defaults.
- Shortcut: [i] — Held Item Display
When a player writes "[i]" in chat, replace that shortcut with a clickable display of the item they are currently holding.
Example:
"... 1x Odun"
The display must use the actual item name and quantity.
Requirements:
- If the held item has a custom display name, show that name.
- Otherwise, use a proper Turkish display name for the Minecraft material.
- Respect the actual stack amount.
- Provide a hover tooltip containing useful item information.
- If the player holds nothing, display "Air" exactly as requested.
- Do not send a separate informational chat message.
- Do not change unrelated text in the same chat message.
The display text, color, formatting, and hover information must be configurable in "shortcuts/item.yml".
- Shortcuts: [inv], [env], [e] — Inventory Viewer
All three aliases must work identically:
When used, display a clickable blue message in chat:
"OyuncuAdı oyuncusunun envanteri"
The player's name and the display text must be configurable in "shortcuts/inventory.yml".
Use blue as the default color, equivalent to Minecraft's "&b", but implement it through the chosen supported text-formatting system. Allow the color to be changed in the configuration file.
When another player clicks this display, open a GUI showing the target player's inventory contents.
Inventory GUI requirements
- GUI title and layout must be configurable in "gui/inventory.yml".
- Item positions and display options must be configurable.
- The GUI must accurately represent the target player's inventory.
- It must be strictly read-only.
- Players must not be able to take, move, replace, drop, or modify the displayed items.
- Closing the GUI must not change the target player's inventory.
- Prevent duplication exploits and inventory manipulation.
- Handle offline players safely and clearly.
Do not expose player UUIDs in any visible interface.
- Shortcuts: [para], [money], [p], [m] — Economy Balance
All aliases must display the player's current balance using Vault.
Example:
"... 4.1m Para"
Requirements:
- Obtain the actual balance from Vault's economy provider.
- Format large values compactly, such as "4.1m", "3.1k", and "950".
- Use consistent rounding rules.
- Do not modify, withdraw, deposit, or otherwise affect the player's balance.
- The display text and color must be configurable in "shortcuts/balance.yml".
- Use green as the default color.
- Handle missing Vault or a missing economy provider gracefully.
- Never display a fake balance or silently return zero when the economy provider is unavailable.
Do not implement a separate economy system.
- Shortcuts: [kristal], [k], [shard], [s] — Crystal Balance
All aliases must display the player's crystal balance.
The crystal system is provided by Skript and the XShards integration.
The configured PlaceholderAPI placeholder is:
"%xshards_playershards%"
Use PlaceholderAPI to resolve the crystal balance for the correct player.
Example:
"... 3.1k Kristal"
Requirements:
- Use the actual placeholder value.
- Format large values compactly.
- Never hardcode the example balance.
- Make the display label, color, formatting, and aliases configurable in "shortcuts/crystal.yml".
- Handle missing PlaceholderAPI or XShards gracefully.
- Do not alter the player's crystal balance.
If the placeholder cannot be resolved or returns an invalid value, handle the failure safely rather than displaying a misleading value.
- Shortcuts: [süre], [sure] — Playtime
Both aliases must display the player's total playtime.
Use the PlaceholderAPI ecosystem where possible, with a configurable placeholder.
Default example:
"... 5g 13h"
Requirements:
- Support compact day and hour formatting.
- The output color and display format must be configurable in "shortcuts/playtime.yml".
- Do not reset, alter, or fabricate player playtime.
- Ensure the placeholder represents the intended total playtime rather than the current session only.
- If the placeholder returns a raw number of seconds or ticks, convert it correctly according to the actual placeholder specification.
- Handle unavailable placeholders safely.
Do not assume every playtime placeholder uses the same unit. Verify the selected placeholder's actual return format before converting it.
- Shortcuts: [team], [t] — SimpleTeams
Both aliases must show the player's current team name.
The team plugin is SimpleTeams.
Example:
"... Pixelia"
Requirements:
- Integrate with the actual installed SimpleTeams API or a compatible, verified PlaceholderAPI placeholder.
- Do not invent API methods or assume a placeholder exists without checking.
- Do not confuse the team name with the player's Minecraft username.
- Make the output format and color configurable in "shortcuts/team.yml".
- If the player has no team, display a configurable Turkish fallback.
- If SimpleTeams is unavailable, fail gracefully.
- Shortcuts: [shulker], [shulkerbox] — Shulker Box Viewer
Both aliases must work.
When a player holds a shulker box and uses one of these shortcuts, display a clickable message similar to:
"OyuncuAdı oyuncusunun shulker kutusu"
When clicked, open a GUI displaying the contents of the shulker box currently held by that player.
Requirements:
- Support all relevant shulker box colors.
- Read the actual contents of the held shulker box.
- Configure the GUI title, layout, item presentation, and colors in "gui/shulker.yml".
- Configure the chat display in "shortcuts/shulker.yml".
- The GUI must be strictly read-only.
- Prevent item duplication, removal, swapping, insertion, and modification.
- Closing the GUI must not change the original shulker box.
- Handle the case where the player is not holding a shulker box with a configurable Turkish error message.
- Handle empty shulker boxes correctly.
- Do not display a UUID or expose internal item data.
Do not allow the displayed GUI to become a writable container.
- Shortcut: [pc] — Pixelia PC Currency
Display the player's PC balance using the existing PlaceholderAPI placeholder:
"%pixelia_pc%"
Example:
"... 125 PC"
Requirements:
- Use the actual placeholder value.
- Make the label, color, and compact-number formatting configurable in "shortcuts/pc.yml".
- Do not create a new PC currency or modify the existing balance.
- Handle unresolved placeholders safely.
- Do not assume the placeholder returns a number in a specific format without checking.
- Shortcut: [ip] — Server Address
When a player writes "[ip]", display this exact address:
"play.pixeliamc.com"
Requirements:
- The address must be configurable in "shortcuts/server-address.yml".
- Display it as a clickable chat component.
- When clicked, copy the address to the player's clipboard.
- Show a configurable Turkish hover tooltip.
- Do not open a browser when this shortcut is clicked.
- Do not send extra chat messages unless the configuration explicitly enables them.
- Shortcut: [web] — Website
When a player writes "[web]", display:
"www.pixeliamc.com"
Requirements:
- Make the URL configurable in "shortcuts/website.yml".
- Display the address as a clickable chat component.
- Clicking it must open the website in the player's browser using the supported Minecraft chat click event.
- Include a configurable hover tooltip.
- Validate the configured URL before using it.
- Do not execute commands or arbitrary actions when clicked.
- Clickable Player Names and Player Message Hover Information
This feature must work without replacing or reformatting the existing chat system.
Click behavior
When a player clicks another player's clickable name in chat, insert this command into their chat input:
"/msg PlayerName "
The command must be suggested, not automatically executed.
Use the equivalent of "SUGGEST_COMMAND", so the player can type their private message before pressing Enter.
Do not send the private message automatically.
Hover behavior
When a player hovers over another player's name or their chat message, display a configurable information tooltip containing that player's statistics.
The hover content must be configurable in a separate file, for example "player-hover.yml".
Possible information includes:
- Player name.
- Rank, if reliably available.
- Balance.
- Playtime.
- Team.
- PC balance.
- Crystal balance.
Requirements:
- Every displayed statistic must use the real value from the corresponding integration.
- Allow each hover line to be enabled, disabled, reordered, recolored, or edited in configuration.
- Never show UUIDs.
- Do not display "null", raw Java objects, or unresolved placeholder strings.
- Do not modify the actual chat text or formatting.
Important compatibility limitation: Standard Paper chat handling does not necessarily provide access to or control over every chat component produced by another chat plugin. Investigate the actual Paper 1.21.11 API and the server's existing chat pipeline. Do not install a second chat formatter or silently replace the existing one just to achieve hover and click behavior.
If the existing server chat pipeline cannot expose player-name hover and click events without interference, document exactly what is required to integrate with it safely.
- Help Command: /[help]
Register the requested command alias exactly as specified, subject to Minecraft command syntax validation.
The intended command is:
"/[help]"
The help interface must be in Turkish and list every supported shortcut and its purpose.
Example help content:
- "[i]" — Held item display.
- "[inv]", "[env]", "[e]" — View inventory.
- "[para]", "[money]", "[p]", "[m]" — View balance.
- "[kristal]", "[k]", "[shard]", "[s]" — View crystal balance.
- "[süre]", "[sure]" — View playtime.
- "[team]", "[t]" — View team.
- "[shulker]", "[shulkerbox]" — View shulker box.
- "[pc]" — View PC balance.
- "[ip]" — Copy server address.
- "[web]" — Open website.
Explain each shortcut in natural Turkish.
The help text must be configurable in "messages.yml".
Minecraft may not allow square brackets as part of a literal command name in the requested form. Verify command parsing and registration. If "/[help]" is not valid on Paper, provide a compatible command such as "/mchat help" and clearly document the limitation. Do not claim an invalid command works.
The bracketed expressions above are chat shortcuts, not necessarily actual commands.
- Placeholder and Alias Processing
Implement shortcut recognition carefully.
- Support all requested aliases exactly.
- Do not replace text inside unrelated words.
- Process recognized shortcuts as standalone tokens.
- Preserve punctuation and surrounding text.
- Do not trigger shortcuts inside quoted examples or longer words unless explicitly configured.
- Prevent accidental recursive processing.
- Ensure that one player's shortcut cannot expose another player's private information.
- Make alias definitions configurable where practical.
- Avoid excessive event processing and unnecessary synchronous operations.
If multiple aliases appear in one message, process all valid shortcuts correctly without breaking the message.
- Permissions and Security
Use configurable permissions with sensible defaults.
At minimum:
- Allow ordinary players to use public shortcut displays.
- Prevent viewers from modifying other players' inventories.
- Avoid exposing private information beyond the explicitly requested public balance, team, playtime, and item displays.
- Ensure that GUI clicks cannot manipulate another player's data.
- Validate player references and placeholder output.
- Do not expose UUIDs in messages, GUIs, tooltips, or help output.
Do not introduce unnecessary administrator permissions for basic public display features.
- Final Testing Requirements
Before delivering the plugin:
- Compile the entire project using Java 21.
- Fix all compilation errors.
- Verify compatibility with Paper 1.21.11.
- Check every shortcut and alias.
- Test empty hands for "[i]" and confirm that "Air" is displayed.
- Test actual Vault balance retrieval and compact number formatting.
- Test "%xshards_playershards%" and "%pixelia_pc%".
- Test SimpleTeams integration using its actual API or a verified placeholder.
- Test the inventory and shulker GUIs for item duplication and modification exploits.
- Verify that clickable names suggest "/msg PlayerName " without automatically sending it.
- Verify that the website opens and the server address copies correctly.
- Test that all GUI and message configurations are loaded and survive restarts.
- Confirm that ordinary chat formatting, prefixes, suffixes, ranks, and other chat plugins remain unchanged.
- Verify that no UUIDs appear in user-facing output.
- Do not claim that live-server tests were performed unless they actually were.
Deliverables
Provide:
- The complete source project.
- The compiled "Mchat.jar".
- All default configuration files.
- A concise Turkish installation guide.
- A Turkish explanation of every configuration file.
- A list of tested features and any unresolved integration limitations.
The final result must be a real, working plugin, not a mockup or incomplete code sample.
Highest priority: Never interfere with the existing chat system. Keep the source code and configuration files modular, sequential, readable, and easy to customize.