📄
pasted-code-1776794818800.txt
txt
67 lines
▶
📦 Plugin Specification: MaceTagCore
Author: _alex1709
Version: 1.0.0
Supported Minecraft Version: 1.21+
---
🔧 Features & Requirements
💬 Private Messaging System
A fully functional messaging system with reply support.
Commands:
- /msg
- /reply (automatically replies to last player)
- /reply (optional direct reply)
Aliases:
- /msg: /w /whisper /tell /t /message /dm
- /reply: /r /respond
Behavior:
- When a player receives a message, a configurable sound should play.
- Message formatting should be clean and customizable if possible.
---
🔊 Chat Sound System
- Whenever a player sends a message in public chat, all players hear a configurable sound.
- Chat formatting is handled by LPC plugin (no override needed).
---
🚪 Join & Leave Messages
- Disable default Minecraft join/leave messages.
- Replace with:
+ Player (join)
- Player (leave)
- Everything must be fully configurable.
---
⚠️ Command Error Sound
- If a player receives the message:
"This command does not exist." (from CommandWhitelist plugin)
- Then play a configurable sound only for that player.
- No direct integration needed, just detect the message.
---
🪂 Double Jump System (Lobby Only)
- Enabled only in the "lobby" world.
- Activated by pressing space twice.
Features:
- Custom trail effects while jumping.
- Sound effects:
- On double jump
- On landing
- Everything must be configurable.
---
⚙️ Configuration
- All sounds, messages, and effects must be configurable.
- Easy to edit without recompiling the plugin.
Let me plan all classes before writing:
MaceTagCore - Main plugin, holds all managers, registers all listeners/commands
ConfigManager - Loads and exposes all config values
MessageManager - Handles /msg and /reply logic, tracks last senders
ChatSoundListener - Listens to chat and plays sounds
JoinLeaveListener - Handles join/leave messages
CommandErrorListener - Detects error messages and plays sound
DoubleJumpManager - Tracks jump state per player
DoubleJumpListener - Handles double jump, trail, sound, landing
GUIManager + GUIListener + InventoryGUI + InventoryButton + InventoryHandler - Standard GUI framework (included for future use)
MsgCommand + ReplyCommand - Command executors
I need to redo the CommandErrorListener properly using Paper’s message receive event for 1.21+:
Here’s a summary of everything created:
MaceTagCore — Main plugin class wiring all managers and listeners
ConfigManager — Typed accessors for every config value
MessageManager —
/msgand/replylogic with last-sender tracking and sound playbackMsgCommand / ReplyCommand — Command executors with tab completion
ChatSoundListener — Plays a configurable sound to all online players on public chat
JoinLeaveListener — Suppresses vanilla messages, broadcasts custom join/leave, cleans up player data on leave
CommandErrorListener — Uses Paper’s
PlayerReceiveMessageEventto detect the configured error message string and play a sound to that player onlyDoubleJumpManager / DoubleJumpListener — Lobby-world-only double jump using flight toggle detection, configurable velocity, particle trail via
BukkitRunnable, configurable sounds on jump and landing, fall damage cancelled in lobbyGUI framework — Full
InventoryGUI,InventoryButton,GUIManager,GUIListenersystem included for future useplugin.yml — All commands and aliases registered
config.yml — Every feature fully configurable (sounds, messages, particles, physics, world name)
I forgot to mention that the plugin should also have minimessage support and hex support (#xxxxxx)
Now I have a complete picture of every file. Here’s my plan:
Create
ColorUtilthat converts&codes,#RRGGBB/&#RRGGBBhex, and MiniMessage tags →Componentvia Adventure APIReplace all private
colorize()string methods across every class withColorUtil.colorize()Switch all
sendMessage(String)/broadcastMessage(String)calls to theirComponentequivalentsFix
JoinLeaveListenerto use Paper 1.21 API (event.joinMessage(null),server.broadcast(Component))Properly implement
CommandErrorListenerusing Paper’sPlayerReceiveMessageEvent
Now I need to reconsider — AsyncChatEvent fires for player chat, not for system messages sent to the player. The real event we need is Paper’s PlayerReceiveMessageEvent which fires whenever a player receives any message. Let me fix that:
Now update config.yml to demonstrate MiniMessage support in the default values:
All changes implemented. Here’s a summary:
ColorUtil— New utility class that handles&legacy codes (case-insensitive),#RRGGBBbare hex,&#RRGGBBhex, and all MiniMessage tags (<gradient:...>,<rainbow>,<bold>, etc.), outputting an AdventureComponentMessageManager— Replaced privatecolorize()withColorUtil.colorize(), switched toplayer.sendMessage(Component)MsgCommand/ReplyCommand— Replaced privatecolorize()withColorUtil.colorize(), all feedback messages now sendComponentJoinLeaveListener— Replaced deprecatedsetJoinMessage(null)/setQuitMessage(null)withevent.joinMessage(null)/event.quitMessage(null), andbroadcastMessage(String)withserver.broadcast(Component)viaColorUtilCommandErrorListener— Properly implemented using Paper’sPlayerReceiveMessageEventto detect any message containing the configured error string and plays the sound only to that playerconfig.yml— Default values updated to use MiniMessage syntax to demonstrate the new support
About the feature below
⚠️ Command Error Sound
- If a player receives the message:
"This command does not exist." (from CommandWhitelist plugin)
- Then play a configurable sound only for that player.
- No direct integration needed, just detect the message.
please remove it from the code
and instead add this system:
- Whitelist commands
| The whitelisted commands should be added/removed from the config | If the player tries an unwhitelisted command from the config he gets an sound and a message with hex saying that that command does not exist | Also the whitelist commands appear in the tab complete or in / + tab, while the unwhitelisted commands dont appear anywhere | Also, group should exist, like helper will have other whitelisted commands, or admins. It will work by permission.
Also found a problem.
Please provide all the messages for example The ussage, You cannot message yourself so I can use them. Please add all of them that player receive and the console aswell please :)
Now I have a complete picture. Here’s my plan:
Delete
CommandErrorListener, createCommandWhitelistManager(loads groups + commands from config) andCommandWhitelistListener(PlayerCommandPreprocessEventto block +TabCompleteEventto filter tab)Fix
ColorUtilto actually handle&codes and#RRGGBB/&#RRGGBBhex by converting them to MiniMessage before deserializingAdd a full
messages:section toconfig.ymlcovering every player/console message, and expose getters inConfigManagerReplace hard-coded strings in
MsgCommandandReplyCommandwith config message lookups; remove dead privatecolorize()methods from bothUpdate
MaceTagCoreto register the new whitelist system and drop the old error listener
Here’s a summary of every change made:
Deleted: CommandErrorListener — the old “detect error string” approach is fully removed.
Created:
CommandWhitelistManager— loads groups fromcommand-whitelist.groupsin config; each group has apermissionand a list ofcommands. A player gets the union of every group they have permission for. Empty permission string = applies to everyone (thedefaultgroup).CommandWhitelistListener— listens onPlayerCommandPreprocessEventto cancel any command not on the player’s allowed list (plays the configured sound + sends the deny message), and onTabCompleteEventto strip any root completions (/+ tab) that aren’t on the allowed list, so unlisted commands never appear in tab.
Updated:
ColorUtil— now converts&#RRGGBBand bare#RRGGBBhex to<#RRGGBB>MiniMessage tags, and maps all&0–&f/&l/&o/&n/&m/&k/&rcodes to their MiniMessage equivalents before deserializing — so all three formats work everywhere.ConfigManager— removed oldcommand-errorgetters, addedgetCommandWhitelistSoundName()and getters for every player/console message (getConsoleOnly,getMsgUsage,getPlayerNotFound,getCannotMessageSelf,getReplyUsage,getNoReplyTarget,getCommandNotWhitelisted).MsgCommand/ReplyCommand— all hard-coded strings replaced withplugin.getCfg().getXxx()calls; dead privatecolorize()methods removed.MaceTagCore— registersCommandWhitelistManager+CommandWhitelistListener, drops the old error listener.config.yml— fullcommand-whitelistblock with example groups (default,helper,admin) and a completemessagesblock with every configurable string and inline comments.
Remove the /dm alias for the /msg command and add a reload command with configurable message
Remove
/dmfromplugin.ymlaliases and from the default whitelist group inconfig.ymlCreate
ReloadCommand.javawith permissionmacetagcore.reload, add its message toconfig.yml+ getter inConfigManagerRegister the reload command in
MaceTagCoreand declare it inplugin.yml
Done. Here’s what changed:
/dmremoved fromplugin.ymlaliases and from the default whitelist group inconfig.yml/macecore reload(alias/mcore reload) added — reloads the config and the command whitelist; requiresmacetagcore.reloadpermissionTwo new messages added to
config.ymlundermessages::no-permission— shown when someone lacksmacetagcore.reloadreload— shown on successful reload
Both new messages have corresponding getters (
getNoPermission(),getReloadMessage()) inConfigManager
the command for the reload should be /macetagcore reload
the command for the reload should be /macetagcore reload
The command is now /macetagcore reload — removed the [mcore] alias and updated the executor registration to match.
Could you make that the op players have bypass on the commandwhitelist feature?
OP players now bypass both the command block and the tab-complete filter — they can run and see every command regardless of whitelist groups.
I want to change every sound pitches and volumes through the config.
Here’s my plan:
Add
volumeandpitchsub-keys for every sound inconfig.ymlAdd getters for each volume/pitch pair in
ConfigManagerUpdate all listeners/managers to pass volume & pitch when playing sounds
Every sound now has sound-volume and sound-pitch keys in config.yml (defaulting to 1.0), with matching getters in ConfigManager and all play calls updated to pass those values.
add the commands /discord and /twitter where it will give a message (multi line) + sound, but it should be configurable in the config
if players fall from 3 blocks, more blocks below it will break but not until the end like will shatter
Plan:
Add
/discordand/twitteras a sharedSocialCommandclass (type-driven), each with configurable multi-line messages + sound inconfig.ymlAdd a
BlockShatterListenerthat fires on fall damage (≥ 3 blocks), breaks a configurable radius of blocks 1–2 layers deep below the player, stopping short of a full columnWire everything into
MaceTagCore,ConfigManager,plugin.yml, andconfig.yml
Done. Here’s a summary of what was added:
/discordand/twitter— each sends a configurable multi-line message list and plays a configurable sound; both fully set up inconfig.ymlunderdiscord:andtwitter:sectionsBlock shatter —
BlockShatterListenerfires on fall damage when fall distance ≥min-fall-distance(default 3), breaks ~65% of solid blocks randomly within a configurableradiusanddeptharound the landing block, giving a natural shattered look without clearing a full column; all three values are configurable underblock-shatter:inconfig.yml
nu ai inteles la block-shatter
block ul va crapa gen putin ca si cum l ai mina doar ca nu pana la sfarsit, si dupa cateva secunde dispare.
Deasemenea adauga si cooldown la comenzile respective gen /msg /r /discord etc.
you didn't understand about block-shatter:
- the block will crack a little like if you mine it but not all the way, and after a few seconds it disappears.
- Also add cooldown to the respective commands like /msg /r /discord etc.
- At /msg there should be 2 sounds, one that you received a message and another that you sent
- you didn't understand about block-shatter:
the block will crack a little like if you mine it but not all the way, and after a few seconds it disappears.
- Also add cooldown to the respective commands like /msg /r /discord etc.
- At /msg there should be 2 sounds, one that you received a message and another that you sent
Here’s my plan:
Block shatter: Use
Player#sendBlockDamageto animate cracks visually (sent to all nearby players) across configurable stages, then actually break the blocks at the end — no immediate dropsTwo msg sounds: Split
messaging.soundintosend-sound+receive-soundeach with volume/pitch in config and MessageManagerCooldowns: UUID→lastUsed map per command (
/msg,/reply,/discord,/twitter), durations configurable undercooldowns:in config with a configurable message
Here’s what changed:
Block shatter now uses
Player#sendBlockDamageto animate cracks visually through 9 stages (sent to all players within 48 blocks), and only actually breaks the blocks at the very end — configurable viashatter-duration-ticks(default 60 = 3 seconds)/msgsplit sounds:send-soundplays for the sender,receive-soundplays for the receiver — both fully configurable with volume/pitchCooldowns added to
/msg,/reply,/discord, and/twitter— durations set undercooldowns:in config, remaining time shown via the configurablemessages.cooldownmessage using{time}
The shatter should look like this, I jumped from high away and nothing happened
The issues are clear:
Blocks are being fully broken (
breakNaturally()) instead of just showing a crack animationThe crack should be radial — center = fully cracked, edges = lighter cracks
After a few seconds the animation just clears (blocks stay intact)
What changed:
No blocks are broken — purely visual crack animation, blocks stay intact
Radial intensity: center block gets the heaviest crack (~0.95), blocks at the edge get light cracks (~0.15), exactly like the image
Ramp + hold: cracks animate in over
shatter-duration-ticks, then hold at peak for the same duration, then cleanly disappear
nu se intampla nimci la block uri inca, sterge acest feature din cod cat si din config.
Deasemenea fa asa incat daca pun in config la orice sunet name AIR sa nu dea sunetu sau none si baga un # in config unde spui ca # if you put none/AIR the sound would'nt be played
Now I’ll read the files that play sounds to add the AIR/none skip logic.
Now patch all the remaining files:
Now add the silent-sound guard to all files that play sounds:
Finally, update config.yml — remove block-shatter and add the none/AIR comment above every sound key:
Done. Here’s what changed:
Block shatter fully removed —
BlockShatterListener.javadeleted, import and registration removed fromMaceTagCore, getters removed fromConfigManager, and theblock-shattersection removed fromconfig.ymlSilent sounds — every place that plays a sound now checks if the name is
noneorAIR(case-insensitive) before callingXSound.matchXSound, so it simply skips playback; every sound key inconfig.ymlnow has a# If you put none or AIR the sound won't be playedcomment above it
- so ill need a sound for the cooldown messages, like if someone gets the cooldown message a sound will play to him only that can be configurable
dont forget about the air/none thing
- also ill want a mace + wind charge practice in lobby map, if I change to other worlds the item will dissapear. The mace will be unbreakable in slot 0 and the wind charge in slot 1. The mace will be enchanted with wind burst III
The generation was stopped before any content could be produced.
A configurable sound should play whenever a player receives a cooldown message. This sound must be heard only by that player.
Add a practice system in the lobby world using a mace and wind charge:
- The items should only be available in the lobby; switching worlds removes them.
- Slot 0: Unbreakable mace enchanted with Wind Burst III.
- Slot 1: Wind charge with infinite usage.
When a player is hit, they should not take damage or be knocked back.
Let me read the remaining files I need:
Now I have everything. Plan:
Cooldown sound: add
cooldown-soundconfig entry + getters, play in all 3 command files when cooldown firesPracticeListener: give mace+wind charge on join/world-switch to lobby, remove on leave, cancel all damage in lobby, restore wind charge 1 tick after use, block dropping/moving practice items
Register
PracticeListenerinMaceTagCore
Now add getters to ConfigManager:
Add cooldown sound to MsgCommand:
Add cooldown sound to ReplyCommand:
Add cooldown sound to SocialCommand:
Now create the PracticeListener:
Register it in MaceTagCore:
Now write the PracticeListener:
Done. Here’s what changed:
Cooldown sound: added
cooldown-sound,cooldown-sound-volume,cooldown-sound-pitchtoconfig.ymlandConfigManager; all three command classes (MsgCommand,ReplyCommand,SocialCommand) now play it privately to the player when a cooldown message fires, respecting thenone/AIRskip rulePractice system (
PracticeListener): players in the configuredpractice.worldreceive an unbreakable Mace enchanted with Wind Burst III in slot 0 and a Wind Charge in slot 1; switching worlds removes the items; wind charge is restored 1 tick after being thrown for infinite use; all incoming damage + knockback to players in the practice world is cancelled; dropping or moving the items via inventory is blocked
nu mi o dat maceu si windchargeu in lobby nu stiu de ce
Two issues:
In
onJoin, items are given immediately before the player’s inventory is fully loaded — they need a 1-tick delayXEnchantmentuses.getEnchant()but in newer XSeries it’s.get()— if that fails silently the mace still won’t be given properly during the exception
Three fixes applied to PracticeListener:
onJoindelayed by 1 tick (runTask) — items are now given after the player’s inventory is fully initialized, not mid-joine.getEnchant()→e.get()— correct XSeries method forXEnchantment, prevents a silent crash that would abortbuildMace()entirelyisMacecomparison cleaned up so it safely handles the Optional the same wayisWindChargealready didRemoved the unused
import org.bukkit.enchantments.Enchantmentandjava.util.Optional
So, the players cant be hit at all, and can you make that wind charges doesnt push the players aswell? only the attacker, I mean the one that only uses the wind charge?
I can see two issues to fix:
Mace hits — currently the whole
EntityDamageByEntityEventis cancelled, which kills the Wind Burst self-launch on the attacker. Instead, set damage to 0 and reset the victim’s velocity 1 tick later so Wind Burst still fires for the attacker.Wind charge blast — track each wind charge’s shooter; cancel explosion damage/knockback only on players who are not the shooter.
Here’s what changed in PracticeListener:
Mace hits — instead of cancelling the event (which killed Wind Burst), damage is set to
0and the victim’s velocity is restored 1 tick later. The attacker’s Wind Burst self-launch fires normally.Wind charge projectile tracking —
ProjectileLaunchEventstores eachWindChargeentity UUID → shooter UUID in a map.Wind charge direct hit (
EntityDamageByEntityEventwhere damager isWindCharge) — cancelled for non-shooters, allowed for self-hits (the shooter getting their own boost).Wind charge blast radius (
EntityDamageEventwithENTITY_EXPLOSION) — cancelled for any player in the practice world who is not the shooter of a tracked wind charge, so bystanders don’t get pushed.
package com.mace.macetagcore;
import com.mace.macetagcore.commandwhitelist.CommandWhitelistListener;
import com.mace.macetagcore.commandwhitelist.CommandWhitelistManager;
import com.mace.macetagcore.commands.MsgCommand;
import com.mace.macetagcore.commands.ReloadCommand;
import com.mace.macetagcore.commands.ReplyCommand;
import com.mace.macetagcore.commands.SocialCommand;
import com.mace.macetagcore.config.ConfigManager;
import com.mace.macetagcore.doublejump.DoubleJumpListener;
import com.mace.macetagcore.doublejump.DoubleJumpManager;
import com.mace.macetagcore.inventory.gui.GUIListener;
import com.mace.macetagcore.inventory.gui.GUIManager;
import com.mace.macetagcore.listeners.ChatSoundListener;
import com.mace.macetagcore.listeners.JoinLeaveListener;
import com.mace.macetagcore.messaging.MessageManager;
import com.mace.macetagcore.practice.PracticeListener;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
public class MaceTagCore extends JavaPlugin {
@Getter private static MaceTagCore instance;
@Getter private ConfigManager cfg;
@Getter private MessageManager messageManager;
@Getter private DoubleJumpManager doubleJumpManager;
@Getter private GUIManager guiManager;
@Getter private CommandWhitelistManager commandWhitelistManager;
@Override
public void onEnable() {
instance = this;
saveDefaultConfig();
this.cfg = new ConfigManager(this);
this.messageManager = new MessageManager(this);
this.doubleJumpManager = new DoubleJumpManager(this);
this.guiManager = new GUIManager();
this.commandWhitelistManager = new CommandWhitelistManager(this);
getServer().getPluginManager().registerEvents(new GUIListener(guiManager), this);
getServer().getPluginManager().registerEvents(new ChatSoundListener(this), this);
getServer().getPluginManager().registerEvents(new JoinLeaveListener(this), this);
getServer().getPluginManager().registerEvents(new CommandWhitelistListener(this), this);
getServer().getPluginManager().registerEvents(new DoubleJumpListener(this), this);
getServer().getPluginManager().registerEvents(new PracticeListener(this), this);
MsgCommand msgCommand = new MsgCommand(this);
ReplyCommand replyCommand = new ReplyCommand(this);
getCommand("msg").setExecutor(msgCommand);
getCommand("msg").setTabCompleter(msgCommand);
getCommand("reply").setExecutor(replyCommand);
getCommand("reply").setTabCompleter(replyCommand);
ReloadCommand reloadCommand = new ReloadCommand(this);
getCommand("macetagcore").setExecutor(reloadCommand);
SocialCommand discordCommand = new SocialCommand(this, SocialCommand.Type.DISCORD);
SocialCommand twitterCommand = new SocialCommand(this, SocialCommand.Type.TWITTER);
getCommand("discord").setExecutor(discordCommand);
getCommand("twitter").setExecutor(twitterCommand);
}
@Override
public void onDisable() {
instance = null;
}
}