mirror of
https://github.com/taoneill/war.git
synced 2024-11-24 03:05:54 +01:00
Warhub works. For one zone at least.
This commit is contained in:
parent
8e74abb69a
commit
2692f7ec8e
@ -87,7 +87,7 @@ public class War extends JavaPlugin {
|
||||
this.defaultLifepool = 7;
|
||||
this.defaultFriendlyFire = false;
|
||||
this.defaultAutoAssignOnly = false;
|
||||
getLogger().info("Loading War files...");
|
||||
getLogger().info("Loading War secrets...");
|
||||
WarMapper.load(this, this.getServer().getWorlds()[0]);
|
||||
getLogger().info("War v" + version + " is on.");
|
||||
}
|
||||
@ -285,15 +285,18 @@ public class War extends JavaPlugin {
|
||||
|
||||
// /setwarhub
|
||||
else if(command.equals("setwarhub")) {
|
||||
WarHub hub = this.getWarHub();
|
||||
if(hub != null) {
|
||||
if(warHub != null) {
|
||||
// reset existing hub
|
||||
hub.getVolume().resetBlocks();
|
||||
hub.setLocation(player.getLocation());
|
||||
hub.initialize();
|
||||
warHub.getVolume().resetBlocks();
|
||||
warHub.setLocation(player.getLocation());
|
||||
warHub.initialize();
|
||||
} else {
|
||||
hub = new WarHub(this, player.getLocation());
|
||||
hub.initialize();
|
||||
warHub = new WarHub(this, player.getLocation());
|
||||
warHub.initialize();
|
||||
for(Warzone zone : warzones) {
|
||||
zone.getLobby().getVolume().resetBlocks();
|
||||
zone.getLobby().initialize();
|
||||
}
|
||||
}
|
||||
WarMapper.save(this);
|
||||
}
|
||||
|
@ -165,8 +165,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
}
|
||||
} else if (zone.getLobby().isInWarHubLinkGate(to)){
|
||||
dropFromOldTeamIfAny(player);
|
||||
event.setTo(to);
|
||||
player.teleportTo(war.getWarHub().getLocation());
|
||||
event.setTo(war.getWarHub().getLocation());
|
||||
}
|
||||
} else if(war.inAnyWarzone(event.getFrom())) { // already in a team and in warzone, leaving
|
||||
if(zone.getLobby().isAutoAssignGate(to)
|
||||
@ -191,7 +190,6 @@ public class WarPlayerListener extends PlayerListener {
|
||||
if(hub != null) {
|
||||
Warzone zone = hub.getDestinationWarzoneForLocation(player.getLocation());
|
||||
synchronized(player) {
|
||||
|
||||
if(zone != null) {
|
||||
event.setTo(zone.getTeleport());
|
||||
//player.teleportTo(zone.getTeleport());
|
||||
|
@ -71,8 +71,9 @@ public class WarHub {
|
||||
|
||||
// draw gates
|
||||
Block currentGateBlock = locationBlock.getFace(BlockFace.SOUTH, halfHubWidth - 2).getFace(BlockFace.WEST, hubDepth);
|
||||
for(Warzone zone : war.getWarzones()) { // gonna use the index to find it again
|
||||
zoneGateBlocks.add(currentGateBlock);
|
||||
|
||||
for(int i = 0;i < war.getWarzones().size(); i++) { // gonna use the index to find it again
|
||||
zoneGateBlocks.add(0, currentGateBlock);
|
||||
currentGateBlock.setType(Material.PORTAL);
|
||||
currentGateBlock.getFace(BlockFace.UP).setType(Material.PORTAL);
|
||||
currentGateBlock.getFace(BlockFace.SOUTH).setType(Material.OBSIDIAN);
|
||||
|
@ -161,6 +161,7 @@ public class WarMapper {
|
||||
WarHub hub = war.getWarHub();
|
||||
if(hub != null) {
|
||||
hubStr = hub.getLocation().getBlockX() + "," + hub.getLocation().getBlockY() + "," + hub.getLocation().getBlockZ();
|
||||
VolumeMapper.save(hub.getVolume(), "", war);
|
||||
}
|
||||
warConfig.setString("warhub", hubStr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user