mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 20:59:39 +01:00
Adding Nextbattle command
This commit is contained in:
parent
45716af6b8
commit
bb300cf372
@ -177,12 +177,8 @@ public class War extends JavaPlugin {
|
||||
|
||||
/*if (sender instanceof Player) {
|
||||
if (this.isZoneMaker(player)) {
|
||||
// Mod commands : /nextbattle
|
||||
if (command.equals("nextbattle")) {
|
||||
this.performNextBattle(player);
|
||||
}
|
||||
// Warzone maker commands: /setzone, /savezone, /setteam, /setmonument, /resetzone
|
||||
else if (command.equals("setzone")) {
|
||||
if (command.equals("setzone")) {
|
||||
this.performSetZone(player, arguments);
|
||||
} else if (command.equals("setzonelobby")) {
|
||||
this.performSetZoneLobby(player, arguments);
|
||||
@ -644,20 +640,6 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
public void performNextBattle(Player player) {
|
||||
if (!this.inAnyWarzone(player.getLocation())) {
|
||||
this.badMsg(player, "Usage: /nextbattle. Resets the zone blocks and all teams' life pools. Must be in warzone.");
|
||||
} else {
|
||||
Warzone warzone = Warzone.getZoneByLocation(player);
|
||||
warzone.clearFlagThieves();
|
||||
for (Team team : warzone.getTeams()) {
|
||||
team.teamcast("The battle was interrupted. " + warzone.getTeamInformation() + " Resetting warzone " + warzone.getName() + " and life pools...");
|
||||
}
|
||||
warzone.getVolume().resetBlocksAsJob();
|
||||
warzone.initializeZoneAsJob();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean updateZoneFromNamedParams(Warzone warzone, Player player, String[] arguments) {
|
||||
try {
|
||||
Map<String, String> namedParams = new HashMap<String, String>();
|
||||
|
@ -58,6 +58,9 @@ public class WarCommandHandler {
|
||||
else if (command.equals("resetzone")) {
|
||||
commandObj = new ResetzoneCommand(this, sender, arguments);
|
||||
}
|
||||
else if (command.equals("nextbattle")) {
|
||||
commandObj = new NextbattleCommand(this, sender, arguments);
|
||||
}
|
||||
else if (command.equals("deletewarhub")) {
|
||||
commandObj = new DeletewarhubCommand(this, sender, arguments);
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package bukkit.tommytony.war.command;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.Warzone;
|
||||
import com.tommytony.war.ZoneLobby;
|
||||
import bukkit.tommytony.war.WarCommandHandler;
|
||||
|
||||
public class NextbattleCommand extends AbstractZoneMakerCommand {
|
||||
public NextbattleCommand(WarCommandHandler handler, CommandSender sender, String[] args) throws NoZoneMakerException {
|
||||
super(handler, sender, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle() {
|
||||
Warzone zone;
|
||||
if (this.args.length == 1) {
|
||||
zone = Warzone.getZoneByName(this.args[0]);
|
||||
} else {
|
||||
if (!(this.sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
zone = Warzone.getZoneByLocation((Player) this.sender);
|
||||
if (zone == null) {
|
||||
ZoneLobby lobby = ZoneLobby.getLobbyByLocation((Player) this.sender);
|
||||
if (lobby == null) return false;
|
||||
zone = lobby.getZone();
|
||||
}
|
||||
}
|
||||
if (zone == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
zone.clearFlagThieves();
|
||||
for (Team team : zone.getTeams()) {
|
||||
team.teamcast("The battle was interrupted. " + zone.getTeamInformation() + " Resetting warzone " + zone.getName() + " and life pools...");
|
||||
}
|
||||
zone.getVolume().resetBlocksAsJob();
|
||||
zone.initializeZoneAsJob();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user