Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public DummyCommand(@NotNull String name, @NotNull final String blockMessage) {
*/
@Override
public boolean execute(@NotNull CommandSender commandSender, @NotNull String s, @NotNull String[] strings) {
ChatUtils.chat(commandSender, blockMessage);
// Replaces the {command} placeholder with the command that was run (without the leading '/').
final String message = blockMessage.replace("{command}", s);
ChatUtils.chat(commandSender, message);
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public void onCommandSend(@NotNull final PlayerCommandPreprocessEvent event) {

// Display the block message is the rule has one.
if(rule.hasBlockMessage()) {
ChatUtils.chat(player, rule.getBlockMessage());
// Replaces the {command} placeholder with the command that was blocked (without the leading '/').
final String blockMessage = rule.getBlockMessage().replace("{command}", command.replaceFirst("^/", ""));
ChatUtils.chat(player, blockMessage);
}

// Play the block sound if the rule has one.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# The message sent to a player when a command is blocked.
# Can be overridden by adding this setting to each rule.
# Supports legacy color codes, but you should be using MiniMessage instead (https://docs.advntr.dev/minimessage/format.html).
# Supports the {command} placeholder, which is replaced with the command that was blocked, without the leading '/' (ex: help).
blockMessage: "<red><bold>Error</bold> <dark_gray>» <red>You do not have access to that command."

# Defines different rules that can be enforced when determining when to block or hide commands.
Expand Down