SteamWar/BungeeCore
Archiviert
13
2

Add First part of TeamCommand MultiLang

Dieser Commit ist enthalten in:
Chaoscaot 2021-01-19 02:39:05 +01:00
Ursprung d470a56ffa
Commit c0ff508f3d
2 geänderte Dateien mit 114 neuen und 47 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.bungeecore.commands; package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore; import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.Message;
import de.steamwar.bungeecore.inventory.SWItem; import de.steamwar.bungeecore.inventory.SWItem;
import de.steamwar.bungeecore.inventory.SWListInv; import de.steamwar.bungeecore.inventory.SWListInv;
import de.steamwar.bungeecore.sql.Event; import de.steamwar.bungeecore.sql.Event;
@ -38,6 +39,7 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import static de.steamwar.bungeecore.Storage.sessions;
import static de.steamwar.bungeecore.Storage.teamInvitations; import static de.steamwar.bungeecore.Storage.teamInvitations;
public class TeamCommand extends BasicCommand { public class TeamCommand extends BasicCommand {
@ -72,30 +74,30 @@ public class TeamCommand extends BasicCommand {
} }
private void help(CommandSender sender){ private void help(CommandSender sender){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§7Mit §e/team §7verwaltest du dein Team"); Message.send("TEAM_HELP_HEADER", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam list §8- §7Liste alle Teams auf"); Message.send("TEAM_HELP_LIST", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam info §8- §7Informiere dich über ein Team"); Message.send("TEAM_HELP_INFO", sender);
if(!(sender instanceof ProxiedPlayer)) if(!(sender instanceof ProxiedPlayer))
return; return;
ProxiedPlayer player = (ProxiedPlayer) sender; ProxiedPlayer player = (ProxiedPlayer) sender;
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(user.getTeam() == 0) { if(user.getTeam() == 0) {
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam create §8- §7Erstelle dein eigenes Team"); Message.send("TEAM_HELP_CREATE", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8- §7Trete einem Team bei"); Message.send("TEAM_HELP_JOIN", sender);
}else{ }else{
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteamchat §8- §7Sende Nachrichten an dein Team"); Message.send("TEAM_HELP_CHAT", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam event §8- §7Nehme an Events teil"); Message.send("TEAM_HELP_EVENT", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam leave §8- §7Verlasse dein Team"); Message.send("TEAM_HELP_LEAVE", sender);
Team team = Team.get(user.getTeam()); Team team = Team.get(user.getTeam());
if(team.getTeamLeader() == user.getId()){ if(team.getTeamLeader() == user.getId()){
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8- §7Lade jemanden in dein Team ein"); Message.send("TEAM_HELP_INVITE", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8- §7Entferne jemanden aus deinem Team"); Message.send("TEAM_HELP_REMOVE", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8- §7Ändere dein Teamkürzel"); Message.send("TEAM_HELP_KUERZEL", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8- §7Ändere deinen Teamnamen"); Message.send("TEAM_HELP_NAME", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changecolor §8- §7Ändere deine Teamfarbe"); Message.send("TEAM_HELP_COLOR", sender);
BungeeCore.send(sender, BungeeCore.CHAT_PREFIX + "§8/§eteam changeleader §8- §7Ernenne jemanden zum Teamleader"); Message.send("TEAM_HELP_LEADER", sender);
} }
} }
} }
@ -161,7 +163,7 @@ public class TeamCommand extends BasicCommand {
return; return;
if(args.length < 3){ 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; return;
} }
@ -173,7 +175,7 @@ public class TeamCommand extends BasicCommand {
Team.create(args[1], args[2], user.getId()); Team.create(args[1], args[2], user.getId());
user.setTeam(Team.get(args[1]).getTeamId()); 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){ private void join(ProxiedPlayer player, SteamwarUser user, String[] args){
@ -184,7 +186,7 @@ public class TeamCommand extends BasicCommand {
return; return;
if(!teamInvitations.containsKey(user.getId())){ if(!teamInvitations.containsKey(user.getId())){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§7Du hast keine Einladungen erhalten."); Message.send("TEAM_JOIN_NO_INVITE", player);
return; return;
} }
@ -195,13 +197,13 @@ public class TeamCommand extends BasicCommand {
t = invs.get(0); t = invs.get(0);
}else{ }else{
if(args.length != 2){ if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam join §8[§eTeam§8]"); Message.send("TEAM_JOIN_SYNTAX", player);
StringBuilder sb = new StringBuilder().append("§7Du wurdest von diesen Teams eingeladen§8: §e"); StringBuilder sb = new StringBuilder();
for(int inv : invs){ for(int inv : invs){
Team team = Team.get(inv); Team team = Team.get(inv);
sb.append(team.getTeamName()).append(" "); sb.append(team.getTeamName()).append(" ");
} }
BungeeCore.send(player, sb.toString()); Message.send("TEAM_JOIN_INVITED", player, sb.toString());
return; return;
} }
@ -214,14 +216,14 @@ public class TeamCommand extends BasicCommand {
} }
if(t == null){ 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; return;
} }
} }
user.setTeam(t); user.setTeam(t);
teamInvitations.remove(user.getId()); 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){ private void leave(ProxiedPlayer player, SteamwarUser user, Team team){
@ -229,7 +231,7 @@ public class TeamCommand extends BasicCommand {
return; return;
if(team.getTeamLeader() == user.getId() && team.size() > 1){ 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; return;
} }
@ -239,7 +241,7 @@ public class TeamCommand extends BasicCommand {
team.disband(); 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; return;
if(args.length != 2){ if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam invite §8[§eSpieler§8]"); Message.send("TEAM_INVITE_SYNTAX", player);
return; return;
} }
SteamwarUser target = SteamwarUser.get(args[1]); SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){ if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); Message.send("TEAM_INVITE_NO_PLAYER", player);
return; return;
}else if(target.getTeam() != 0){ }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; return;
} }
@ -268,16 +270,16 @@ public class TeamCommand extends BasicCommand {
teamInvitations.put(target.getId(), new LinkedList<>()); teamInvitations.put(target.getId(), new LinkedList<>());
if(teamInvitations.get(target.getId()).contains(team.getTeamId())){ 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; return;
} }
teamInvitations.get(target.getId()).add(team.getTeamId()); 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()); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid());
if(p != null) 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){ private void remove(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -285,43 +287,43 @@ public class TeamCommand extends BasicCommand {
return; return;
if(args.length != 2){ if(args.length != 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam remove §8[§eSpieler§8]"); Message.send("TEAM_REMOVE_SYNTAX", player);
return; return;
} }
SteamwarUser target = SteamwarUser.get(args[1]); SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){ if(target == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDiesen Spieler gibt es nicht"); Message.send("TEAM_REMOVE_NOT_PLAYER", player);
return; return;
} }
if (team.getTeamLeader() == target.getId()) { if (team.getTeamLeader() == target.getId()) {
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cLeader entfernen sich nicht selbst"); Message.send("TEAM_REMOVE_NOT_LEADER", player);
return; return;
} }
if(teamInvitations.containsKey(target.getId())){ if(teamInvitations.containsKey(target.getId())){
if(teamInvitations.get(target.getId()).remove((Integer) team.getTeamId())){ 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()) if(teamInvitations.get(target.getId()).isEmpty())
teamInvitations.remove(target.getId()); teamInvitations.remove(target.getId());
}else{ }else{
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDieser Spieler hat keine Einladung erhalten"); Message.send("TEAM_REMOVE_NO_INVITE", player);
} }
return; return;
} }
if(target.getTeam() != user.getTeam()){ 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; return;
} }
target.setTeam(0); 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()); ProxiedPlayer p = ProxyServer.getInstance().getPlayer(target.getUuid());
if(p != null) 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){ private void changekuerzel(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -332,7 +334,7 @@ public class TeamCommand extends BasicCommand {
return; return;
if(args.length < 2){ if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changekuerzel §8[§eTeamkürzel§8]"); Message.send("TEAM_KUERZEL_SYNTAX", player);
return; return;
} }
@ -340,7 +342,7 @@ public class TeamCommand extends BasicCommand {
return; return;
team.setTeamKuerzel(args[1]); 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){ private void changename(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -351,7 +353,7 @@ public class TeamCommand extends BasicCommand {
return; return;
if(args.length < 2){ if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§8/§eteam changename §8[§eTeamname§8]"); Message.send("TEAM_NAME_SYNTAX", player);
return; return;
} }
@ -359,7 +361,7 @@ public class TeamCommand extends BasicCommand {
return; return;
team.setTeamName(args[1]); 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){ private void changeleader(ProxiedPlayer player, SteamwarUser user, Team team, String[] args){
@ -370,23 +372,23 @@ public class TeamCommand extends BasicCommand {
return; return;
if(args.length < 2){ if(args.length < 2){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cBitte gib ein Teammitglied an"); Message.send("TEAM_LEADER_SYNTAX", player);
return; return;
} }
SteamwarUser target = SteamwarUser.get(args[1]); SteamwarUser target = SteamwarUser.get(args[1]);
if(target == null){ 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; return;
} }
if(target.getTeam() != user.getTeam()){ 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; return;
} }
team.setTeamLeader(target.getId()); 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){ private String playerName(SteamwarUser user){

Datei anzeigen

@ -289,3 +289,68 @@ STC_FORMAT=§8STC §e{0}» §r{1}
TC_SYNTAX=/teamchat [Nachricht an das Team] TC_SYNTAX=/teamchat [Nachricht an das Team]
TC_NO_TEAM=§cDu bist in keinem Team TC_NO_TEAM=§cDu bist in keinem Team
TC_FORMAT=§8TC §e{0}§8» §r{1} 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