From 48fbd59a50323852ed52dd0d397bd3c7cc7f1016 Mon Sep 17 00:00:00 2001 From: YouHaveTrouble Date: Sun, 24 Oct 2021 19:51:22 +0200 Subject: [PATCH] do not parse markdown for messages --- CommandWhitelistBukkit/pom.xml | 2 +- .../bukkit/CommandWhitelistBukkit.java | 4 ++-- .../bukkit/command/MainCommandExecutor.java | 15 +++++++-------- .../PlayerCommandPreProcessListener.java | 6 +++--- .../PacketCommandPreProcessListener.java | 6 +++--- .../src/main/resources/plugin.yml | 7 ++++--- CommandWhitelistCommon/pom.xml | 2 +- .../common/commands/CWCommand.java | 13 ++++++++++++- CommandWhitelistVelocity/pom.xml | 2 +- .../velocity/CommandWhitelistVelocity.java | 4 ++-- .../velocity/command/VelocityMainCommand.java | 15 +++++++-------- CommandWhitelistWaterfall/pom.xml | 2 +- .../waterfall/CommandWhitelistWaterfall.java | 3 ++- .../waterfall/command/BungeeMainCommand.java | 15 +++++++-------- .../listeners/BungeeChatEventListener.java | 5 +++-- pom.xml | 2 +- 16 files changed, 57 insertions(+), 46 deletions(-) diff --git a/CommandWhitelistBukkit/pom.xml b/CommandWhitelistBukkit/pom.xml index c6599bc..01c2306 100644 --- a/CommandWhitelistBukkit/pom.xml +++ b/CommandWhitelistBukkit/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.0 + 2.2.1 Bukkit diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/CommandWhitelistBukkit.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/CommandWhitelistBukkit.java index d2d759d..4470ac2 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/CommandWhitelistBukkit.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/CommandWhitelistBukkit.java @@ -6,8 +6,8 @@ import eu.endermite.commandwhitelist.bukkit.listeners.protocollib.PacketCommandSendListener; import eu.endermite.commandwhitelist.common.CWGroup; import eu.endermite.commandwhitelist.common.ConfigCache; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import net.kyori.adventure.text.minimessage.MiniMessage; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -79,7 +79,7 @@ public void reloadPluginConfig(CommandSender sender) { for (Player p : Bukkit.getOnlinePlayers()) { p.updateCommands(); } - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.config_reloaded)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.config_reloaded)); }); } diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/command/MainCommandExecutor.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/command/MainCommandExecutor.java index 75d4465..560b38f 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/command/MainCommandExecutor.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/command/MainCommandExecutor.java @@ -5,7 +5,6 @@ import eu.endermite.commandwhitelist.common.commands.CWCommand; import net.kyori.adventure.platform.bukkit.BukkitAudiences; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -31,34 +30,34 @@ public boolean onCommand(CommandSender sender, Command command, String label, St switch (commandType) { case RELOAD: if (!sender.hasPermission(CWPermission.RELOAD.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); return true; } CommandWhitelistBukkit.getPlugin().reloadPluginConfig(sender); return true; case ADD: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); return true; } if (args.length == 3) { if (CWCommand.addToWhitelist(CommandWhitelistBukkit.getConfigCache(), args[2], args[1])) - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().added_to_whitelist, args[2], args[1]))); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().added_to_whitelist, args[2], args[1]))); else - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().group_doesnt_exist, args[1]))); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().group_doesnt_exist, args[1]))); } else audiences.sender(sender).sendMessage(Component.text("/" + label + " add ")); return true; case REMOVE: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().no_permission)); return true; } if (args.length == 3) { if (CWCommand.removeFromWhitelist(CommandWhitelistBukkit.getConfigCache(), args[2], args[1])) - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().removed_from_whitelist, args[2], args[1]))); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().removed_from_whitelist, args[2], args[1]))); else - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().group_doesnt_exist, args[1]))); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistBukkit.getConfigCache().prefix + CommandWhitelistBukkit.getConfigCache().group_doesnt_exist, args[1]))); } else audiences.sender(sender).sendMessage(Component.text("/" + label + " remove ")); return true; diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java index 748abdb..96006cd 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/PlayerCommandPreProcessListener.java @@ -3,8 +3,8 @@ import eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit; import eu.endermite.commandwhitelist.common.CommandUtil; import eu.endermite.commandwhitelist.common.ConfigCache; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import net.kyori.adventure.platform.bukkit.BukkitAudiences; -import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -24,7 +24,7 @@ public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreproce HashSet commands = CommandWhitelistBukkit.getCommands(player); if (!commands.contains(label)) { event.setCancelled(true); - audiences.player(player).sendMessage(MiniMessage.markdown().parse(config.prefix + config.command_denied)); + audiences.player(player).sendMessage(CWCommand.miniMessage.parse(config.prefix + config.command_denied)); return; } @@ -32,7 +32,7 @@ public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreproce for (String bannedSubCommand : bannedSubCommands) { if (event.getMessage().toLowerCase().substring(1).startsWith(bannedSubCommand)) { event.setCancelled(true); - audiences.player(player).sendMessage(MiniMessage.markdown().parse(config.prefix + config.subcommand_denied)); + audiences.player(player).sendMessage(CWCommand.miniMessage.parse(config.prefix + config.subcommand_denied)); return; } } diff --git a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/protocollib/PacketCommandPreProcessListener.java b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/protocollib/PacketCommandPreProcessListener.java index 09e0d34..2ba481b 100644 --- a/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/protocollib/PacketCommandPreProcessListener.java +++ b/CommandWhitelistBukkit/src/main/java/eu/endermite/commandwhitelist/bukkit/listeners/protocollib/PacketCommandPreProcessListener.java @@ -11,7 +11,7 @@ import eu.endermite.commandwhitelist.common.CWPermission; import eu.endermite.commandwhitelist.common.CommandUtil; import eu.endermite.commandwhitelist.common.ConfigCache; -import net.kyori.adventure.text.minimessage.MiniMessage; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -39,7 +39,7 @@ public void onPacketReceiving(PacketEvent event) { HashSet commands = CommandWhitelistBukkit.getCommands(player); if (!commands.contains(label)) { event.setCancelled(true); - CommandWhitelistBukkit.getAudiences().player(player).sendMessage(MiniMessage.markdown().parse(config.prefix + config.command_denied)); + CommandWhitelistBukkit.getAudiences().player(player).sendMessage(CWCommand.miniMessage.parse(config.prefix + config.command_denied)); return; } @@ -47,7 +47,7 @@ public void onPacketReceiving(PacketEvent event) { for (String bannedSubCommand : bannedSubCommands) { if (string.toLowerCase().substring(1).startsWith(bannedSubCommand)) { event.setCancelled(true); - CommandWhitelistBukkit.getAudiences().player(player).sendMessage(MiniMessage.markdown().parse(config.prefix + config.subcommand_denied)); + CommandWhitelistBukkit.getAudiences().player(player).sendMessage(CWCommand.miniMessage.parse(config.prefix + config.subcommand_denied)); return; } } diff --git a/CommandWhitelistBukkit/src/main/resources/plugin.yml b/CommandWhitelistBukkit/src/main/resources/plugin.yml index e99b5dc..cf77d4c 100644 --- a/CommandWhitelistBukkit/src/main/resources/plugin.yml +++ b/CommandWhitelistBukkit/src/main/resources/plugin.yml @@ -4,6 +4,7 @@ version: ${project.version} api-version: 1.13 main: eu.endermite.commandwhitelist.bukkit.CommandWhitelistBukkit authors: [YouHaveTrouble] +website: youhavetrouble.me softdepend: - ProtocolLib description: Control what commands players can use @@ -14,8 +15,8 @@ commands: usage: /commandwhitelist [args] permissions: commandwhitelist.reload: - default: OP + default: op commandwhitelist.admin: - default: OP + default: op commandwhitelist.bypass: - default: OP \ No newline at end of file + default: op \ No newline at end of file diff --git a/CommandWhitelistCommon/pom.xml b/CommandWhitelistCommon/pom.xml index d6d4be1..26bd669 100644 --- a/CommandWhitelistCommon/pom.xml +++ b/CommandWhitelistCommon/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.0 + 2.2.1 Common diff --git a/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/commands/CWCommand.java b/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/commands/CWCommand.java index e773d13..1330f7e 100644 --- a/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/commands/CWCommand.java +++ b/CommandWhitelistCommon/src/main/java/eu/endermite/commandwhitelist/common/commands/CWCommand.java @@ -5,6 +5,7 @@ import net.kyori.adventure.text.Component; import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.transformation.TransformationType; import java.util.ArrayList; import java.util.Collection; @@ -12,6 +13,16 @@ public class CWCommand { + public static MiniMessage miniMessage = MiniMessage.builder() + .removeDefaultTransformations() + .transformation(TransformationType.COLOR) + .transformation(TransformationType.DECORATION) + .transformation(TransformationType.GRADIENT) + .transformation(TransformationType.RESET) + .transformation(TransformationType.RAINBOW) + .transformation(TransformationType.PRE) + .build(); + public static boolean addToWhitelist(ConfigCache configCache, String command, String group) { CWGroup cwGroup = configCache.getGroupList().get(group); if (cwGroup == null) return false; @@ -30,7 +41,7 @@ public static boolean removeFromWhitelist(ConfigCache configCache, String comman } public static Component helpComponent(String baseCommand, boolean showReloadCommand, boolean showAdminCommands) { - Component component = MiniMessage.markdown().parse("CommandWhitelist by YouHaveTrouble") + Component component = miniMessage.parse("CommandWhitelist by YouHaveTrouble") .append(Component.newline()); component = component.append(Component.text("/" + baseCommand + " help").color(NamedTextColor.AQUA).append(Component.text(" - Displays this message").color(NamedTextColor.BLUE))); if (showReloadCommand) { diff --git a/CommandWhitelistVelocity/pom.xml b/CommandWhitelistVelocity/pom.xml index 35247ef..cdeeead 100644 --- a/CommandWhitelistVelocity/pom.xml +++ b/CommandWhitelistVelocity/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.0 + 2.2.1 Velocity diff --git a/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/CommandWhitelistVelocity.java b/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/CommandWhitelistVelocity.java index cdfb8dc..62201d3 100644 --- a/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/CommandWhitelistVelocity.java +++ b/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/CommandWhitelistVelocity.java @@ -12,9 +12,9 @@ import eu.endermite.commandwhitelist.common.CWGroup; import eu.endermite.commandwhitelist.common.CWPermission; import eu.endermite.commandwhitelist.common.ConfigCache; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import eu.endermite.commandwhitelist.velocity.command.VelocityMainCommand; import net.kyori.adventure.identity.Identity; -import net.kyori.adventure.text.minimessage.MiniMessage; import org.bstats.charts.SimplePie; import org.bstats.velocity.Metrics; import org.slf4j.Logger; @@ -55,7 +55,7 @@ private static void reloadConfig() { public static void reloadConfig(CommandSource source) { server.getScheduler().buildTask(plugin, () -> { reloadConfig(); - source.sendMessage(Identity.nil(), MiniMessage.markdown().parse(getConfigCache().prefix+getConfigCache().config_reloaded)); + source.sendMessage(Identity.nil(), CWCommand.miniMessage.parse(getConfigCache().prefix+getConfigCache().config_reloaded)); }).schedule(); } diff --git a/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/command/VelocityMainCommand.java b/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/command/VelocityMainCommand.java index f8dd98b..bd382e1 100644 --- a/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/command/VelocityMainCommand.java +++ b/CommandWhitelistVelocity/src/main/java/eu/endermite/commandwhitelist/velocity/command/VelocityMainCommand.java @@ -6,7 +6,6 @@ import eu.endermite.commandwhitelist.common.commands.CWCommand; import eu.endermite.commandwhitelist.velocity.CommandWhitelistVelocity; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; import java.util.ArrayList; import java.util.List; @@ -30,34 +29,34 @@ public void execute(final Invocation invocation) { switch (commandType) { case RELOAD: if (!sender.hasPermission(CWPermission.RELOAD.permission())) { - sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); + sender.sendMessage(CWCommand.miniMessage.parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); return; } CommandWhitelistVelocity.reloadConfig(sender); return; case ADD: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); + sender.sendMessage(CWCommand.miniMessage.parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); return; } if (args.length == 3) { if (CWCommand.addToWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1])) - sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().added_to_whitelist, args[2], args[1]))); + sender.sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().added_to_whitelist, args[2], args[1]))); else - sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1]))); + sender.sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1]))); } else sender.sendMessage(Component.text("/" + label + " add ")); return; case REMOVE: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - sender.sendMessage(MiniMessage.markdown().parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); + sender.sendMessage(CWCommand.miniMessage.parse(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().no_permission)); return; } if (args.length == 3) { if (CWCommand.removeFromWhitelist(CommandWhitelistVelocity.getConfigCache(), args[2], args[1])) - sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().removed_from_whitelist, args[2], args[1]))); + sender.sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().removed_from_whitelist, args[2], args[1]))); else - sender.sendMessage(MiniMessage.markdown().parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1]))); + sender.sendMessage(CWCommand.miniMessage.parse(String.format(CommandWhitelistVelocity.getConfigCache().prefix + CommandWhitelistVelocity.getConfigCache().group_doesnt_exist, args[1]))); } else sender.sendMessage(Component.text("/" + label + " remove ")); return; diff --git a/CommandWhitelistWaterfall/pom.xml b/CommandWhitelistWaterfall/pom.xml index 602adc7..494e29b 100644 --- a/CommandWhitelistWaterfall/pom.xml +++ b/CommandWhitelistWaterfall/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.0 + 2.2.1 Waterfall diff --git a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/CommandWhitelistWaterfall.java b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/CommandWhitelistWaterfall.java index 44d0140..e9ef04b 100644 --- a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/CommandWhitelistWaterfall.java +++ b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/CommandWhitelistWaterfall.java @@ -2,6 +2,7 @@ import eu.endermite.commandwhitelist.common.CWGroup; import eu.endermite.commandwhitelist.common.ConfigCache; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import eu.endermite.commandwhitelist.waterfall.command.BungeeMainCommand; import eu.endermite.commandwhitelist.waterfall.listeners.BungeeChatEventListener; import eu.endermite.commandwhitelist.waterfall.listeners.BungeeTabcompleteListener; @@ -70,7 +71,7 @@ public void loadConfig() { public void loadConfigAsync(CommandSender sender) { getProxy().getScheduler().runAsync(this, () -> { loadConfig(); - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(CommandWhitelistWaterfall.getConfigCache().prefix + CommandWhitelistWaterfall.getConfigCache().config_reloaded)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(CommandWhitelistWaterfall.getConfigCache().prefix + CommandWhitelistWaterfall.getConfigCache().config_reloaded)); }); } diff --git a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/command/BungeeMainCommand.java b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/command/BungeeMainCommand.java index 6c1e6ee..6c2ab56 100644 --- a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/command/BungeeMainCommand.java +++ b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/command/BungeeMainCommand.java @@ -6,7 +6,6 @@ import eu.endermite.commandwhitelist.waterfall.CommandWhitelistWaterfall; import net.kyori.adventure.platform.bungeecord.BungeeAudiences; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.plugin.Command; import net.md_5.bungee.api.plugin.TabExecutor; @@ -37,34 +36,34 @@ public void execute(CommandSender sender, String[] args) { switch (commandType) { case RELOAD: if (!sender.hasPermission(CWPermission.RELOAD.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(CommandWhitelistWaterfall.getConfigCache().prefix + configCache.no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(CommandWhitelistWaterfall.getConfigCache().prefix + configCache.no_permission)); return; } CommandWhitelistWaterfall.getPlugin().loadConfigAsync(sender); return; case ADD: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.no_permission)); return; } if (args.length == 3) { if (CWCommand.addToWhitelist(configCache, args[2], args[1])) - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.added_to_whitelist)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.added_to_whitelist)); else - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.group_doesnt_exist)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.group_doesnt_exist)); } else audiences.sender(sender).sendMessage(Component.text("/"+label+" add ")); return; case REMOVE: if (!sender.hasPermission(CWPermission.ADMIN.permission())) { - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.no_permission)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.no_permission)); return; } if (args.length == 3) { if (CWCommand.removeFromWhitelist(configCache, args[2], args[1])) - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.removed_from_whitelist)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.removed_from_whitelist)); else - audiences.sender(sender).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.group_doesnt_exist)); + audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.group_doesnt_exist)); } else audiences.sender(sender).sendMessage(Component.text("/"+label+" remove ")); return; diff --git a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeChatEventListener.java b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeChatEventListener.java index a6b7208..8e155a3 100644 --- a/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeChatEventListener.java +++ b/CommandWhitelistWaterfall/src/main/java/eu/endermite/commandwhitelist/waterfall/listeners/BungeeChatEventListener.java @@ -3,6 +3,7 @@ import eu.endermite.commandwhitelist.common.CWPermission; import eu.endermite.commandwhitelist.common.CommandUtil; import eu.endermite.commandwhitelist.common.ConfigCache; +import eu.endermite.commandwhitelist.common.commands.CWCommand; import eu.endermite.commandwhitelist.waterfall.CommandWhitelistWaterfall; import net.kyori.adventure.platform.bungeecord.BungeeAudiences; import net.kyori.adventure.text.minimessage.MiniMessage; @@ -32,7 +33,7 @@ public void onChatEvent(net.md_5.bungee.api.event.ChatEvent event) { HashSet commands = CommandWhitelistWaterfall.getCommands(player); if (!commands.contains(label)) { event.setCancelled(true); - CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.command_denied)); + CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.command_denied)); return; } @@ -40,7 +41,7 @@ public void onChatEvent(net.md_5.bungee.api.event.ChatEvent event) { for (String bannedSubCommand : bannedSubCommands) { if (command.startsWith(bannedSubCommand)) { event.setCancelled(true); - audiences.player(player).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.subcommand_denied)); + audiences.player(player).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.subcommand_denied)); return; } } diff --git a/pom.xml b/pom.xml index 988c79c..733e74c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ eu.endermite.commandwhitelist CommandWhitelist - 2.2.0 + 2.2.1 CommandWhitelistCommon CommandWhitelistBukkit