mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Closes https://github.com/taoneill/war/issues/44, warzones can be deleted by name now
This commit is contained in:
parent
6fa2d91130
commit
55b5ecfdbf
@ -232,7 +232,7 @@ public class War extends JavaPlugin {
|
||||
} else if(command.equals("resetzone")) {
|
||||
performResetZone(player, arguments);
|
||||
} else if(command.equals("deletezone")) {
|
||||
performDeleteZone(player);
|
||||
performDeleteZone(player, arguments);
|
||||
} else if(command.equals("setteam")) {
|
||||
performSetTeam(player, arguments);
|
||||
} else if(command.equals("setteamflag")) {
|
||||
@ -564,14 +564,29 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void performDeleteZone(Player player) {
|
||||
if(!this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
||||
this.badMsg(player, "Usage: /deletezone. " +
|
||||
public void performDeleteZone(Player player, String[] arguments) {
|
||||
if(arguments.length == 0 && !this.inAnyWarzone(player.getLocation()) && !this.inAnyWarzoneLobby(player.getLocation())) {
|
||||
this.badMsg(player, "Usage: /deletezone [warzone-name]. " +
|
||||
"Deletes the warzone. " +
|
||||
"Must be in the warzone (try /zones and /zone). ");
|
||||
"Must be in the warzone or name must be provided (try /zones and /zone). ");
|
||||
} else {
|
||||
Warzone warzone = this.warzone(player.getLocation());
|
||||
ZoneLobby lobby = this.lobby(player.getLocation());
|
||||
ZoneLobby lobby = null;
|
||||
Warzone warzone = null;
|
||||
if(arguments.length == 1) { // get zone by name
|
||||
for(Warzone tmp : this.getWarzones()) {
|
||||
if(tmp.getName().toLowerCase().startsWith(arguments[0].toLowerCase())) {
|
||||
warzone = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (warzone == null) {
|
||||
this.badMsg(player, "No such warzone.");
|
||||
return;
|
||||
}
|
||||
} else { // get zone by position
|
||||
warzone = this.warzone(player.getLocation());
|
||||
lobby = this.lobby(player.getLocation());
|
||||
}
|
||||
if(warzone == null && lobby != null) {
|
||||
warzone = lobby.getZone();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user