mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Added { } around single returns too
This commit is contained in:
parent
88b2e5051d
commit
1d9dcb8a00
@ -1207,7 +1207,9 @@ public class War extends JavaPlugin {
|
|||||||
public Team getPlayerTeam(String playerName) {
|
public Team getPlayerTeam(String playerName) {
|
||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
Team team = warzone.getPlayerTeam(playerName);
|
Team team = warzone.getPlayerTeam(playerName);
|
||||||
if (team != null) return team;
|
if (team != null) {
|
||||||
|
return team;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1215,7 +1217,9 @@ public class War extends JavaPlugin {
|
|||||||
public Warzone getPlayerTeamWarzone(String playerName) {
|
public Warzone getPlayerTeamWarzone(String playerName) {
|
||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
Team team = warzone.getPlayerTeam(playerName);
|
Team team = warzone.getPlayerTeam(playerName);
|
||||||
if (team != null) return warzone;
|
if (team != null) {
|
||||||
|
return warzone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1227,7 +1231,9 @@ public class War extends JavaPlugin {
|
|||||||
public Warzone warzone(Location location) {
|
public Warzone warzone(Location location) {
|
||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
if (location.getWorld().getName().equals(warzone.getWorld().getName())
|
if (location.getWorld().getName().equals(warzone.getWorld().getName())
|
||||||
&& warzone.getVolume() != null && warzone.getVolume().contains(location)) return warzone;
|
&& warzone.getVolume() != null && warzone.getVolume().contains(location)) {
|
||||||
|
return warzone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1235,19 +1241,22 @@ public class War extends JavaPlugin {
|
|||||||
public boolean inAnyWarzone(Location location) {
|
public boolean inAnyWarzone(Location location) {
|
||||||
Block locBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
Block locBlock = location.getWorld().getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||||
Warzone currentZone = this.warzone(location);
|
Warzone currentZone = this.warzone(location);
|
||||||
if (currentZone == null)
|
if (currentZone == null) {
|
||||||
return false;
|
return false;
|
||||||
else if (currentZone.getVolume().isWallBlock(locBlock))
|
} else if (currentZone.getVolume().isWallBlock(locBlock))
|
||||||
|
{
|
||||||
return false; // wall block doesnt count. this lets people in at the lobby side wall because wall gates overlap with the zone.
|
return false; // wall block doesnt count. this lets people in at the lobby side wall because wall gates overlap with the zone.
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inWarzone(String warzoneName, Location location) {
|
public boolean inWarzone(String warzoneName, Location location) {
|
||||||
Warzone currentZone = this.warzone(location);
|
Warzone currentZone = this.warzone(location);
|
||||||
if (currentZone == null)
|
if (currentZone == null) {
|
||||||
return false;
|
return false;
|
||||||
else if (warzoneName.toLowerCase().equals(currentZone.getName().toLowerCase()))
|
} else if (warzoneName.toLowerCase().equals(currentZone.getName().toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1287,20 +1296,23 @@ public class War extends JavaPlugin {
|
|||||||
// the only way to find a zone that has only one corner
|
// the only way to find a zone that has only one corner
|
||||||
public Warzone findWarzone(String warzoneName) {
|
public Warzone findWarzone(String warzoneName) {
|
||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
if (warzone.getName().toLowerCase().equals(warzoneName.toLowerCase()))
|
if (warzone.getName().toLowerCase().equals(warzoneName.toLowerCase())) {
|
||||||
return warzone;
|
return warzone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (Warzone warzone : this.incompleteZones) {
|
for (Warzone warzone : this.incompleteZones) {
|
||||||
if (warzone.getName().equals(warzoneName))
|
if (warzone.getName().equals(warzoneName)) {
|
||||||
return warzone;
|
return warzone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Warzone matchWarzone(String warzoneSubString) {
|
public Warzone matchWarzone(String warzoneSubString) {
|
||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
if (warzone.getName().toLowerCase().startsWith(warzoneSubString.toLowerCase()))
|
if (warzone.getName().toLowerCase().startsWith(warzoneSubString.toLowerCase())) {
|
||||||
return warzone;
|
return warzone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1342,8 +1354,9 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getWandBearerZone(Player player) {
|
public String getWandBearerZone(Player player) {
|
||||||
if (this.isWandBearer(player))
|
if (this.isWandBearer(player)) {
|
||||||
return this.wandBearers.get(player.getName());
|
return this.wandBearers.get(player.getName());
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1387,7 +1400,9 @@ public class War extends JavaPlugin {
|
|||||||
|
|
||||||
public Warzone zoneOfZoneWallAtProximity(Location location) {
|
public Warzone zoneOfZoneWallAtProximity(Location location) {
|
||||||
for (Warzone zone : this.warzones) {
|
for (Warzone zone : this.warzones) {
|
||||||
if (zone.getWorld() == location.getWorld() && zone.isNearWall(location)) return zone;
|
if (zone.getWorld() == location.getWorld() && zone.isNearWall(location)) {
|
||||||
|
return zone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1399,22 +1414,26 @@ public class War extends JavaPlugin {
|
|||||||
public boolean canPlayWar(Player player) {
|
public boolean canPlayWar(Player player) {
|
||||||
if (War.permissionHandler != null
|
if (War.permissionHandler != null
|
||||||
&& (War.permissionHandler.has(player, "war.player")
|
&& (War.permissionHandler.has(player, "war.player")
|
||||||
|| War.permissionHandler.has(player, "War.player")))
|
|| War.permissionHandler.has(player, "War.player"))) {
|
||||||
return true;
|
return true;
|
||||||
if (War.permissionHandler == null)
|
}
|
||||||
|
if (War.permissionHandler == null) {
|
||||||
// w/o Permissions, everyone can play
|
// w/o Permissions, everyone can play
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canWarp(Player player) {
|
public boolean canWarp(Player player) {
|
||||||
if (War.permissionHandler != null
|
if (War.permissionHandler != null
|
||||||
&& (War.permissionHandler.has(player, "war.warp")
|
&& (War.permissionHandler.has(player, "war.warp")
|
||||||
|| War.permissionHandler.has(player, "War.warp")))
|
|| War.permissionHandler.has(player, "War.warp"))) {
|
||||||
return true;
|
return true;
|
||||||
if (War.permissionHandler == null)
|
}
|
||||||
|
if (War.permissionHandler == null) {
|
||||||
// w/o Permissions, everyone can warp
|
// w/o Permissions, everyone can warp
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1422,43 +1441,52 @@ public class War extends JavaPlugin {
|
|||||||
if (this.isBuildInZonesOnly()) {
|
if (this.isBuildInZonesOnly()) {
|
||||||
if (War.permissionHandler != null
|
if (War.permissionHandler != null
|
||||||
&& (War.permissionHandler.has(player, "war.build")
|
&& (War.permissionHandler.has(player, "war.build")
|
||||||
|| War.permissionHandler.has(player, "War.build")))
|
|| War.permissionHandler.has(player, "War.build"))) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
// w/o Permissions, if buildInZonesOnly, no one can build outside the zone except Zonemakers
|
// w/o Permissions, if buildInZonesOnly, no one can build outside the zone except Zonemakers
|
||||||
return this.isZoneMaker(player);
|
return this.isZoneMaker(player);
|
||||||
} else
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPvpOutsideZones(Player player) {
|
public boolean canPvpOutsideZones(Player player) {
|
||||||
if (this.isPvpInZonesOnly()) {
|
if (this.isPvpInZonesOnly()) {
|
||||||
if (War.permissionHandler != null
|
if (War.permissionHandler != null
|
||||||
&& (War.permissionHandler.has(player, "war.pvp")
|
&& (War.permissionHandler.has(player, "war.pvp")
|
||||||
|| War.permissionHandler.has(player, "War.pvp")))
|
|| War.permissionHandler.has(player, "War.pvp"))) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
// w/o Permissions, if pvpInZoneOnly, no one can pvp outside the zone
|
// w/o Permissions, if pvpInZoneOnly, no one can pvp outside the zone
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isZoneMaker(Player player) {
|
public boolean isZoneMaker(Player player) {
|
||||||
for (String disguised : this.zoneMakersImpersonatingPlayers) {
|
for (String disguised : this.zoneMakersImpersonatingPlayers) {
|
||||||
if (disguised.equals(player.getName())) return false;
|
if (disguised.equals(player.getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String zoneMaker : this.zoneMakerNames) {
|
for (String zoneMaker : this.zoneMakerNames) {
|
||||||
if (zoneMaker.equals(player.getName())) return true;
|
if (zoneMaker.equals(player.getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( War.permissionHandler != null
|
if ( War.permissionHandler != null
|
||||||
&& (
|
&& (
|
||||||
War.permissionHandler.has(player, "war.*")
|
War.permissionHandler.has(player, "war.*")
|
||||||
|| War.permissionHandler.has(player, "War.*")
|
|| War.permissionHandler.has(player, "War.*")
|
||||||
)
|
)
|
||||||
)
|
) {
|
||||||
return true;
|
return true;
|
||||||
else
|
} else {
|
||||||
return player.isOp();
|
return player.isOp();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDefaultAutoAssignOnly() {
|
public boolean getDefaultAutoAssignOnly() {
|
||||||
@ -1482,24 +1510,27 @@ public class War extends JavaPlugin {
|
|||||||
for (Warzone warzone : this.warzones) {
|
for (Warzone warzone : this.warzones) {
|
||||||
if (warzone.getLobby() != null
|
if (warzone.getLobby() != null
|
||||||
&& warzone.getLobby().getVolume() != null
|
&& warzone.getLobby().getVolume() != null
|
||||||
&& warzone.getLobby().getVolume().contains(location))
|
&& warzone.getLobby().getVolume().contains(location)) {
|
||||||
return warzone.getLobby();
|
return warzone.getLobby();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inAnyWarzoneLobby(Location location) {
|
public boolean inAnyWarzoneLobby(Location location) {
|
||||||
if (this.lobby(location) == null)
|
if (this.lobby(location) == null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inWarzoneLobby(String warzoneName, Location location) {
|
public boolean inWarzoneLobby(String warzoneName, Location location) {
|
||||||
ZoneLobby currentLobby = this.lobby(location);
|
ZoneLobby currentLobby = this.lobby(location);
|
||||||
if (currentLobby == null)
|
if (currentLobby == null) {
|
||||||
return false;
|
return false;
|
||||||
else if (warzoneName.toLowerCase().equals(currentLobby.getZone().getName().toLowerCase()))
|
} else if (warzoneName.toLowerCase().equals(currentLobby.getZone().getName().toLowerCase())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,14 +102,16 @@ public class Monument {
|
|||||||
int diffX = Math.abs(playerX - x);
|
int diffX = Math.abs(playerX - x);
|
||||||
int diffY = Math.abs(playerY - y);
|
int diffY = Math.abs(playerY - y);
|
||||||
int diffZ = Math.abs(playerZ - z);
|
int diffZ = Math.abs(playerZ - z);
|
||||||
if (diffX < 6 && diffY < 6 && diffZ < 6)
|
if (diffX < 6 && diffY < 6 && diffZ < 6) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOwner(Team team) {
|
public boolean isOwner(Team team) {
|
||||||
if (team == this.ownerTeam)
|
if (team == this.ownerTeam) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,8 +548,9 @@ public class Team {
|
|||||||
int flagZ = this.teamFlag.getBlockZ();
|
int flagZ = this.teamFlag.getBlockZ();
|
||||||
if (block.getX() == flagX
|
if (block.getX() == flagX
|
||||||
&& block.getY() == flagY
|
&& block.getY() == flagY
|
||||||
&& block.getZ() == flagZ)
|
&& block.getZ() == flagZ) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,9 @@ public class TeamKinds {
|
|||||||
public static TeamKind teamKindFromString(String str) {
|
public static TeamKind teamKindFromString(String str) {
|
||||||
String lowered = str.toLowerCase();
|
String lowered = str.toLowerCase();
|
||||||
for (TeamKind kind : TeamKinds.getTeamkinds()) {
|
for (TeamKind kind : TeamKinds.getTeamkinds()) {
|
||||||
if (kind.getDefaultName().startsWith(lowered))
|
if (kind.getDefaultName().startsWith(lowered)) {
|
||||||
return kind;
|
return kind;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,9 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean ready() {
|
public boolean ready() {
|
||||||
if (this.volume.hasTwoCorners() && !this.volume.tooSmall() && !this.volume.tooBig()) return true;
|
if (this.volume.hasTwoCorners() && !this.volume.tooSmall() && !this.volume.tooBig()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +99,9 @@ public class Warzone {
|
|||||||
public Team getPlayerTeam(String playerName) {
|
public Team getPlayerTeam(String playerName) {
|
||||||
for (Team team : this.teams) {
|
for (Team team : this.teams) {
|
||||||
for (Player player : team.getPlayers()) {
|
for (Player player : team.getPlayers()) {
|
||||||
if (player.getName().equals(playerName))
|
if (player.getName().equals(playerName)) {
|
||||||
return team;
|
return team;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -276,8 +279,9 @@ public class Warzone {
|
|||||||
int x = monument.getLocation().getBlockX();
|
int x = monument.getLocation().getBlockX();
|
||||||
int y = monument.getLocation().getBlockY() + 1;
|
int y = monument.getLocation().getBlockY() + 1;
|
||||||
int z = monument.getLocation().getBlockZ();
|
int z = monument.getLocation().getBlockZ();
|
||||||
if (x == block.getX() && y == block.getY() && z == block.getZ())
|
if (x == block.getX() && y == block.getY() && z == block.getZ()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -287,16 +291,18 @@ public class Warzone {
|
|||||||
int x = monument.getLocation().getBlockX();
|
int x = monument.getLocation().getBlockX();
|
||||||
int y = monument.getLocation().getBlockY() + 1;
|
int y = monument.getLocation().getBlockY() + 1;
|
||||||
int z = monument.getLocation().getBlockZ();
|
int z = monument.getLocation().getBlockZ();
|
||||||
if (x == block.getX() && y == block.getY() && z == block.getZ())
|
if (x == block.getX() && y == block.getY() && z == block.getZ()) {
|
||||||
return monument;
|
return monument;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean nearAnyOwnedMonument(Location to, Team team) {
|
public boolean nearAnyOwnedMonument(Location to, Team team) {
|
||||||
for (Monument monument : this.monuments) {
|
for (Monument monument : this.monuments) {
|
||||||
if (monument.isNear(to) && monument.isOwner(team))
|
if (monument.isNear(to) && monument.isOwner(team)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -392,22 +398,26 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InventoryStash getPlayerInventory(String playerName) {
|
public InventoryStash getPlayerInventory(String playerName) {
|
||||||
if (this.inventories.containsKey(playerName)) return this.inventories.get(playerName);
|
if (this.inventories.containsKey(playerName)) {
|
||||||
|
return this.inventories.get(playerName);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMonument(String monumentName) {
|
public boolean hasMonument(String monumentName) {
|
||||||
for (Monument monument: this.monuments) {
|
for (Monument monument: this.monuments) {
|
||||||
if (monument.getName().equals(monumentName))
|
if (monument.getName().equals(monumentName)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Monument getMonument(String monumentName) {
|
public Monument getMonument(String monumentName) {
|
||||||
for (Monument monument: this.monuments) {
|
for (Monument monument: this.monuments) {
|
||||||
if (monument.getName().startsWith(monumentName))
|
if (monument.getName().startsWith(monumentName)) {
|
||||||
return monument;
|
return monument;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -415,18 +425,21 @@ public class Warzone {
|
|||||||
public boolean isImportantBlock(Block block) {
|
public boolean isImportantBlock(Block block) {
|
||||||
if (this.ready()) {
|
if (this.ready()) {
|
||||||
for (Monument m : this.monuments) {
|
for (Monument m : this.monuments) {
|
||||||
if (m.getVolume().contains(block))
|
if (m.getVolume().contains(block)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (Team t : this.teams) {
|
for (Team t : this.teams) {
|
||||||
if (t.getSpawnVolume().contains(block))
|
if (t.getSpawnVolume().contains(block)) {
|
||||||
return true;
|
return true;
|
||||||
else if (t.getFlagVolume() != null
|
} else if (t.getFlagVolume() != null
|
||||||
&& t.getFlagVolume().contains(block))
|
&& t.getFlagVolume().contains(block)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.volume.isWallBlock(block))
|
if (this.volume.isWallBlock(block)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -450,8 +463,9 @@ public class Warzone {
|
|||||||
|
|
||||||
public Team getTeamByKind(TeamKind kind) {
|
public Team getTeamByKind(TeamKind kind) {
|
||||||
for (Team t : this.teams) {
|
for (Team t : this.teams) {
|
||||||
if (t.getKind() == kind)
|
if (t.getKind() == kind) {
|
||||||
return t;
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -462,38 +476,40 @@ public class Warzone {
|
|||||||
&& latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX()
|
&& latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX()
|
||||||
&& latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX()
|
&& latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX()
|
||||||
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
||||||
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY())
|
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
|
||||||
return true; // near east wall
|
return true; // near east wall
|
||||||
else if (Math.abs(this.volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall
|
} else if (Math.abs(this.volume.getSoutheastX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall
|
||||||
&& latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ()
|
&& latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ()
|
||||||
&& latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ()
|
&& latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ()
|
||||||
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
||||||
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY())
|
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
|
||||||
return true; // near south wall
|
return true; // near south wall
|
||||||
else if (Math.abs(this.volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall
|
} else if (Math.abs(this.volume.getNorthwestX() - latestPlayerLocation.getBlockX()) < this.minSafeDistanceFromWall
|
||||||
&& latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ()
|
&& latestPlayerLocation.getBlockZ() <= this.volume.getNorthwestZ()
|
||||||
&& latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ()
|
&& latestPlayerLocation.getBlockZ() >= this.volume.getSoutheastZ()
|
||||||
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
||||||
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY())
|
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
|
||||||
return true; // near north wall
|
return true; // near north wall
|
||||||
else if (Math.abs(this.volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < this.minSafeDistanceFromWall
|
} else if (Math.abs(this.volume.getNorthwestZ() - latestPlayerLocation.getBlockZ()) < this.minSafeDistanceFromWall
|
||||||
&& latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX()
|
&& latestPlayerLocation.getBlockX() <= this.volume.getSoutheastX()
|
||||||
&& latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX()
|
&& latestPlayerLocation.getBlockX() >= this.volume.getNorthwestX()
|
||||||
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
&& latestPlayerLocation.getBlockY() >= this.volume.getMinY()
|
||||||
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY())
|
&& latestPlayerLocation.getBlockY() <= this.volume.getMaxY()) {
|
||||||
return true; // near west wall
|
return true; // near west wall
|
||||||
else if (Math.abs(this.volume.getMaxY() - latestPlayerLocation.getBlockY()) < this.minSafeDistanceFromWall
|
} else if (Math.abs(this.volume.getMaxY() - latestPlayerLocation.getBlockY()) < this.minSafeDistanceFromWall
|
||||||
&& latestPlayerLocation.getBlockX() <= this.volume.getMaxX()
|
&& latestPlayerLocation.getBlockX() <= this.volume.getMaxX()
|
||||||
&& latestPlayerLocation.getBlockX() >= this.volume.getMinX()
|
&& latestPlayerLocation.getBlockX() >= this.volume.getMinX()
|
||||||
&& latestPlayerLocation.getBlockZ() <= this.volume.getMaxZ()
|
&& latestPlayerLocation.getBlockZ() <= this.volume.getMaxZ()
|
||||||
&& latestPlayerLocation.getBlockZ() >= this.volume.getMinZ())
|
&& latestPlayerLocation.getBlockZ() >= this.volume.getMinZ()) {
|
||||||
return true; // near up wall
|
return true; // near up wall
|
||||||
else if (Math.abs(this.volume.getMinY() - latestPlayerLocation.getBlockY()) < this.minSafeDistanceFromWall
|
} else if (Math.abs(this.volume.getMinY() - latestPlayerLocation.getBlockY()) < this.minSafeDistanceFromWall
|
||||||
&& latestPlayerLocation.getBlockX() <= this.volume.getMaxX()
|
&& latestPlayerLocation.getBlockX() <= this.volume.getMaxX()
|
||||||
&& latestPlayerLocation.getBlockX() >= this.volume.getMinX()
|
&& latestPlayerLocation.getBlockX() >= this.volume.getMinX()
|
||||||
&& latestPlayerLocation.getBlockZ() <= this.volume.getMaxZ()
|
&& latestPlayerLocation.getBlockZ() <= this.volume.getMaxZ()
|
||||||
&& latestPlayerLocation.getBlockZ() >= this.volume.getMinZ())
|
&& latestPlayerLocation.getBlockZ() >= this.volume.getMinZ())
|
||||||
|
{
|
||||||
return true; // near down wall
|
return true; // near down wall
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -623,8 +639,9 @@ public class Warzone {
|
|||||||
|
|
||||||
public ZoneWallGuard getPlayerZoneWallGuard(String name, BlockFace wall) {
|
public ZoneWallGuard getPlayerZoneWallGuard(String name, BlockFace wall) {
|
||||||
for (ZoneWallGuard guard : this.zoneWallGuards) {
|
for (ZoneWallGuard guard : this.zoneWallGuards) {
|
||||||
if (guard.getPlayer().getName().equals(name) && wall == guard.getWall())
|
if (guard.getPlayer().getName().equals(name) && wall == guard.getWall()) {
|
||||||
return guard;
|
return guard;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -883,16 +900,18 @@ public class Warzone {
|
|||||||
public boolean isEnemyTeamFlagBlock(Team playerTeam, Block block) {
|
public boolean isEnemyTeamFlagBlock(Team playerTeam, Block block) {
|
||||||
for (Team team : this.teams) {
|
for (Team team : this.teams) {
|
||||||
if (!team.getName().equals(playerTeam.getName())
|
if (!team.getName().equals(playerTeam.getName())
|
||||||
&& team.isTeamFlagBlock(block))
|
&& team.isTeamFlagBlock(block)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team getTeamForFlagBlock(Block block) {
|
public Team getTeamForFlagBlock(Block block) {
|
||||||
for (Team team : this.teams) {
|
for (Team team : this.teams) {
|
||||||
if (team.isTeamFlagBlock(block))
|
if (team.isTeamFlagBlock(block)) {
|
||||||
return team;
|
return team;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -902,7 +921,9 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFlagThief(String suspect) {
|
public boolean isFlagThief(String suspect) {
|
||||||
if (this.flagThieves.containsKey(suspect)) return true;
|
if (this.flagThieves.containsKey(suspect)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -920,8 +941,9 @@ public class Warzone {
|
|||||||
|
|
||||||
public boolean isTeamFlagStolen(Team team) {
|
public boolean isTeamFlagStolen(Team team) {
|
||||||
for (String playerKey : this.flagThieves.keySet()) {
|
for (String playerKey : this.flagThieves.keySet()) {
|
||||||
if (this.flagThieves.get(playerKey).getName().equals(team.getName()))
|
if (this.flagThieves.get(playerKey).getName().equals(team.getName())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1000,8 +1022,9 @@ public class Warzone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeadMan(String playerName) {
|
public boolean isDeadMan(String playerName) {
|
||||||
if (this.deadMenInventories.containsKey(playerName))
|
if (this.deadMenInventories.containsKey(playerName)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,8 +544,9 @@ public class ZoneLobby {
|
|||||||
if (info != null) {
|
if (info != null) {
|
||||||
if (location.getBlockX() == info.getX()
|
if (location.getBlockX() == info.getX()
|
||||||
&& location.getBlockY() == info.getY()
|
&& location.getBlockY() == info.getY()
|
||||||
&& location.getBlockZ() == info.getZ())
|
&& location.getBlockZ() == info.getZ()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -554,8 +555,9 @@ public class ZoneLobby {
|
|||||||
if (this.autoAssignGate != null
|
if (this.autoAssignGate != null
|
||||||
&& (location.getBlockX() == this.autoAssignGate.getX()
|
&& (location.getBlockX() == this.autoAssignGate.getX()
|
||||||
&& location.getBlockY() == this.autoAssignGate.getY()
|
&& location.getBlockY() == this.autoAssignGate.getY()
|
||||||
&& location.getBlockZ() == this.autoAssignGate.getZ()) )
|
&& location.getBlockZ() == this.autoAssignGate.getZ()) ) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -576,8 +578,9 @@ public class ZoneLobby {
|
|||||||
if (this.warHubLinkGate != null
|
if (this.warHubLinkGate != null
|
||||||
&& location.getBlockX() == this.warHubLinkGate.getX()
|
&& location.getBlockX() == this.warHubLinkGate.getX()
|
||||||
&& location.getBlockY() == this.warHubLinkGate.getY()
|
&& location.getBlockY() == this.warHubLinkGate.getY()
|
||||||
&& location.getBlockZ() == this.warHubLinkGate.getZ())
|
&& location.getBlockZ() == this.warHubLinkGate.getZ()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,12 +588,14 @@ public class ZoneLobby {
|
|||||||
if (blockWall == this.wall) {
|
if (blockWall == this.wall) {
|
||||||
for (String teamName: this.teamGateBlocks.keySet()) {
|
for (String teamName: this.teamGateBlocks.keySet()) {
|
||||||
BlockInfo gateInfo = this.teamGateBlocks.get(teamName);
|
BlockInfo gateInfo = this.teamGateBlocks.get(teamName);
|
||||||
if (this.isPartOfGate(BlockInfo.getBlock(this.warzone.getWorld(), gateInfo), block))
|
if (this.isPartOfGate(BlockInfo.getBlock(this.warzone.getWorld(), gateInfo), block)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.autoAssignGate != null && this.isPartOfGate(BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate), block))
|
if (this.autoAssignGate != null && this.isPartOfGate(BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate), block)) {
|
||||||
// auto assign
|
// auto assign
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -753,12 +758,16 @@ public class ZoneLobby {
|
|||||||
right = BlockFace.NORTH;
|
right = BlockFace.NORTH;
|
||||||
}
|
}
|
||||||
if (this.autoAssignGate != null){
|
if (this.autoAssignGate != null){
|
||||||
if (this.leaving(location, BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate), inside, left, right)) return true;
|
if (this.leaving(location, BlockInfo.getBlock(this.warzone.getWorld(), this.autoAssignGate), inside, left, right)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (String teamName : this.teamGateBlocks.keySet()) {
|
for (String teamName : this.teamGateBlocks.keySet()) {
|
||||||
|
|
||||||
BlockInfo info = this.teamGateBlocks.get(teamName);
|
BlockInfo info = this.teamGateBlocks.get(teamName);
|
||||||
if (this.leaving(location, BlockInfo.getBlock(this.warzone.getWorld(), info), inside, left, right)) return true;
|
if (this.leaving(location, BlockInfo.getBlock(this.warzone.getWorld(), info), inside, left, right)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -775,8 +784,9 @@ public class ZoneLobby {
|
|||||||
gateExitVolume.setCornerOne(out.getFace(left).getFace(BlockFace.DOWN));
|
gateExitVolume.setCornerOne(out.getFace(left).getFace(BlockFace.DOWN));
|
||||||
gateExitVolume.setCornerTwo(gate.getFace(right, 1).getFace(BlockFace.UP, 3));
|
gateExitVolume.setCornerTwo(gate.getFace(right, 1).getFace(BlockFace.UP, 3));
|
||||||
|
|
||||||
if (gateExitVolume.contains(location))
|
if (gateExitVolume.contains(location)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 1 block thick arrow like detection grid:
|
// 1 block thick arrow like detection grid:
|
||||||
// Block out = gate.getFace(inside);
|
// Block out = gate.getFace(inside);
|
||||||
|
@ -162,8 +162,9 @@ public final class PropertiesFile {
|
|||||||
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to "" or empty.
|
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to "" or empty.
|
||||||
*/
|
*/
|
||||||
public String getString(String key) {
|
public String getString(String key) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return this.getProperty(key);
|
return this.getProperty(key);
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -179,8 +180,9 @@ public final class PropertiesFile {
|
|||||||
* @return java.lang.String Either we will return the default value or a prior existing value depending on existance.
|
* @return java.lang.String Either we will return the default value or a prior existing value depending on existance.
|
||||||
*/
|
*/
|
||||||
public String getString(String key, String value) {
|
public String getString(String key, String value) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return this.getProperty(key);
|
return this.getProperty(key);
|
||||||
|
}
|
||||||
|
|
||||||
this.setString(key, value);
|
this.setString(key, value);
|
||||||
return value;
|
return value;
|
||||||
@ -206,8 +208,9 @@ public final class PropertiesFile {
|
|||||||
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0
|
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0
|
||||||
*/
|
*/
|
||||||
public int getInt(String key) {
|
public int getInt(String key) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Integer.parseInt(this.getProperty(key));
|
return Integer.parseInt(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -221,8 +224,9 @@ public final class PropertiesFile {
|
|||||||
* @return <code>Integer</code> - Either we will return the default value or a prior existing value depending on existance.
|
* @return <code>Integer</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||||
*/
|
*/
|
||||||
public int getInt(String key, int value) {
|
public int getInt(String key, int value) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Integer.parseInt(this.getProperty(key));
|
return Integer.parseInt(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
this.setInt(key, value);
|
this.setInt(key, value);
|
||||||
return value;
|
return value;
|
||||||
@ -250,8 +254,9 @@ public final class PropertiesFile {
|
|||||||
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0.0
|
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0.0
|
||||||
*/
|
*/
|
||||||
public double getDouble(String key) {
|
public double getDouble(String key) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Double.parseDouble(this.getProperty(key));
|
return Double.parseDouble(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -265,8 +270,9 @@ public final class PropertiesFile {
|
|||||||
* @return <code>Double</code> - Either we will return the default value or a prior existing value depending on existance.
|
* @return <code>Double</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||||
*/
|
*/
|
||||||
public double getDouble(String key, double value) {
|
public double getDouble(String key, double value) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Double.parseDouble(this.getProperty(key));
|
return Double.parseDouble(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
this.setDouble(key, value);
|
this.setDouble(key, value);
|
||||||
return value;
|
return value;
|
||||||
@ -293,8 +299,9 @@ public final class PropertiesFile {
|
|||||||
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0L
|
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to 0L
|
||||||
*/
|
*/
|
||||||
public long getLong(String key) {
|
public long getLong(String key) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Long.parseLong(this.getProperty(key));
|
return Long.parseLong(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -308,8 +315,9 @@ public final class PropertiesFile {
|
|||||||
* @return <code>Long</code> - Either we will return the default value or a prior existing value depending on existance.
|
* @return <code>Long</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||||
*/
|
*/
|
||||||
public long getLong(String key, long value) {
|
public long getLong(String key, long value) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Long.parseLong(this.getProperty(key));
|
return Long.parseLong(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
this.setLong(key, value);
|
this.setLong(key, value);
|
||||||
return value;
|
return value;
|
||||||
@ -336,8 +344,9 @@ public final class PropertiesFile {
|
|||||||
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to false
|
* @param key The <code>key</code> we will retrieve the property from, if no <code>key</code> is found default to false
|
||||||
*/
|
*/
|
||||||
public boolean getBoolean(String key) {
|
public boolean getBoolean(String key) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Boolean.parseBoolean(this.getProperty(key));
|
return Boolean.parseBoolean(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -351,8 +360,9 @@ public final class PropertiesFile {
|
|||||||
* @return <code>Boolean</code> - Either we will return the default value or a prior existing value depending on existance.
|
* @return <code>Boolean</code> - Either we will return the default value or a prior existing value depending on existance.
|
||||||
*/
|
*/
|
||||||
public boolean getBoolean(String key, boolean value) {
|
public boolean getBoolean(String key, boolean value) {
|
||||||
if (this.containsKey(key))
|
if (this.containsKey(key)) {
|
||||||
return Boolean.parseBoolean(this.getProperty(key));
|
return Boolean.parseBoolean(this.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
this.setBoolean(key, value);
|
this.setBoolean(key, value);
|
||||||
return value;
|
return value;
|
||||||
|
@ -130,18 +130,19 @@ public class ChatFixUtil {
|
|||||||
*/
|
*/
|
||||||
public static String thisMsgWouldCrashClient(String str) {
|
public static String thisMsgWouldCrashClient(String str) {
|
||||||
// There would always be crash if we end with deg or deg+'anychar'
|
// There would always be crash if we end with deg or deg+'anychar'
|
||||||
if (str.length() >= 1 && str.charAt(str.length() - 1) == ChatFixUtil.deg)
|
if (str.length() >= 1 && str.charAt(str.length() - 1) == ChatFixUtil.deg) {
|
||||||
return "Crash: The str ends with deg.";
|
return "Crash: The str ends with deg.";
|
||||||
else if (str.length() >= 2 && str.charAt(str.length() - 2) == ChatFixUtil.deg)
|
} else if (str.length() >= 2 && str.charAt(str.length() - 2) == ChatFixUtil.deg) {
|
||||||
return "Crash: The str ends with deg+'anychar'.";
|
return "Crash: The str ends with deg+'anychar'.";
|
||||||
|
}
|
||||||
|
|
||||||
int displayedChars = 0;
|
int displayedChars = 0;
|
||||||
|
|
||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
char c = str.charAt(i);
|
char c = str.charAt(i);
|
||||||
if (c == ChatFixUtil.deg && displayedChars == ChatFixUtil.lineLength)
|
if (c == ChatFixUtil.deg && displayedChars == ChatFixUtil.lineLength) {
|
||||||
return "Crash: Deg as fiftyforth \"displayed\" char";
|
return "Crash: Deg as fiftyforth \"displayed\" char";
|
||||||
else if (c == ChatFixUtil.deg) {
|
} else if (c == ChatFixUtil.deg) {
|
||||||
i++; // this and next: they are not displayed... skip them...
|
i++; // this and next: they are not displayed... skip them...
|
||||||
} else {
|
} else {
|
||||||
displayedChars += 1;
|
displayedChars += 1;
|
||||||
|
@ -42,7 +42,9 @@ public class VerticalVolume extends Volume{
|
|||||||
if (this.getMinZ() == block.getZ()
|
if (this.getMinZ() == block.getZ()
|
||||||
&& block.getX() <= this.getMaxX()
|
&& block.getX() <= this.getMaxX()
|
||||||
&& block.getX() >= this.getMinX())
|
&& block.getX() >= this.getMinX())
|
||||||
|
{
|
||||||
return true; // east wall
|
return true; // east wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +52,9 @@ public class VerticalVolume extends Volume{
|
|||||||
if (this.getMaxX() == block.getX()
|
if (this.getMaxX() == block.getX()
|
||||||
&& block.getZ() <= this.getMaxZ()
|
&& block.getZ() <= this.getMaxZ()
|
||||||
&& block.getZ() >= this.getMinZ())
|
&& block.getZ() >= this.getMinZ())
|
||||||
|
{
|
||||||
return true; // south wall
|
return true; // south wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +62,9 @@ public class VerticalVolume extends Volume{
|
|||||||
if (this.getMinX() == block.getX()
|
if (this.getMinX() == block.getX()
|
||||||
&& block.getZ() <= this.getMaxZ()
|
&& block.getZ() <= this.getMaxZ()
|
||||||
&& block.getZ() >= this.getMinZ())
|
&& block.getZ() >= this.getMinZ())
|
||||||
|
{
|
||||||
return true; // north wall
|
return true; // north wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +72,9 @@ public class VerticalVolume extends Volume{
|
|||||||
if (this.getMaxZ() == block.getZ()
|
if (this.getMaxZ() == block.getZ()
|
||||||
&& block.getX() <= this.getMaxX()
|
&& block.getX() <= this.getMaxX()
|
||||||
&& block.getX() >= this.getMinX())
|
&& block.getX() >= this.getMinX())
|
||||||
|
{
|
||||||
return true; // west wall
|
return true; // west wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,17 +327,23 @@ public class Volume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMinXBlock() {
|
public BlockInfo getMinXBlock() {
|
||||||
if (this.cornerOne.getX() < this.cornerTwo.getX()) return this.cornerOne;
|
if (this.cornerOne.getX() < this.cornerTwo.getX()) {
|
||||||
|
return this.cornerOne;
|
||||||
|
}
|
||||||
return this.cornerTwo;
|
return this.cornerTwo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMinYBlock() {
|
public BlockInfo getMinYBlock() {
|
||||||
if (this.cornerOne.getY() < this.cornerTwo.getY()) return this.cornerOne;
|
if (this.cornerOne.getY() < this.cornerTwo.getY()) {
|
||||||
|
return this.cornerOne;
|
||||||
|
}
|
||||||
return this.cornerTwo;
|
return this.cornerTwo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMinZBlock() {
|
public BlockInfo getMinZBlock() {
|
||||||
if (this.cornerOne.getZ() < this.cornerTwo.getZ()) return this.cornerOne;
|
if (this.cornerOne.getZ() < this.cornerTwo.getZ()) {
|
||||||
|
return this.cornerOne;
|
||||||
|
}
|
||||||
return this.cornerTwo;
|
return this.cornerTwo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,17 +360,23 @@ public class Volume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMaxXBlock() {
|
public BlockInfo getMaxXBlock() {
|
||||||
if (this.cornerOne.getX() < this.cornerTwo.getX()) return this.cornerTwo;
|
if (this.cornerOne.getX() < this.cornerTwo.getX()) {
|
||||||
|
return this.cornerTwo;
|
||||||
|
}
|
||||||
return this.cornerOne;
|
return this.cornerOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMaxYBlock() {
|
public BlockInfo getMaxYBlock() {
|
||||||
if (this.cornerOne.getY() < this.cornerTwo.getY()) return this.cornerTwo;
|
if (this.cornerOne.getY() < this.cornerTwo.getY()) {
|
||||||
|
return this.cornerTwo;
|
||||||
|
}
|
||||||
return this.cornerOne;
|
return this.cornerOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockInfo getMaxZBlock() {
|
public BlockInfo getMaxZBlock() {
|
||||||
if (this.cornerOne.getZ() < this.cornerTwo.getZ()) return this.cornerTwo;
|
if (this.cornerOne.getZ() < this.cornerTwo.getZ()) {
|
||||||
|
return this.cornerTwo;
|
||||||
|
}
|
||||||
return this.cornerOne;
|
return this.cornerOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,21 +73,23 @@ public class ZoneVolume extends Volume {
|
|||||||
if (this.getCornerTwo() == null) {
|
if (this.getCornerTwo() == null) {
|
||||||
// northwest defaults to corner 1
|
// northwest defaults to corner 1
|
||||||
super.setCornerOne(topBlock);
|
super.setCornerOne(topBlock);
|
||||||
} else if (this.getCornerTwo().getX() <= block.getX() || this.getCornerTwo().getZ() >= block.getZ())
|
} else if (this.getCornerTwo().getX() <= block.getX() || this.getCornerTwo().getZ() >= block.getZ()) {
|
||||||
throw new NotNorthwestException();
|
throw new NotNorthwestException();
|
||||||
else {
|
} else {
|
||||||
// corner 2 already set, but we're sure we're located at the northwest of it
|
// corner 2 already set, but we're sure we're located at the northwest of it
|
||||||
super.setCornerOne(topBlock);
|
super.setCornerOne(topBlock);
|
||||||
}
|
}
|
||||||
} else if (this.getCornerTwo() == null){
|
} else if (this.getCornerTwo() == null){
|
||||||
// corner 1 already exists, set northwest as corner 2 (only if it's at the northwest of corner 1)
|
// corner 1 already exists, set northwest as corner 2 (only if it's at the northwest of corner 1)
|
||||||
if (this.getCornerOne().getX() <= block.getX() || this.getCornerOne().getZ() >= block.getZ())
|
if (this.getCornerOne().getX() <= block.getX() || this.getCornerOne().getZ() >= block.getZ()) {
|
||||||
throw new NotNorthwestException();
|
throw new NotNorthwestException();
|
||||||
|
}
|
||||||
super.setCornerTwo(topBlock);
|
super.setCornerTwo(topBlock);
|
||||||
} else {
|
} else {
|
||||||
// both corners already set: we are resizing (only if the new block is northwest relative to the southeasternmost block)
|
// both corners already set: we are resizing (only if the new block is northwest relative to the southeasternmost block)
|
||||||
if (this.getSoutheastX() <= block.getX() || this.getSoutheastZ() >= block.getZ())
|
if (this.getSoutheastX() <= block.getX() || this.getSoutheastZ() >= block.getZ()) {
|
||||||
throw new NotNorthwestException();
|
throw new NotNorthwestException();
|
||||||
|
}
|
||||||
BlockInfo minXBlock = this.getMinXBlock(); // north means min X
|
BlockInfo minXBlock = this.getMinXBlock(); // north means min X
|
||||||
minXBlock.setX(block.getX()); // mutating, argh!
|
minXBlock.setX(block.getX()); // mutating, argh!
|
||||||
BlockInfo maxZBlock = this.getMaxZBlock(); // west means max Z
|
BlockInfo maxZBlock = this.getMaxZBlock(); // west means max Z
|
||||||
@ -105,17 +107,19 @@ public class ZoneVolume extends Volume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNorthwestX() {
|
public int getNorthwestX() {
|
||||||
if (!this.hasTwoCorners())
|
if (!this.hasTwoCorners()) {
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} else {
|
||||||
return this.getMinX();
|
return this.getMinX();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNorthwestZ() {
|
public int getNorthwestZ() {
|
||||||
if (!this.hasTwoCorners())
|
if (!this.hasTwoCorners()) {
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} else {
|
||||||
return this.getMaxZ();
|
return this.getMaxZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSoutheast(Block block) throws NotSoutheastException, TooSmallException, TooBigException {
|
public void setSoutheast(Block block) throws NotSoutheastException, TooSmallException, TooBigException {
|
||||||
@ -128,21 +132,23 @@ public class ZoneVolume extends Volume {
|
|||||||
if (this.getCornerOne() == null) {
|
if (this.getCornerOne() == null) {
|
||||||
// southeast defaults to corner 2
|
// southeast defaults to corner 2
|
||||||
super.setCornerTwo(bottomBlock);
|
super.setCornerTwo(bottomBlock);
|
||||||
} else if (this.getCornerOne().getX() >= block.getX() || this.getCornerOne().getZ() <= block.getZ())
|
} else if (this.getCornerOne().getX() >= block.getX() || this.getCornerOne().getZ() <= block.getZ()) {
|
||||||
throw new NotSoutheastException();
|
throw new NotSoutheastException();
|
||||||
else {
|
} else {
|
||||||
// corner 1 already set, but we're sure we're located at the southeast of it
|
// corner 1 already set, but we're sure we're located at the southeast of it
|
||||||
super.setCornerTwo(bottomBlock);
|
super.setCornerTwo(bottomBlock);
|
||||||
}
|
}
|
||||||
} else if (this.getCornerOne() == null){
|
} else if (this.getCornerOne() == null){
|
||||||
// corner 2 already exists, set northwest as corner 1 (only if it's at the southeast of corner 2)
|
// corner 2 already exists, set northwest as corner 1 (only if it's at the southeast of corner 2)
|
||||||
if (this.getCornerTwo().getX() >= block.getX() || this.getCornerTwo().getZ() <= block.getZ())
|
if (this.getCornerTwo().getX() >= block.getX() || this.getCornerTwo().getZ() <= block.getZ()) {
|
||||||
throw new NotSoutheastException();
|
throw new NotSoutheastException();
|
||||||
|
}
|
||||||
super.setCornerOne(bottomBlock);
|
super.setCornerOne(bottomBlock);
|
||||||
} else {
|
} else {
|
||||||
// both corners already set: we are resizing (only if the new block is southeast relative to the northwesternmost block)
|
// both corners already set: we are resizing (only if the new block is southeast relative to the northwesternmost block)
|
||||||
if (this.getNorthwestX() >= block.getX() || this.getNorthwestZ() <= block.getZ())
|
if (this.getNorthwestX() >= block.getX() || this.getNorthwestZ() <= block.getZ()) {
|
||||||
throw new NotSoutheastException();
|
throw new NotSoutheastException();
|
||||||
|
}
|
||||||
BlockInfo maxXBlock = this.getMaxXBlock(); // south means max X
|
BlockInfo maxXBlock = this.getMaxXBlock(); // south means max X
|
||||||
maxXBlock.setX(block.getX()); // mutating, argh!
|
maxXBlock.setX(block.getX()); // mutating, argh!
|
||||||
BlockInfo minZBlock = this.getMinZBlock(); // east means min Z
|
BlockInfo minZBlock = this.getMinZBlock(); // east means min Z
|
||||||
@ -161,24 +167,27 @@ public class ZoneVolume extends Volume {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSoutheastX() {
|
public int getSoutheastX() {
|
||||||
if (!this.hasTwoCorners())
|
if (!this.hasTwoCorners()) {
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} else {
|
||||||
return this.getMaxX();
|
return this.getMaxX();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSoutheastZ() {
|
public int getSoutheastZ() {
|
||||||
if (!this.hasTwoCorners())
|
if (!this.hasTwoCorners()) {
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} else {
|
||||||
return this.getMinZ();
|
return this.getMinZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCenterY() {
|
public int getCenterY() {
|
||||||
if (!this.hasTwoCorners())
|
if (!this.hasTwoCorners()) {
|
||||||
return 0;
|
return 0;
|
||||||
else
|
} else {
|
||||||
return this.getMinY() + (this.getMaxY() - this.getMinY())/2;
|
return this.getMinY() + (this.getMaxY() - this.getMinY())/2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoneCornerOne(Block block) throws TooSmallException, TooBigException {
|
public void setZoneCornerOne(Block block) throws TooSmallException, TooBigException {
|
||||||
@ -208,14 +217,18 @@ public class ZoneVolume extends Volume {
|
|||||||
public boolean tooSmall() {
|
public boolean tooSmall() {
|
||||||
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() < 10)
|
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() < 10)
|
||||||
|| (this.getMaxY() - this.getMinY() < 10)
|
|| (this.getMaxY() - this.getMinY() < 10)
|
||||||
|| (this.getMaxZ() - this.getMinZ() < 10))) return true;
|
|| (this.getMaxZ() - this.getMinZ() < 10))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tooBig() {
|
public boolean tooBig() {
|
||||||
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() > 750)
|
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() > 750)
|
||||||
|| (this.getMaxY() - this.getMinY() > 750)
|
|| (this.getMaxY() - this.getMinY() > 750)
|
||||||
|| (this.getMaxZ() - this.getMinZ() > 750))) return true;
|
|| (this.getMaxZ() - this.getMinZ() > 750))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,21 +237,24 @@ public class ZoneVolume extends Volume {
|
|||||||
for (Team team : this.zone.getTeams()) {
|
for (Team team : this.zone.getTeams()) {
|
||||||
if (team.getTeamSpawn() != null) {
|
if (team.getTeamSpawn() != null) {
|
||||||
if (!this.isInside(team.getSpawnVolume().getCornerOne())
|
if (!this.isInside(team.getSpawnVolume().getCornerOne())
|
||||||
|| !this.isInside(team.getSpawnVolume().getCornerTwo()))
|
|| !this.isInside(team.getSpawnVolume().getCornerTwo())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (team.getTeamFlag() != null) {
|
if (team.getTeamFlag() != null) {
|
||||||
if (!this.isInside(team.getFlagVolume().getCornerOne())
|
if (!this.isInside(team.getFlagVolume().getCornerOne())
|
||||||
|| !this.isInside(team.getFlagVolume().getCornerTwo()))
|
|| !this.isInside(team.getFlagVolume().getCornerTwo())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check monuments
|
// check monuments
|
||||||
for (Monument monument : this.zone.getMonuments()) {
|
for (Monument monument : this.zone.getMonuments()) {
|
||||||
if (monument.getVolume() != null) {
|
if (monument.getVolume() != null) {
|
||||||
if (!this.isInside(monument.getVolume().getCornerOne())
|
if (!this.isInside(monument.getVolume().getCornerOne())
|
||||||
|| !this.isInside(monument.getVolume().getCornerTwo()))
|
|| !this.isInside(monument.getVolume().getCornerTwo())) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -247,8 +263,9 @@ public class ZoneVolume extends Volume {
|
|||||||
private boolean isInside(BlockInfo info) {
|
private boolean isInside(BlockInfo info) {
|
||||||
if (info.getX() <= this.getMaxX() && info.getX() >= this.getMinX() &&
|
if (info.getX() <= this.getMaxX() && info.getX() >= this.getMinX() &&
|
||||||
info.getY() <= this.getMaxY() && info.getY() >= this.getMinY() &&
|
info.getY() <= this.getMaxY() && info.getY() >= this.getMinY() &&
|
||||||
info.getZ() <= this.getMaxZ() && info.getZ() >= this.getMinZ())
|
info.getZ() <= this.getMaxZ() && info.getZ() >= this.getMinZ()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +281,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getX() >= this.getMinX()
|
&& block.getX() >= this.getMinX()
|
||||||
&& block.getY() >= this.getMinY()
|
&& block.getY() >= this.getMinY()
|
||||||
&& block.getY() <= this.getMaxY())
|
&& block.getY() <= this.getMaxY())
|
||||||
|
{
|
||||||
return true; // east wall
|
return true; // east wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +293,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getZ() >= this.getMinZ()
|
&& block.getZ() >= this.getMinZ()
|
||||||
&& block.getY() >= this.getMinY()
|
&& block.getY() >= this.getMinY()
|
||||||
&& block.getY() <= this.getMaxY())
|
&& block.getY() <= this.getMaxY())
|
||||||
|
{
|
||||||
return true; // south wall
|
return true; // south wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +305,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getZ() >= this.getMinZ()
|
&& block.getZ() >= this.getMinZ()
|
||||||
&& block.getY() >= this.getMinY()
|
&& block.getY() >= this.getMinY()
|
||||||
&& block.getY() <= this.getMaxY())
|
&& block.getY() <= this.getMaxY())
|
||||||
|
{
|
||||||
return true; // north wall
|
return true; // north wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +317,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getX() >= this.getMinX()
|
&& block.getX() >= this.getMinX()
|
||||||
&& block.getY() >= this.getMinY()
|
&& block.getY() >= this.getMinY()
|
||||||
&& block.getY() <= this.getMaxY())
|
&& block.getY() <= this.getMaxY())
|
||||||
|
{
|
||||||
return true; // west wall
|
return true; // west wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +329,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getX() >= this.getMinX()
|
&& block.getX() >= this.getMinX()
|
||||||
&& block.getZ() >= this.getMinZ()
|
&& block.getZ() >= this.getMinZ()
|
||||||
&& block.getZ() <= this.getMaxZ())
|
&& block.getZ() <= this.getMaxZ())
|
||||||
|
{
|
||||||
return true; // top wall
|
return true; // top wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,7 +341,9 @@ public class ZoneVolume extends Volume {
|
|||||||
&& block.getX() >= this.getMinX()
|
&& block.getX() >= this.getMinX()
|
||||||
&& block.getZ() >= this.getMinZ()
|
&& block.getZ() >= this.getMinZ()
|
||||||
&& block.getZ() <= this.getMaxZ())
|
&& block.getZ() <= this.getMaxZ())
|
||||||
|
{
|
||||||
return true; // bottom wall
|
return true; // bottom wall
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user