mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 18:55:28 +01:00
Found that damn gates bug oh yeah.
This commit is contained in:
parent
c9680d7556
commit
8bafd9f372
@ -600,7 +600,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
|
||||
Warzone playerWarzone = war.getPlayerWarzone(player.getName());
|
||||
Warzone playerWarzone = war.getPlayerWarzone(player.getName()); // this uses the teams, so it asks: get the player's team's warzone, to be clearer
|
||||
if(playerWarzone != null) {
|
||||
Team team = war.getPlayerTeam(player.getName());
|
||||
|
||||
@ -632,7 +632,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
}
|
||||
}
|
||||
synchronized(player) {
|
||||
if(!roundOver && war.warzone(player.getLocation()) == null) { // only respawn him if he isnt back at zone yet
|
||||
if(!roundOver && !war.inAnyWarzone(player.getLocation())) { // only respawn him if he isnt back at zone yet
|
||||
playerWarzone.respawnPlayer(event, team, player);
|
||||
player.sendMessage(war.str("You died!"));
|
||||
team.resetSign();
|
||||
@ -651,6 +651,10 @@ public class WarPlayerListener extends PlayerListener {
|
||||
player.setHealth(20);
|
||||
player.sendMessage(war.str("Your dance pleases the monument's voodoo. You gain full health!"));
|
||||
}
|
||||
} else if (war.inAnyWarzone(player.getLocation())) { // player is not in any team, but inside warzone boundaries, get him out
|
||||
Warzone zone = war.warzone(player.getLocation());
|
||||
event.setTo(zone.getTeleport());
|
||||
player.sendMessage(war.str("You can't be inside a warzone without a team."));
|
||||
}
|
||||
|
||||
if(to != null) {
|
||||
|
@ -649,14 +649,14 @@ public class Warzone {
|
||||
if(guard.getPlayer().getName().equals(player.getName())){
|
||||
playerGuards.add(guard);
|
||||
int reset = volume.resetWallBlocks(guard.getWall()); // this should restore old blocks
|
||||
if(drawZoneOutline) {
|
||||
addZoneOutline(guard.getWall());
|
||||
}
|
||||
if(lobby != null) {
|
||||
lobby.getVolume().resetBlocks(); // always reset the lobby even if the guard is on another wall
|
||||
// because player can go around corner
|
||||
lobby.initialize();
|
||||
}
|
||||
if(drawZoneOutline) {
|
||||
addZoneOutline(guard.getWall());
|
||||
}
|
||||
war.getLogger().info("Reset " + reset + " blocks in " + guard.getWall() + "wall of warzone " + name);
|
||||
}
|
||||
}
|
||||
|
@ -370,56 +370,59 @@ public class ZoneLobby {
|
||||
}
|
||||
|
||||
private boolean isPartOfGate(Block gateBlock, Block block) {
|
||||
BlockFace leftSide = null; // look at the zone
|
||||
BlockFace rightSide = null;
|
||||
if(wall == BlockFace.North) {
|
||||
leftSide = BlockFace.East;
|
||||
rightSide = BlockFace.West;
|
||||
} else if(wall == BlockFace.East) {
|
||||
leftSide = BlockFace.South;
|
||||
rightSide = BlockFace.North;
|
||||
} else if(wall == BlockFace.South) {
|
||||
leftSide = BlockFace.West;
|
||||
rightSide = BlockFace.East;
|
||||
} else if(wall == BlockFace.West) {
|
||||
leftSide = BlockFace.North;
|
||||
rightSide = BlockFace.South;
|
||||
if(gateBlock != null) {
|
||||
BlockFace leftSide = null; // look at the zone
|
||||
BlockFace rightSide = null;
|
||||
if(wall == BlockFace.North) {
|
||||
leftSide = BlockFace.East;
|
||||
rightSide = BlockFace.West;
|
||||
} else if(wall == BlockFace.East) {
|
||||
leftSide = BlockFace.South;
|
||||
rightSide = BlockFace.North;
|
||||
} else if(wall == BlockFace.South) {
|
||||
leftSide = BlockFace.West;
|
||||
rightSide = BlockFace.East;
|
||||
} else if(wall == BlockFace.West) {
|
||||
leftSide = BlockFace.North;
|
||||
rightSide = BlockFace.South;
|
||||
}
|
||||
return (block.getX() == gateBlock.getX()
|
||||
&& block.getY() == gateBlock.getY()
|
||||
&& block.getZ() == gateBlock.getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getZ());
|
||||
}
|
||||
return (block.getX() == gateBlock.getX()
|
||||
&& block.getY() == gateBlock.getY()
|
||||
&& block.getZ() == gateBlock.getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(leftSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getFace(BlockFace.Up).getFace(BlockFace.Up).getZ())
|
||||
||
|
||||
(block.getX() == gateBlock.getFace(rightSide).getX()
|
||||
&& block.getY() == gateBlock.getFace(rightSide).getY()
|
||||
&& block.getZ() == gateBlock.getFace(rightSide).getZ());
|
||||
return false;
|
||||
}
|
||||
|
||||
public Warzone getZone() {
|
||||
|
@ -39,9 +39,9 @@ public class ZoneWallGuard {
|
||||
|
||||
// add wall guard blocks
|
||||
for(Block block : nearestWallBlocks) {
|
||||
block.setType(Material.GLASS);
|
||||
block.getFace(BlockFace.Up).setType(Material.GLASS);
|
||||
block.getFace(BlockFace.Down).setType(Material.GLASS);
|
||||
toGlass(block, wall);
|
||||
toGlass(block.getFace(BlockFace.Up), wall);
|
||||
toGlass(block.getFace(BlockFace.Down), wall);
|
||||
if(this.wall == BlockFace.North && warzone.getVolume().isNorthWallBlock(block)) {
|
||||
toGlass(block.getFace(BlockFace.East), BlockFace.North);
|
||||
toGlass(block.getFace(BlockFace.East).getFace(BlockFace.Up), BlockFace.North);
|
||||
|
Loading…
Reference in New Issue
Block a user