From 97934be6752cc294c5fa1aeda1ac7b31e86b8b7d Mon Sep 17 00:00:00 2001 From: yoyosource Date: Mon, 10 Apr 2023 12:07:04 +0200 Subject: [PATCH] Hotfix PunishmentCommand messages --- .../commands/PunishmentCommand.java | 22 ++++++++++++++----- .../steamwar/messages/BungeeCore.properties | 3 ++- .../messages/BungeeCore_de.properties | 3 ++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/PunishmentCommand.java b/src/de/steamwar/bungeecore/commands/PunishmentCommand.java index 3a96b49..a4b9189 100644 --- a/src/de/steamwar/bungeecore/commands/PunishmentCommand.java +++ b/src/de/steamwar/bungeecore/commands/PunishmentCommand.java @@ -22,11 +22,12 @@ package de.steamwar.bungeecore.commands; import com.google.gson.JsonParser; import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; -import de.steamwar.sql.SteamwarUser; import de.steamwar.command.SWCommand; import de.steamwar.messages.ChatSender; import de.steamwar.sql.BannedUserIPs; import de.steamwar.sql.Punishment; +import de.steamwar.sql.SteamwarUser; +import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -114,8 +115,9 @@ public class PunishmentCommand { public PunishmentCommand(String command, Punishment.PunishmentType punishmentType) { new SWCommand(command, "bungeecore.ban") { - @Register(description = "PUNISHMENT_USAGE") - public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE") String... message) { + + @Register + public void genericCommand(ProxiedPlayer player, String toPunish, String date, @ErrorMessage(allowEAs = false, value = "PUNISHMENT_USAGE_REASON") String... message) { SteamwarUser punisher = SteamwarUser.get(player.getUniqueId()); if (punishmentType.isNeedsAdmin() && !punisher.getUserGroup().isAdminGroup()) { return; @@ -137,13 +139,18 @@ public class PunishmentCommand { target.punish(punishmentType, banTime, msg, punisher.getId(), isPerma); Message.team(punishmentType.getTeamMessage(), new Message("PREFIX"), target.getUserName(), player.getName(), new Message((isPerma ? "PUNISHMENT_PERMA" : "PUNISHMENT_UNTIL"), banTime), msg); } + + @Register + public void genericError(ProxiedPlayer player, String... args) { + ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("PUNISHMENT_USAGE", command)); + } }; if (punishmentType.getUnpunishmentMessage() == null) { return; } String antiCommand = "un" + command; new SWCommand(antiCommand, "bungeecore.ban") { - @Register(description = "PUNISHMENT_USAGE") + @Register public void genericCommand(ProxiedPlayer player, String toUnpunish) { if (punishmentType.isNeedsAdmin() && !SteamwarUser.get(player.getUniqueId()).getUserGroup().isAdminGroup()) { return; @@ -163,6 +170,11 @@ public class PunishmentCommand { if(punishmentType == Punishment.PunishmentType.Ban) BannedUserIPs.unbanIPs(target.getId()); } + + @Register + public void genericError(ProxiedPlayer player, String... args) { + ChatSender.of(player).send(true, ChatMessageType.CHAT, null, null, new Message("UNPUNISHMENT_USAGE", antiCommand)); + } }; } @@ -191,7 +203,7 @@ public class PunishmentCommand { StringBuilder st = new StringBuilder(); for (int i = 0; i < arg.length(); i++) { char c = arg.charAt(i); - if (Character.isDigit(c)) { + if (c >= '0' && c <= '9') { st.append(c); continue; } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2fa5d32..28a5b74 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -123,7 +123,8 @@ ALERT=§f{0} STAT_SERVER=§7Server §e{0}§8: §7Below limit §e{1} §7Server count §e{2} #Ban&Mute-Command -PUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] [§edd§8.§emm§8.§eyyyy §7or §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7or §eperma§8] [§ereason§8] +PUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] [§edd§8.§emm§8.§eyyyy §7or §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7or §enumber§8[§eh§7our|§ed§7ay|§ew§7eek|§em§7onth|§ey§7ear§8] §7or §eperma§8] [§ereason§8] +PUNISHMENT_USAGE_REASON=§cPlease enter a reason. UNPUNISHMENT_USAGE=§8/§7{0} §8[§eplayer§8] PUNISHMENT_UNTIL=until {0} diff --git a/src/de/steamwar/messages/BungeeCore_de.properties b/src/de/steamwar/messages/BungeeCore_de.properties index d0078da..d98df73 100644 --- a/src/de/steamwar/messages/BungeeCore_de.properties +++ b/src/de/steamwar/messages/BungeeCore_de.properties @@ -108,7 +108,8 @@ MOD_USE_MODSENDER=§cBitte nutze den §c§lFabricModSender§c (https://steamwar. STAT_SERVER=§7Server §e{0}§8: §7Startfähig §e{1} §7Serveranzahl §e{2} #Ban&Mute-Command -PUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] +PUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §ezahl§8[§eh§7our|§ed§7ay|§ew§7eek|§em§7onth|§ey§7ear§8] §7oder §eperma§8] [§eGrund§8] +PUNISHMENT_USAGE_REASON=§cBitte gib einen Grund an. UNPUNISHMENT_USAGE=§8/§7{0} §8[§eSpieler§8] PUNISHMENT_UNTIL=bis zum {0}