From c0ff508f3d0496938ad8bc14a90fe6eaffc39d9c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 19 Jan 2021 02:39:05 +0100 Subject: [PATCH] Add First part of TeamCommand MultiLang --- .../bungeecore/commands/TeamCommand.java | 94 ++++++++++--------- .../steamwar/messages/BungeeCore.properties | 67 ++++++++++++- 2 files changed, 114 insertions(+), 47 deletions(-) diff --git a/src/de/steamwar/bungeecore/commands/TeamCommand.java b/src/de/steamwar/bungeecore/commands/TeamCommand.java index 0d503cec..649cf755 100644 --- a/src/de/steamwar/bungeecore/commands/TeamCommand.java +++ b/src/de/steamwar/bungeecore/commands/TeamCommand.java @@ -20,6 +20,7 @@ package de.steamwar.bungeecore.commands; import de.steamwar.bungeecore.BungeeCore; +import de.steamwar.bungeecore.Message; import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.sql.Event; @@ -38,6 +39,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer; import java.time.Instant; import java.util.*; +import static de.steamwar.bungeecore.Storage.sessions; import static de.steamwar.bungeecore.Storage.teamInvitations; public class TeamCommand extends BasicCommand { @@ -72,30 +74,30 @@ public class TeamCommand extends BasicCommand { } private void help(CommandSender sender){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§7Mit §e/team §7verwaltest du dein Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam list §8- §7Liste alle Teams auf"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8- §7Informiere dich über ein Team"); + Message.send("TEAM_HELP_HEADER", sender); + Message.send("TEAM_HELP_LIST", sender); + Message.send("TEAM_HELP_INFO", sender); if(!(sender instanceof ProxiedPlayer)) return; ProxiedPlayer player = (ProxiedPlayer) sender; SteamwarUser user = SteamwarUser.get(player.getUniqueId()); if(user.getTeam() == 0) { - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8- §7Erstelle dein eigenes Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8- §7Trete einem Team bei"); + Message.send("TEAM_HELP_CREATE", sender); + Message.send("TEAM_HELP_JOIN", sender); }else{ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteamchat §8- §7Sende Nachrichten an dein Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8- §7Nehme an Events teil"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam leave §8- §7Verlasse dein Team"); + Message.send("TEAM_HELP_CHAT", sender); + Message.send("TEAM_HELP_EVENT", sender); + Message.send("TEAM_HELP_LEAVE", sender); Team team = Team.get(user.getTeam()); if(team.getTeamLeader() == user.getId()){ - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8- §7Lade jemanden in dein Team ein"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changecolor §8- §7Ändere deine Teamfarbe"); - BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader"); + Message.send("TEAM_HELP_INVITE", sender); + Message.send("TEAM_HELP_REMOVE", sender); + Message.send("TEAM_HELP_KUERZEL", sender); + Message.send("TEAM_HELP_NAME", sender); + Message.send("TEAM_HELP_COLOR", sender); + Message.send("TEAM_HELP_LEADER", sender); } } } @@ -161,7 +163,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 3){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8]"); + Message.send("TEAM_CREATE_SYNTAX", player); return; } @@ -173,7 +175,7 @@ public class TeamCommand extends BasicCommand { Team.create(args[1], args[2], user.getId()); user.setTeam(Team.get(args[1]).getTeamId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team §e" + args[2] + " §7gegründet!"); + Message.send("TEAM_CREATE_CREATED", player, args[2]); } private void join(ProxiedPlayer player, SteamwarUser user, String[] args){ @@ -184,7 +186,7 @@ public class TeamCommand extends BasicCommand { return; if(!teamInvitations.containsKey(user.getId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast keine Einladungen erhalten."); + Message.send("TEAM_JOIN_NO_INVITE", player); return; } @@ -195,13 +197,13 @@ public class TeamCommand extends BasicCommand { t = invs.get(0); }else{ if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8[§eTeam§8]"); - StringBuilder sb = new StringBuilder().append("§7Du wurdest von diesen Teams eingeladen§8: §e"); + Message.send("TEAM_JOIN_SYNTAX", player); + StringBuilder sb = new StringBuilder(); for(int inv : invs){ Team team = Team.get(inv); sb.append(team.getTeamName()).append(" "); } - BungeeCore.send(player, sb.toString()); + Message.send("TEAM_JOIN_INVITED", player, sb.toString()); return; } @@ -214,14 +216,14 @@ public class TeamCommand extends BasicCommand { } if(t == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cVon diesem Team wurdest du nicht eingeladen"); + Message.send("TEAM_JOIN_NOT_BY_TEAM", player); return; } } user.setTeam(t); teamInvitations.remove(user.getId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du bist dem Team §e" + Team.get(t).getTeamName() + " §7beigetreten!"); + Message.send("TEAM_JOIN_JOINED", player, Team.get(t).getTeamName()); } private void leave(ProxiedPlayer player, SteamwarUser user, Team team){ @@ -229,7 +231,7 @@ public class TeamCommand extends BasicCommand { return; if(team.getTeamLeader() == user.getId() && team.size() > 1){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte ernenne zunächst ein anderes Teammitglied zum Leader"); + Message.send("TEAM_LEAVE_OTHER_LEADER", player); return; } @@ -239,7 +241,7 @@ public class TeamCommand extends BasicCommand { team.disband(); } - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast dein Team verlassen!"); + Message.send("TEAM_LEAVE_LEFT", player); } @@ -251,16 +253,16 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8[§eSpieler§8]"); + Message.send("TEAM_INVITE_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); + Message.send("TEAM_INVITE_NO_PLAYER", player); return; }else if(target.getTeam() != 0){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist bereits in einem Team"); + Message.send("TEAM_INVITE_IN_TEAM", player); return; } @@ -268,16 +270,16 @@ public class TeamCommand extends BasicCommand { teamInvitations.put(target.getId(), new LinkedList<>()); if(teamInvitations.get(target.getId()).contains(team.getTeamId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDu hast diesen Spieler bereits eingeladen"); + Message.send("TEAM_INVITE_ALREADY_INVITED", player); return; } teamInvitations.get(target.getId()).add(team.getTeamId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast §e" + args[1] + " §7in das Team eingeladen!"); + Message.send("TEAM_INVITE_INVITED", player, args[1]); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§7Du wurdest in das Team §e" + team.getTeamName() + " §7eingeladen!"); + Message.send("TEAM_INVITE_INVITED_TARGET", player, team.getTeamColor(), team.getTeamName()); } private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -285,43 +287,43 @@ public class TeamCommand extends BasicCommand { return; if(args.length != 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8[§eSpieler§8]"); + Message.send("TEAM_REMOVE_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); + Message.send("TEAM_REMOVE_NOT_PLAYER", player); return; } if (team.getTeamLeader() == target.getId()) { - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cLeader entfernen sich nicht selbst"); + Message.send("TEAM_REMOVE_NOT_LEADER", player); return; } if(teamInvitations.containsKey(target.getId())){ if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Die Einladung wurde zurückgezogen"); + Message.send("TEAM_REMOVE_INVITE", player); if(teamInvitations.get(target.getId()).isEmpty()) teamInvitations.remove(target.getId()); }else{ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat keine Einladung erhalten"); + Message.send("TEAM_REMOVE_NO_INVITE", player); } return; } if(target.getTeam() != user.getTeam()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler ist nicht in deinem Team"); + Message.send("TEAM_REMOVE_NOT_IN_TEAM", player); return; } target.setTeam(0); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Der Spieler wurde aus dem Team entfernt"); + Message.send("TEAM_REMOVE_REMOVED", player); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid()); if(p != null) - BungeeCore.send(p, BungeeCore.CHAT_PREFIX + "§cDu wurdest aus dem Team entfernt"); + Message.send("TEAM_REMOVE_REMOVED_TARGET", player); } private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -332,7 +334,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8[§eTeamkürzel§8]"); + Message.send("TEAM_KUERZEL_SYNTAX", player); return; } @@ -340,7 +342,7 @@ public class TeamCommand extends BasicCommand { return; team.setTeamKuerzel(args[1]); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Kürzel des Teams geändert!"); + Message.send("TEAM_KUERZEL_CHANGED", player); } private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -351,7 +353,7 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8[§eTeamname§8]"); + Message.send("TEAM_NAME_SYNTAX", player); return; } @@ -359,7 +361,7 @@ public class TeamCommand extends BasicCommand { return; team.setTeamName(args[1]); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast das Team umbenannt!"); + Message.send("TEAM_NAME_CHANGED", player); } private void changeleader(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){ @@ -370,23 +372,23 @@ public class TeamCommand extends BasicCommand { return; if(args.length < 2){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte gib ein Teammitglied an"); + Message.send("TEAM_LEADER_SYNTAX", player); return; } SteamwarUser target = SteamwarUser.get(args[1]); if(target == null){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDen Spieler " + args[1] + " gibt es nicht"); + Message.send("TEAM_LEADER_NOT_USER", player, args[1]); return; } if(target.getTeam() != user.getTeam()){ - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDer Spieler ist nicht in deinem Team"); + Message.send("TEAM_LEADER_NOT_MEMBER", player); return; } team.setTeamLeader(target.getId()); - BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast den Spieler §e" + args[1] + " §7zum Leader gemacht!"); + Message.send("TEAM_LEADER_CHANGED", player, args[0]); } private String playerName(SteamwarUser user){ diff --git a/src/de/steamwar/messages/BungeeCore.properties b/src/de/steamwar/messages/BungeeCore.properties index e3e6ba32..578715d2 100644 --- a/src/de/steamwar/messages/BungeeCore.properties +++ b/src/de/steamwar/messages/BungeeCore.properties @@ -288,4 +288,69 @@ STC_FORMAT=§8STC §e{0}» §r{1} #TeamchatCommand TC_SYNTAX=/teamchat [Nachricht an das Team] TC_NO_TEAM=§cDu bist in keinem Team -TC_FORMAT=§8TC §e{0}§8» §r{1} \ No newline at end of file +TC_FORMAT=§8TC §e{0}§8» §r{1} + +#TeamCommand +TEAM_HELP_HEADER=§7Mit §e/team §7verwaltest du dein Team +TEAM_HELP_LIST=§8/§eteam list §8- §7Liste alle Teams auf +TEAM_HELP_INFO=§8/§eteam info §8- §7Informiere dich über ein Team +TEAM_HELP_CREATE=§8/§eteam create §8- §7Erstelle dein eigenes Team +TEAM_HELP_JOIN=§8/§eteam join §8- §7Trete einem Team bei +TEAM_HELP_CHAT=§8/§eteamchat §8- §7Sende Nachrichten an dein Team +TEAM_HELP_EVENT=§8/§eteam event §8- §7Nehme an Events teil +TEAM_HELP_LEAVE=§8/§eteam leave §8- §7Verlasse dein Team +TEAM_HELP_INVITE=§8/§eteam invite §8- §7Lade jemanden in dein Team ein +TEAM_HELP_REMOVE=§8/§eteam remove §8- §7Entferne jemanden aus deinem Team +TEAM_HELP_KUERZEL=§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel +TEAM_HELP_NAME=§8/§eteam changename §8- §7Ändere deinen Teamnamen +TEAM_HELP_COLOR=§8/§eteam changecolor §8- §7Ändere deine Teamfarbe +TEAM_HELP_LEADER=§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader + +#Team Create +TEAM_CREATE_SYNTAX=§8/§eteam create §8[§eTeamkürzel§8] §8[§eTeamname§8] +TEAM_CREATE_CREATED=§7Du hast das Team §e{0} §7gegründet! + +#Team Join +TEAM_JOIN_NO_INVITE=§7Du hast keine Einladungen erhalten. +TEAM_JOIN_SYNTAX=§8/§eteam join §8[§eTeam§8] +TEAM_JOIN_INVITED=§7Du wurdest von diesen Teams eingeladen§8: §e{0} +TEAM_JOIN_NOT_BY_TEAM=§cVon diesem Team wurdest du nicht eingeladen +TEAM_JOIN_JOINED=§7Du bist dem Team §e{0} §7beigetreten! + +#Team Leave +TEAM_LEAVE_OTHER_LEADER=§cBitte ernenne zunächst ein anderes Teammitglied zum Leader +TEAM_LEAVE_LEFT=§7Du hast dein Team verlassen! + +#Team Invite +TEAM_INVITE_SYNTAX=§8/§eteam invite §8[§eSpieler§8] +TEAM_INVITE_NO_PLAYER=§cDiesen Spieler gibt es nicht +TEAM_INVITE_IN_TEAM=§cDieser Spieler ist bereits in einem Team +TEAM_INVITE_ALREADY_INVITED=§cDu hast diesen Spieler bereits eingeladen +TEAM_INVITE_INVITED=§7Du hast §e{0} §7in das Team eingeladen! +TEAM_INVITE_INVITED_TARGET=§7Du wurdest in das Team §{0}{1} §7eingeladen! + +#Team Remove +TEAM_REMOVE_SYNTAX=§8/§eteam remove §8[§eSpieler§8] +TEAM_REMOVE_NOT_PLAYER=§cDiesen Spieler gibt es nicht +TEAM_REMOVE_NOT_LEADER=§cLeader entfernen sich nicht selbst +TEAM_REMOVE_INVITE=§7Die Einladung wurde zurückgezogen +TEAM_REMOVE_NO_INVITE=§cDieser Spieler hat keine Einladung erhalten +TEAM_REMOVE_NOT_IN_TEAM=§cDieser Spieler ist nicht in deinem Team +TEAM_REMOVE_REMOVED=§7Der Spieler wurde aus dem Team entfernt +TEAM_REMOVE_REMOVED_TARGET=§cDu wurdest aus dem Team entfernt + +#Team Kuerzel +TEAM_KUERZEL_SYNTAX=§8/§eteam changekuerzel §8[§eTeamkürzel§8] +TEAM_KUERZEL_CHANGED=§7Du hast das Kürzel des Teams geändert! + +#Team Name +TEAM_NAME_SYNTAX=§8/§eteam changename §8[§eTeamname§8] +TEAM_NAME_CHANGED=§7Du hast das Team umbenannt! + +#Team Leader +TEAM_LEADER_SYNTAX=§cBitte gib ein Teammitglied an +TEAM_LEADER_NOT_USER=§cDen Spieler {0} gibt es nicht +TEAM_LEADER_NOT_MEMBER=§cDer Spieler ist nicht in deinem Team +TEAM_LEADER_CHANGED=§7Du hast den Spieler §e{0} §7zum Leader gemacht! + +#Team Info \ No newline at end of file