From 85d5a76e304f0eeaa21e9b7a0e5160276811540d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 01:06:33 +0100 Subject: [PATCH] Add JoinmeCommand MultiLang --- .../bungeecore/commands/JoinmeCommand.java | 20 ++++++++----------- .../steamwar/messages/BungeeCore.properties | 10 +++++++++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java index e4f9c0d3..cb338d33 100644 --- a/src/de/steamwar/bungeecore/commands/JoinmeCommand.java +++ b/src/de/steamwar/bungeecore/commands/JoinmeCommand.java @@ -34,8 +34,6 @@ import java.util.ArrayList; public class JoinmeCommand extends BasicCommand { - private static final String DENY_MESSAGE = "§cDu kannst diesem Spieler derzeit nicht folgen."; - public JoinmeCommand() { super("joinme", ""); } @@ -46,17 +44,15 @@ public class JoinmeCommand extends BasicCommand { ProxiedPlayer player = (ProxiedPlayer) sender; if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { - TextComponent tc = new TextComponent(BungeeCore.CHAT_PREFIX + "§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8!"); - tc.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("§aSpieler folgen").create())); - tc.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); - ProxyServer.getInstance().broadcast(tc); + Message.broadcast("JOINME_BROADCAST", true, Message.parse("JOINME_BROADCAST_HOVER", player) //TODO Needs Message Object + , new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName())); } else if (args.length == 1) { ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]); if(target == null || !target.isConnected()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist offline."); + Message.send("JOINME_PLAYER_OFFLINE", player); return; }else if(target.equals(player)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cSei eins mit dir selbst!"); + Message.send("JOINME_PLAYER_SELF", player); return; } ServerInfo server = target.getServer().getInfo(); @@ -74,18 +70,18 @@ public class JoinmeCommand extends BasicCommand { subserver.sendPlayer(player); } else { SubserverSystem.sendDeniedMessage(player, bauserver.getOwner()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); } } }else if(serverPerm != null && !player.hasPermission(serverPerm)){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else if(serverPerm == null && !player.getGroups().contains("team")) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + DENY_MESSAGE); + Message.send("JOIN_PLAYER_BLOCK", player); }else{ player.connect(server); } } else { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7."); + Message.send("JOINME_SYNTAX", player); } } } diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index 644a8a26..5b7094dc 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -4,6 +4,7 @@ SPACER= UNKNOWN_COMMAND=§cUnbekannter Befehl. UNKNOWN_PLAYER=§cDiesen Spieler gibt es nicht. INVALID_TIME=§cUngültige Zeitangabe. +JOIN_PLAYER_BLOCK=§cDu kannst diesem Spieler derzeit nicht folgen. #ModLoader blocker MODLOADER_INSTALLED=§7Du hast §e{0} §7installiert. Daher kannst du keinen Arenen beitreten. @@ -212,4 +213,11 @@ CHECK_DECLINED_TEAM=§7Die Schematic §e{0} §7von §e{1} §awurde aufgrund von #HistoricCommand HISTORIC_BROADCAST=§7Historischer §e{0}§8-§7Kampf von §e{1}§8! -HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen \ No newline at end of file +HISTORIC_BROADCAST_HOVER=§aGegen §7{0} §ekämpfen + +#JoinmeCommand +JOINME_SYNTAX=§7Mit §8/§ejoin §8[§eSpieler§8] §7kannst du einem Spieler folgen §8(z.B. in eine Arena)§7. +JOINME_BROADCAST=§7Klicke §ehier§8, §7um zu §e" + player.getName() + " §7auf §e" + player.getServer().getInfo().getName() + " §7zu kommen§8! +JOINME_BROADCAST_HOVER=§aSpieler folgen +JOINME_PLAYER_OFFLINE=§cDieser Spieler ist offline. +JOINME_PLAYER_SELF=§cSei eins mit dir selbst! \ No newline at end of file