diff --git a/war/src/main/java/com/tommytony/war/Warzone.java b/war/src/main/java/com/tommytony/war/Warzone.java index f933062..c614af8 100644 --- a/war/src/main/java/com/tommytony/war/Warzone.java +++ b/war/src/main/java/com/tommytony/war/Warzone.java @@ -75,13 +75,15 @@ public class Warzone { private final List respawn = new ArrayList(); private final List reallyDeadFighters = new ArrayList(); - private final WarzoneConfigBag warzoneConfig = new WarzoneConfigBag(); - private final TeamConfigBag teamDefaultConfig = new TeamConfigBag(); + private final WarzoneConfigBag warzoneConfig; + private final TeamConfigBag teamDefaultConfig; private InventoryBag defaultInventories = new InventoryBag(); public Warzone(World world, String name) { this.world = world; this.name = name; + this.warzoneConfig = new WarzoneConfigBag(this); + this.teamDefaultConfig = new TeamConfigBag(); // don't use ctor with Warzone, as this changes config resolution this.volume = new ZoneVolume(name, this.getWorld(), this); } diff --git a/war/src/main/java/com/tommytony/war/command/DeleteTeamCommand.java b/war/src/main/java/com/tommytony/war/command/DeleteTeamCommand.java index 1ff86ff..24240f5 100644 --- a/war/src/main/java/com/tommytony/war/command/DeleteTeamCommand.java +++ b/war/src/main/java/com/tommytony/war/command/DeleteTeamCommand.java @@ -59,6 +59,7 @@ public class DeleteTeamCommand extends AbstractZoneMakerCommand { team.getSpawnVolume().resetBlocks(); zone.getTeams().remove(team); if (zone.getLobby() != null) { + zone.getLobby().setLocation(zone.getTeleport()); zone.getLobby().initialize(); } WarzoneYmlMapper.save(zone, false); diff --git a/war/src/main/java/com/tommytony/war/command/SetTeamCommand.java b/war/src/main/java/com/tommytony/war/command/SetTeamCommand.java index 1b3bbc7..27c47a2 100644 --- a/war/src/main/java/com/tommytony/war/command/SetTeamCommand.java +++ b/war/src/main/java/com/tommytony/war/command/SetTeamCommand.java @@ -56,7 +56,7 @@ public class SetTeamCommand extends AbstractZoneMakerCommand { newTeam.setRemainingLives(newTeam.getTeamConfig().resolveInt(TeamConfig.LIFEPOOL)); zone.getTeams().add(newTeam); if (zone.getLobby() != null) { - zone.getLobby().getVolume().resetBlocks(); + zone.getLobby().setLocation(zone.getTeleport()); zone.getLobby().initialize(); } newTeam.setTeamSpawn(player.getLocation()); diff --git a/war/src/main/java/com/tommytony/war/config/WarzoneConfigBag.java b/war/src/main/java/com/tommytony/war/config/WarzoneConfigBag.java index d5ebc0e..8ab1b1d 100644 --- a/war/src/main/java/com/tommytony/war/config/WarzoneConfigBag.java +++ b/war/src/main/java/com/tommytony/war/config/WarzoneConfigBag.java @@ -6,12 +6,23 @@ import java.util.Map; import org.bukkit.configuration.ConfigurationSection; import com.tommytony.war.War; +import com.tommytony.war.Warzone; public class WarzoneConfigBag { EnumMap bag = new EnumMap(WarzoneConfig.class); + private final Warzone warzone; + public WarzoneConfigBag(Warzone warzone) { + this.warzone = warzone; + } + + public WarzoneConfigBag() { + // default zone settings (at War level) don't have a warzone + this.warzone = null; + } + public void put(WarzoneConfig config, Object value) { bag.put(config, value); } @@ -80,6 +91,10 @@ public class WarzoneConfigBag { } else if (warzoneConfig.getConfigType().equals(Boolean.class)) { String onOff = namedParams.get(namedParam); this.bag.put(warzoneConfig, onOff.equals("on") || onOff.equals("true")); + if (this.warzone != null && namedParam.equals(WarzoneConfig.AUTOASSIGN.toString())) { + this.warzone.getLobby().setLocation(this.warzone.getTeleport()); + this.warzone.getLobby().initialize(); + } } returnMessage += " " + warzoneConfig.toString() + " set to " + namedParams.get(namedParam); } else if (namedParam.equals("delete")) {