Prevent joining zone during reset

This commit is contained in:
cmastudios 2013-12-07 19:23:12 -06:00
parent df871c1c5b
commit 346fd25955
3 changed files with 8 additions and 5 deletions

View File

@ -1150,9 +1150,10 @@ public class Warzone {
team.resetPoints(); team.resetPoints();
team.setRemainingLives(team.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL)); team.setRemainingLives(team.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL));
} }
this.getVolume().resetBlocksAsJob(); if (!this.isReinitializing()) {
this.initializeZoneAsJob(); this.reinitialize();
War.war.log("Last player left warzone " + this.getName() + ". Warzone blocks resetting automatically...", Level.INFO); War.war.getLogger().log(Level.INFO, "Last player left warzone {0}. Warzone blocks resetting automatically...", new Object[] {this.getName()});
}
} }
WarPlayerLeaveEvent event1 = new WarPlayerLeaveEvent(player.getName()); WarPlayerLeaveEvent event1 = new WarPlayerLeaveEvent(player.getName());

View File

@ -53,6 +53,8 @@ public class JoinCommand extends AbstractWarCommand {
} }
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) { if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) {
this.badMsg("join.disabled"); this.badMsg("join.disabled");
} else if (zone.isReinitializing()) {
this.badMsg("join.disabled");
} else if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOASSIGN)) { } else if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOASSIGN)) {
this.badMsg("join.aarequired"); this.badMsg("join.aarequired");
} else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) { } else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) {

View File

@ -335,7 +335,7 @@ public class WarPlayerListener implements Listener {
if (locLobby != null && currentTeam == null && locLobby.isInAnyGate(playerLoc)) { if (locLobby != null && currentTeam == null && locLobby.isInAnyGate(playerLoc)) {
Warzone zone = locLobby.getZone(); Warzone zone = locLobby.getZone();
Team locTeamGate = locLobby.getTeamGate(playerLoc); Team locTeamGate = locLobby.getTeamGate(playerLoc);
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) { if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED) || zone.isReinitializing()) {
War.war.badMsg(player, "join.disabled"); War.war.badMsg(player, "join.disabled");
event.setTo(zone.getTeleport()); event.setTo(zone.getTeleport());
} else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) { } else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) {
@ -374,7 +374,7 @@ public class WarPlayerListener implements Listener {
if (zone != null && zone.getTeleport() != null) { if (zone != null && zone.getTeleport() != null) {
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOJOIN) if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.AUTOJOIN)
&& zone.getTeams().size() >= 1 && currentTeam == null) { && zone.getTeams().size() >= 1 && currentTeam == null) {
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED)) { if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.DISABLED) || zone.isReinitializing()) {
War.war.badMsg(player, "join.disabled"); War.war.badMsg(player, "join.disabled");
event.setTo(hub.getLocation()); event.setTo(hub.getLocation());
} else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) { } else if (!zone.getWarzoneConfig().getBoolean(WarzoneConfig.JOINMIDBATTLE) && zone.isEnoughPlayers()) {