SteamWar/BungeeCore
Archiviert
13
2

port_to_commandframework #457

Zusammengeführt
Lixfel hat 18 Commits von port_to_commandframework nach master 2023-02-22 07:10:33 +01:00 zusammengeführt
Nur Änderungen aus Commit d559c61846 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -113,28 +113,23 @@ public class TeamCommand extends SWCommand {
}
}
@Register("create")
public void create(ProxiedPlayer player, String... args){
@Register(value = "create", description = "TEAM_CREATE_USAGE")
public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Team team = Team.get(user.getTeam());
if(unwantedInTeam(player, user))
return;
if(args.length < 3){
Message.send("TEAM_CREATE_USAGE", player);
return;
}
if(checkTeamKuerzel(player, team, args[1]))
if(checkTeamKuerzel(player, team, kuerzel))
return;
if(checkTeamName(player, team, args[2]))
if(checkTeamName(player, team, name))
return;
Team.create(args[1], args[2]);
user.setTeam(Team.get(args[1]).getTeamId());
Team.create(kuerzel, name);
user.setTeam(Team.get(kuerzel).getTeamId());
user.setLeader(true);
Message.send("TEAM_CREATE_CREATED", player, args[2]);
Message.send("TEAM_CREATE_CREATED", player, name);
}
@Register("join")
@ -313,8 +308,8 @@ public class TeamCommand extends SWCommand {
Message.send("TEAM_REMOVE_REMOVED_TARGET", player);
}
@Register("changekurzel")
public void changekuerzel(ProxiedPlayer player, String... args){
@Register(value = "changekurzel", description = "TEAM_KUERZEL_USAGE")
public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Team team = Team.get(user.getTeam());
if(notLeader(player, user, team))
@ -323,20 +318,15 @@ public class TeamCommand extends SWCommand {
if(notDuringEvent(player))
return;
if(args.length < 2){
Message.send("TEAM_KUERZEL_USAGE", player);
return;
}
if(checkTeamKuerzel(player, team, args[1]))
if(checkTeamKuerzel(player, team, kuerzel))
return;
team.setTeamKuerzel(args[1]);
team.setTeamKuerzel(kuerzel);
Message.send("TEAM_KUERZEL_CHANGED", player);
}
@Register("changename")
public void changename(ProxiedPlayer player, String... args){
@Register(value = "changename", description = "TEAM_NAME_USAGE")
public void changename(ProxiedPlayer player, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
Team team = Team.get(user.getTeam());
if(notLeader(player, user, team))
@ -345,15 +335,10 @@ public class TeamCommand extends SWCommand {
if(notDuringEvent(player))
return;
if(args.length < 2){
Message.send("TEAM_NAME_USAGE", player);
return;
}
if(checkTeamName(player, team, args[1]))
if(checkTeamName(player, team, name))
return;
team.setTeamName(args[1]);
team.setTeamName(name);
Message.send("TEAM_NAME_CHANGED", player);
}
@ -665,11 +650,6 @@ public class TeamCommand extends SWCommand {
}
private boolean checkTeamName(ProxiedPlayer player, Team team, String arg){
if(arg.length() < 4 || arg.length() > 15){
Message.send("TEAM_NAME_LENGHT", player);
return true;
}
Team t = Team.get(arg);
if(t != null && t.getTeamId() != team.getTeamId()){
Message.send("TEAM_NAME_TAKEN", player);
@ -679,11 +659,6 @@ public class TeamCommand extends SWCommand {
}
private boolean checkTeamKuerzel(ProxiedPlayer player, Team team, String arg){
if(arg.length() < 2 || arg.length() > 4){
Message.send("TEAM_KUERZEL_LENGHT", player);
return true;
}
Team t = Team.get(arg);
if(t != null && (team == null || t.getTeamId() != team.getTeamId())){
Message.send("TEAM_KUERZEL_TAKEN", player);