mirror of
https://github.com/taoneill/war.git
synced 2024-11-30 14:13:23 +01:00
Closes gh-2. No more dropping precious blocks out the lobby gates. Leaving is now detecting in a much bigger volume.
This commit is contained in:
parent
9a58dad30f
commit
c68f864be9
@ -383,19 +383,42 @@ public class ZoneLobby {
|
|||||||
|
|
||||||
public boolean isInTeamGate(Material team, Location location) {
|
public boolean isInTeamGate(Material team, Location location) {
|
||||||
if(team == TeamMaterials.TEAMDIAMOND && diamondGate != null
|
if(team == TeamMaterials.TEAMDIAMOND && diamondGate != null
|
||||||
&& location.getBlockX() == diamondGate.getX()
|
&&
|
||||||
|
(
|
||||||
|
(location.getBlockX() == diamondGate.getFace(this.getWall()).getX()
|
||||||
|
&& location.getBlockY() == diamondGate.getFace(this.getWall()).getY()
|
||||||
|
&& location.getBlockZ() == diamondGate.getFace(this.getWall()).getZ())
|
||||||
|
||
|
||||||
|
(location.getBlockX() == diamondGate.getX()
|
||||||
&& location.getBlockY() == diamondGate.getY()
|
&& location.getBlockY() == diamondGate.getY()
|
||||||
&& location.getBlockZ() == diamondGate.getZ()) {
|
&& location.getBlockZ() == diamondGate.getZ())
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
} else if(team == TeamMaterials.TEAMIRON && ironGate != null
|
} else if(team == TeamMaterials.TEAMIRON && ironGate != null
|
||||||
&& location.getBlockX() == ironGate.getX()
|
&&
|
||||||
|
(
|
||||||
|
(location.getBlockX() == ironGate.getFace(this.getWall()).getX()
|
||||||
|
&& location.getBlockY() == ironGate.getFace(this.getWall()).getY()
|
||||||
|
&& location.getBlockZ() == ironGate.getFace(this.getWall()).getZ())
|
||||||
|
||
|
||||||
|
(location.getBlockX() == ironGate.getX()
|
||||||
&& location.getBlockY() == ironGate.getY()
|
&& location.getBlockY() == ironGate.getY()
|
||||||
&& location.getBlockZ() == ironGate.getZ()) {
|
&& location.getBlockZ() == ironGate.getZ())
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
} else if(team == TeamMaterials.TEAMGOLD && goldGate != null
|
} else if(team == TeamMaterials.TEAMGOLD && goldGate != null
|
||||||
&& location.getBlockX() == goldGate.getX()
|
&& (
|
||||||
|
(location.getBlockX() == goldGate.getFace(this.getWall()).getX()
|
||||||
|
&& location.getBlockY() == goldGate.getFace(this.getWall()).getY()
|
||||||
|
&& location.getBlockZ() == goldGate.getFace(this.getWall()).getZ())
|
||||||
|
||
|
||||||
|
(location.getBlockX() == goldGate.getX()
|
||||||
&& location.getBlockY() == goldGate.getY()
|
&& location.getBlockY() == goldGate.getY()
|
||||||
&& location.getBlockZ() == goldGate.getZ()) {
|
&& location.getBlockZ() == goldGate.getZ())
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -403,9 +426,17 @@ public class ZoneLobby {
|
|||||||
|
|
||||||
public boolean isAutoAssignGate(Location location) {
|
public boolean isAutoAssignGate(Location location) {
|
||||||
if(autoAssignGate != null
|
if(autoAssignGate != null
|
||||||
&& location.getBlockX() == autoAssignGate.getX()
|
&&
|
||||||
|
(
|
||||||
|
(location.getBlockX() == autoAssignGate.getFace(this.getWall()).getX()
|
||||||
|
&& location.getBlockY() == autoAssignGate.getFace(this.getWall()).getY()
|
||||||
|
&& location.getBlockZ() == autoAssignGate.getFace(this.getWall()).getZ())
|
||||||
|
||
|
||||||
|
(location.getBlockX() == autoAssignGate.getX()
|
||||||
&& location.getBlockY() == autoAssignGate.getY()
|
&& location.getBlockY() == autoAssignGate.getY()
|
||||||
&& location.getBlockZ() == autoAssignGate.getZ()) {
|
&& location.getBlockZ() == autoAssignGate.getZ())
|
||||||
|
)
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -623,28 +654,48 @@ public class ZoneLobby {
|
|||||||
|
|
||||||
private boolean leaving(Location location, Block gate, BlockFace inside,
|
private boolean leaving(Location location, Block gate, BlockFace inside,
|
||||||
BlockFace left, BlockFace right) {
|
BlockFace left, BlockFace right) {
|
||||||
int x = location.getBlockX();
|
// int x = location.getBlockX();
|
||||||
int y = location.getBlockY();
|
// int y = location.getBlockY();
|
||||||
int z = location.getBlockZ();
|
// int z = location.getBlockZ();
|
||||||
|
//
|
||||||
|
// 5x3x3 deep
|
||||||
|
Volume gateExitVolume = new Volume("tempGateExit", war, location.getWorld());
|
||||||
Block out = gate.getFace(inside);
|
Block out = gate.getFace(inside);
|
||||||
Block outL = out.getFace(left);
|
gateExitVolume.setCornerOne(out.getFace(left, 2));
|
||||||
Block outR = out.getFace(right);
|
gateExitVolume.setCornerTwo(out.getFace(right, 2).getFace(inside, 2).getFace(BlockFace.UP, 2));
|
||||||
|
|
||||||
|
if(gateExitVolume.contains(location)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 block thick arrow like detection grid:
|
||||||
|
// Block out = gate.getFace(inside);
|
||||||
|
// Block outL = out.getFace(left);
|
||||||
|
// Block outLL = out.getFace(left, 2);
|
||||||
|
// Block outR = out.getFace(right);
|
||||||
|
// Block outRR = out.getFace(right, 2);
|
||||||
// Block out2 = gate.getFace(inside, 2);
|
// Block out2 = gate.getFace(inside, 2);
|
||||||
// Block out2L = out2.getFace(left);
|
// Block out2L = out2.getFace(left);
|
||||||
// Block out2R = out2.getFace(right);
|
// Block out2R = out2.getFace(right);
|
||||||
if(out.getX() == x && out.getY() == y && out.getZ() == z) {
|
// Block out3 = gate.getFace(inside, 3);
|
||||||
return true;
|
// if(out.getX() == x && out.getY() == y && out.getZ() == z) {
|
||||||
} else if(outL.getX() == x && outL.getY() == y && outL.getZ() == z) {
|
// return true;
|
||||||
return true;
|
// } else if(outL.getX() == x && outL.getY() == y && outL.getZ() == z) {
|
||||||
} else if(outR.getX() == x && outR.getY() == y && outR.getZ() == z) {
|
// return true;
|
||||||
return true;
|
// } else if(outR.getX() == x && outR.getY() == y && outR.getZ() == z) {
|
||||||
}
|
// return true;
|
||||||
|
// } else if(outLL.getX() == x && outLL.getY() == y && outLL.getZ() == z) {
|
||||||
|
// return true;
|
||||||
|
// } else if(outRR.getX() == x && outRR.getY() == y && outRR.getZ() == z) {
|
||||||
|
// return true;
|
||||||
// } else if(out2.getX() == x && out2.getY() == y && out2.getZ() == z) {
|
// } else if(out2.getX() == x && out2.getY() == y && out2.getZ() == z) {
|
||||||
// return true;
|
// return true;
|
||||||
// } else if(out2L.getX() == x && out2L.getY() == y && out2L.getZ() == z) {
|
// } else if(out2L.getX() == x && out2L.getY() == y && out2L.getZ() == z) {
|
||||||
// return true;
|
// return true;
|
||||||
// } else if(out2R.getX() == x && out2R.getY() == y && out2R.getZ() == z) {
|
// } else if(out2R.getX() == x && out2R.getY() == y && out2R.getZ() == z) {
|
||||||
// return true;
|
// return true;
|
||||||
|
// } else if(out3.getX() == x && out3.getY() == y && out3.getZ() == z) {
|
||||||
|
// return true;
|
||||||
// }
|
// }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user