From 89d57e3f4892b0bc53507fca1e1d0ad739fee585 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sun, 1 Nov 2020 18:26:21 +0100 Subject: [PATCH 1/5] More multilingual transfer Signed-off-by: Lixfel --- .../bungeecore/commands/AlertCommand.java | 7 +++---- .../bungeecore/commands/BanCommand.java | 8 +++---- .../bungeecore/commands/BasicCommand.java | 3 ++- .../bungeecore/commands/BugCommand.java | 4 ++-- .../bungeecore/commands/DenyCommand.java | 5 ++--- .../bungeecore/commands/IgnoreCommand.java | 12 +++++------ .../steamwar/messages/BungeeCore.properties | 21 +++++++++++++++++++ 7 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/AlertCommand.java b/src/de/steamwar/bungeecore/commands/AlertCommand.java index 1ffb7b07..9befd065 100644 --- a/src/de/steamwar/bungeecore/commands/AlertCommand.java +++ b/src/de/steamwar/bungeecore/commands/AlertCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; @@ -32,7 +33,7 @@ public class AlertCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length == 0){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/alert [Nachricht]"); + Message.send("USAGE_ALERT", sender); return; } @@ -41,8 +42,6 @@ public class AlertCommand extends BasicCommand { for (String arg : args){ msgBuilder.append(arg).append(" "); } - String msg = msgBuilder.toString(); - msg = ChatColor.translateAlternateColorCodes('&', msg); - BungeeCore.broadcast(msg); + Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', msgBuilder.toString())); } } diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 9ac7ff89..0899c63a 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -38,7 +38,7 @@ public class BanCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 3){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/ban [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]"); + Message.send("USAGE_BAN", sender); return; } @@ -55,7 +55,7 @@ public class BanCommand extends BasicCommand { banReason.append(args[i]).append(" "); } String msg = banReason.toString(); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gebannt. Grund: §c" + msg); + Message.send("BAN_YOU_BANNED", sender, target.getUserGroup(), msg); target.ban(banTime, msg); } @@ -73,7 +73,7 @@ public class BanCommand extends BasicCommand { Date parsedDate = dateFormat.parse(arg.split("_")[0]); return new java.sql.Timestamp(parsedDate.getTime()); }catch(ParseException exception){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cUngültige Zeitangabe."); + Message.send("BAN_INVALID_TIME", sender); return null; } } diff --git a/src/de/steamwar/bungeecore/commands/BasicCommand.java b/src/de/steamwar/bungeecore/commands/BasicCommand.java index a31ad022..5e4565c4 100644 --- a/src/de/steamwar/bungeecore/commands/BasicCommand.java +++ b/src/de/steamwar/bungeecore/commands/BasicCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.ProxyServer; @@ -55,7 +56,7 @@ abstract class BasicCommand extends Command implements TabExecutor { protected SteamwarUser user(CommandSender sender, String arg){ SteamwarUser target = SteamwarUser.get(arg); if(target == null) - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§cDer Spieler existiert nicht."); + Message.send("UNKNWON_PLAYER", sender); return target; } } diff --git a/src/de/steamwar/bungeecore/commands/BugCommand.java b/src/de/steamwar/bungeecore/commands/BugCommand.java index c8866cef..74ff27c5 100644 --- a/src/de/steamwar/bungeecore/commands/BugCommand.java +++ b/src/de/steamwar/bungeecore/commands/BugCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SWException; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -40,6 +40,6 @@ public class BugCommand extends BasicCommand { String message = String.join(" ", args); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SWException.log(server, message, player.getName() + " " + user.getId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Dein Bugreport wurde gemeldet."); + Message.send("BUG_SAVED", player); } } diff --git a/src/de/steamwar/bungeecore/commands/DenyCommand.java b/src/de/steamwar/bungeecore/commands/DenyCommand.java index f3cf3ed3..b6738d86 100644 --- a/src/de/steamwar/bungeecore/commands/DenyCommand.java +++ b/src/de/steamwar/bungeecore/commands/DenyCommand.java @@ -19,9 +19,8 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; public class DenyCommand extends BasicCommand { @@ -34,7 +33,7 @@ public class DenyCommand extends BasicCommand { public void execute(CommandSender sender, String[] args) { if(sender instanceof ProxiedPlayer){ ProxiedPlayer player = (ProxiedPlayer) sender; - player.sendMessage(new TextComponent(BungeeCore.CHAT_PREFIX + "§cUnbekannter Befehl.")); + Message.send("UNKNOWN_COMMAND", player); } } } diff --git a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java index b9082a40..ef10839e 100644 --- a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java @@ -19,7 +19,7 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.IgnoreSystem; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -34,7 +34,7 @@ public class IgnoreCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 1) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eignore §8[§7Spieler§8]"); + Message.send("USAGE_IGNORE", sender); return; } @@ -45,17 +45,17 @@ public class IgnoreCommand extends BasicCommand { SteamwarUser target = SteamwarUser.get(args[0]); if(target == null){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht."); + Message.send("UNKNWON_PLAYER", p); return; }else if(target.equals(user)){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cWie willst du dich selber ignorieren?"); + Message.send("IGNORE_YOURSELF", p); return; }else if(IgnoreSystem.isIgnored(user, target)){ - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu ignorierst diesen Spieler bereits."); + Message.send("IGNORE_ALREADY", p); return; } IgnoreSystem.ignore(user, target); - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du ignorierst nun §e" + target.getUserName() + "§8."); + Message.send("IGNORE_IGNORE", p, target.getUserName()); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 6855cb7c..64916c90 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -1,5 +1,9 @@ PREFIX=§eSteam§8War» +UNKNOWN_COMMAND=§cUnbekannter Befehl. +UNKNWON_PLAYER=§cDiesen Spieler gibt es nicht. + +#Help command HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück! HELP_LOBBY_HOVER=§eZurück zur Lobby HELP_BAU=§7Komme mit §8/§ebau §7auf den Bauserver! @@ -53,3 +57,20 @@ HELP_BAU_TESTARENA=§8/§ebau testarena §8- §7Starte eine Testarena HELP_BAU_TESTARENA_HOVER=§eTestarena starten HELP_BAU_BAU=§8/§ehelp bau §8- §7Hilfe zu nützlichen Werkzeugen HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen + +#Usage description of various commands +USAGE_ALERT=§8/§7alert §8[§eNachricht§8] +USAGE_BAN=§8/§7ban §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] +USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] + +#Various commands +ALERT=§f{0} + +BAN_YOU_BANNED=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} +BAN_INVALID_TIME=§cUngültige Zeitangabe. + +BUG_SAVED=§7Dein Bugreport wurde gespeichert. + +IGNORE_YOURSELF=§cWie willst du dich selber ignorieren? +IGNORE_ALREADY=§cDu ignorierst diesen Spieler bereits. +IGNORE_IGNORE=§7Du ignorierst nun §e{0}§8. \ No newline at end of file From 730b56e4ecc40ec746d94647447936351c6da36a Mon Sep 17 00:00:00 2001 From: jojo Date: Thu, 19 Nov 2020 17:20:01 +0100 Subject: [PATCH 2/5] Add /mute Multilingual support Update properties --- src/de/steamwar/bungeecore/commands/AlertCommand.java | 7 +------ src/de/steamwar/bungeecore/commands/BanCommand.java | 4 ++-- src/de/steamwar/bungeecore/commands/BugCommand.java | 2 +- .../steamwar/bungeecore/commands/IgnoreCommand.java | 8 +++++--- src/de/steamwar/bungeecore/commands/MuteCommand.java | 5 +++-- src/de/steamwar/messages/BungeeCore.properties | 11 +++++++---- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/AlertCommand.java b/src/de/steamwar/bungeecore/commands/AlertCommand.java index 9befd065..e1ac773b 100644 --- a/src/de/steamwar/bungeecore/commands/AlertCommand.java +++ b/src/de/steamwar/bungeecore/commands/AlertCommand.java @@ -37,11 +37,6 @@ public class AlertCommand extends BasicCommand { return; } - StringBuilder msgBuilder = new StringBuilder(); - msgBuilder.append(BungeeCore.CHAT_PREFIX); - for (String arg : args){ - msgBuilder.append(arg).append(" "); - } - Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', msgBuilder.toString())); + Message.broadcast("ALERT", ChatColor.translateAlternateColorCodes('&', BungeeCore.CHAT_PREFIX + String.join(" ", args))); } } diff --git a/src/de/steamwar/bungeecore/commands/BanCommand.java b/src/de/steamwar/bungeecore/commands/BanCommand.java index 0899c63a..d49ba646 100644 --- a/src/de/steamwar/bungeecore/commands/BanCommand.java +++ b/src/de/steamwar/bungeecore/commands/BanCommand.java @@ -55,7 +55,7 @@ public class BanCommand extends BasicCommand { banReason.append(args[i]).append(" "); } String msg = banReason.toString(); - Message.send("BAN_YOU_BANNED", sender, target.getUserGroup(), msg); + Message.send("BAN_MESSAGE_YOU", sender, target.getUserName(), msg); target.ban(banTime, msg); } @@ -73,7 +73,7 @@ public class BanCommand extends BasicCommand { Date parsedDate = dateFormat.parse(arg.split("_")[0]); return new java.sql.Timestamp(parsedDate.getTime()); }catch(ParseException exception){ - Message.send("BAN_INVALID_TIME", sender); + Message.send("INVALID_TIME", sender); return null; } } diff --git a/src/de/steamwar/bungeecore/commands/BugCommand.java b/src/de/steamwar/bungeecore/commands/BugCommand.java index 74ff27c5..2f607853 100644 --- a/src/de/steamwar/bungeecore/commands/BugCommand.java +++ b/src/de/steamwar/bungeecore/commands/BugCommand.java @@ -40,6 +40,6 @@ public class BugCommand extends BasicCommand { String message = String.join(" ", args); SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SWException.log(server, message, player.getName() + " " + user.getId()); - Message.send("BUG_SAVED", player); + Message.send("BUG_MESSAGE", player); } } diff --git a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java index ef10839e..51459664 100644 --- a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java @@ -47,15 +47,17 @@ public class IgnoreCommand extends BasicCommand { if(target == null){ Message.send("UNKNWON_PLAYER", p); return; - }else if(target.equals(user)){ + } + if(target.equals(user)){ Message.send("IGNORE_YOURSELF", p); return; - }else if(IgnoreSystem.isIgnored(user, target)){ + } + if(IgnoreSystem.isIgnored(user, target)){ Message.send("IGNORE_ALREADY", p); return; } IgnoreSystem.ignore(user, target); - Message.send("IGNORE_IGNORE", p, target.getUserName()); + Message.send("IGNORE_MESSAGE", p, target.getUserName()); } } diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index dc0d681e..0d8e344d 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender; @@ -34,7 +35,7 @@ public class MuteCommand extends BasicCommand { @Override public void execute(CommandSender sender, String[] args) { if(args.length < 3){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "/mute [Spieler] [dd.mm.yyyy oder dd.mm.yyyy_hh:mm oder perma] [Grund]"); + Message.send("USAGE_MUTE", sender); return; } @@ -51,7 +52,7 @@ public class MuteCommand extends BasicCommand { muteReason.append(args[i]).append(" "); } String msg = muteReason.toString(); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "Du hast " + target.getUserName() + " gemuted. Grund: §c" + msg); + Message.send("MUTE_MESSAGE_YOU", sender, target.getUserName(), msg); target.mute(muteTime, msg); } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 64916c90..82a71a45 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -2,6 +2,7 @@ PREFIX=§eSteam§8War» UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNWON_PLAYER=§cDiesen Spieler gibt es nicht. +INVALID_TIME=§cUngültige Zeitangabe. #Help command HELP_LOBBY=§7Kehre von überall mit §8/§el §7zur Lobby zurück! @@ -61,16 +62,18 @@ HELP_BAU_BAU_HOVER=§eNützliche Zusatzfunktionen #Usage description of various commands USAGE_ALERT=§8/§7alert §8[§eNachricht§8] USAGE_BAN=§8/§7ban §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] +USAGE_MUTE=§8/§7mute §8[§eSpieler§8] [§edd§8.§emm§8.§eyyyy §7oder §edd§8.§emm§8.§eyyyy§8_§ehh§8:§emm §7oder §eperma§8] [§eGrund§8] USAGE_IGNORE=§8/§7ignore §8[§eSpieler§8] #Various commands ALERT=§f{0} -BAN_YOU_BANNED=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} -BAN_INVALID_TIME=§cUngültige Zeitangabe. +BAN_MESSAGE_YOU=§7Du hast §e{0} §7gebannt§8. §7Grund§8: §c{1} -BUG_SAVED=§7Dein Bugreport wurde gespeichert. +MUTE_MESSAGE_YOU=§7Du hast §e{0} §7gemutet§8. §7Grund§8: §c{1} + +BUG_MESSAGE=§7Dein Bugreport wurde gespeichert. IGNORE_YOURSELF=§cWie willst du dich selber ignorieren? IGNORE_ALREADY=§cDu ignorierst diesen Spieler bereits. -IGNORE_IGNORE=§7Du ignorierst nun §e{0}§8. \ No newline at end of file +IGNORE_MESSAGE=§7Du ignorierst nun §e{0}§8. \ No newline at end of file From f5c834df11fa0d477811d2ba35bd1c06bb41f7e2 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 27 Nov 2020 23:53:06 +0100 Subject: [PATCH 3/5] Fix typo Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/IgnoreCommand.java | 2 +- src/de/steamwar/messages/BungeeCore.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java index 51459664..9151fdef 100644 --- a/src/de/steamwar/bungeecore/commands/IgnoreCommand.java +++ b/src/de/steamwar/bungeecore/commands/IgnoreCommand.java @@ -45,7 +45,7 @@ public class IgnoreCommand extends BasicCommand { SteamwarUser target = SteamwarUser.get(args[0]); if(target == null){ - Message.send("UNKNWON_PLAYER", p); + Message.send("UNKNOWN_PLAYER", p); return; } if(target.equals(user)){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 2d5faeeb..586f1a76 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -1,7 +1,7 @@ PREFIX=§eSteam§8War» UNKNOWN_COMMAND=§cUnbekannter Befehl. -UNKNWON_PLAYER=§cDiesen Spieler gibt es nicht. +UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. INVALID_TIME=§cUngültige Zeitangabe. #Help command From 8caf77d5767eccb850b91ba3e86dfe90c35dd716 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 27 Nov 2020 23:55:40 +0100 Subject: [PATCH 4/5] Fix additional typo Signed-off-by: Lixfel --- src/de/steamwar/bungeecore/commands/BasicCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/BasicCommand.java b/src/de/steamwar/bungeecore/commands/BasicCommand.java index 5e4565c4..9cdf19a9 100644 --- a/src/de/steamwar/bungeecore/commands/BasicCommand.java +++ b/src/de/steamwar/bungeecore/commands/BasicCommand.java @@ -56,7 +56,7 @@ abstract class BasicCommand extends Command implements TabExecutor { protected SteamwarUser user(CommandSender sender, String arg){ SteamwarUser target = SteamwarUser.get(arg); if(target == null) - Message.send("UNKNWON_PLAYER", sender); + Message.send("UNKNOWN_PLAYER", sender); return target; } } From 56edd5c3603fba0586dbd0ef17588d5ad177ea54 Mon Sep 17 00:00:00 2001 From: jojo Date: Sat, 28 Nov 2020 08:24:58 +0100 Subject: [PATCH 5/5] Optimize Imports --- src/de/steamwar/bungeecore/commands/MuteCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/steamwar/bungeecore/commands/MuteCommand.java b/src/de/steamwar/bungeecore/commands/MuteCommand.java index 0d8e344d..58300276 100644 --- a/src/de/steamwar/bungeecore/commands/MuteCommand.java +++ b/src/de/steamwar/bungeecore/commands/MuteCommand.java @@ -19,7 +19,6 @@ package de.steamwar.bungeecore.commands; -import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.sql.SteamwarUser; import net.md_5.bungee.api.CommandSender;