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