Inlined empty getters

This commit is contained in:
2023-09-20 15:43:01 -04:00
parent bf9fdae58b
commit 46b3db033b
58 changed files with 210 additions and 284 deletions
@@ -130,7 +130,7 @@ public abstract class AbstractIntelligenceAgent extends AbstractCharacter {
ArrayList<Zone> allIn = ZoneManager.getAllZonesIn(this.getLoc());
for (Zone zone : allIn)
if (zone.getSafeZone() == (byte) 1)
if (zone.peaceZone == (byte) 1)
return true;
return false;
+2 -2
View File
@@ -162,8 +162,8 @@ public final class Bane {
// Cannot place assets on a dead tree
if ((cityZone.isPlayerCity()) &&
(City.getCity(cityZone.getPlayerCityUUID()).getTOL().getRank() == -1)) {
if ((cityZone.isPlayerCity) &&
(City.getCity(cityZone.playerCityID).getTOL().getRank() == -1)) {
PlaceAssetMsg.sendPlaceAssetError(origin, 1, "Cannot bane a dead tree!");
return false;
}
+3 -3
View File
@@ -460,10 +460,10 @@ public class Building extends AbstractWorldObject {
}
}
}
if (this.parentZone.isPlayerCity() == false)
if (this.parentZone.isPlayerCity == false)
return null;
return City.getCity(this.parentZone.getPlayerCityUUID());
return City.getCity(this.parentZone.playerCityID);
}
@@ -1402,7 +1402,7 @@ public class Building extends AbstractWorldObject {
// Buildings on an npc citygrid are never vulnerable
if (this.getCity() != null) {
if (this.getCity().getParent().isNPCCity() == true)
if (this.getCity().getParent().isNPCCity == true)
return false;
}
+5 -5
View File
@@ -334,7 +334,7 @@ public class City extends AbstractWorldObject {
if (city.noTeleport)
continue;
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
if (city.parentZone != null && city.parentZone.isPlayerCity) {
if (pc.getAccount().status.equals(AccountStatus.ADMIN)) {
cities.add(city);
@@ -395,7 +395,7 @@ public class City extends AbstractWorldObject {
if (city.noRepledge)
continue;
if (city.parentZone != null && city.parentZone.isPlayerCity()) {
if (city.parentZone != null && city.parentZone.isPlayerCity) {
//list Player cities
//open city, just list
@@ -589,7 +589,7 @@ public class City extends AbstractWorldObject {
if (zone.getHeightMap() == null && this.isNpc == 1 && this.getObjectUUID() != 1213) {
HeightMap.GenerateCustomHeightMap(zone);
Logger.info(zone.getName() + " created custom heightmap");
Logger.info(zone.zoneName + " created custom heightmap");
}
} catch (Exception e) {
Logger.error(e);
@@ -791,7 +791,7 @@ public class City extends AbstractWorldObject {
// Any players currently in the zone will not be processed by the heartbeat
// if it's not the first effect toggled so we do it here manually
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, this.parentZone.getBounds().getHalfExtents().x * 1.2f, MBServerStatics.MASK_PLAYER);
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, this.parentZone.bounds.getHalfExtents().x * 1.2f, MBServerStatics.MASK_PLAYER);
for (AbstractWorldObject playerObject : currentPlayers) {
@@ -874,7 +874,7 @@ public class City extends AbstractWorldObject {
}
public boolean isLocationOnCityZone(Vector3fImmutable insideLoc) {
return Bounds.collide(insideLoc, this.parentZone.getBounds());
return Bounds.collide(insideLoc, this.parentZone.bounds);
}
private void applyAllCityEffects(PlayerCharacter player) {
+2 -2
View File
@@ -104,7 +104,7 @@ public class ItemFactory {
if (zone == null)
return null;
City city = City.getCity(zone.getPlayerCityUUID());
City city = City.getCity(zone.playerCityID);
if (city == null)
return null;
@@ -796,7 +796,7 @@ public class ItemFactory {
if (zone == null)
return null;
City city = City.getCity(zone.getPlayerCityUUID());
City city = City.getCity(zone.playerCityID);
if (city == null)
return null;
+2 -2
View File
@@ -64,7 +64,7 @@ public class Mine extends AbstractGameObject {
this.flags = rs.getInt("flags");
int parent = rs.getInt("parent");
this.parentZone = ZoneManager.getZoneByUUID(parent);
this.zoneName = this.parentZone.getParent().getName();
this.zoneName = this.parentZone.parent.zoneName;
this.owningGuild = Guild.getGuild(ownerUID);
Guild nation = null;
@@ -129,7 +129,7 @@ public class Mine extends AbstractGameObject {
mine.getTimestamps().put("MineAttack", System.currentTimeMillis() + MBServerStatics.ONE_MINUTE);
ChatManager.chatNationInfo(mine.getGuild().getNation(), mine.getName() + " in " + mine.getParentZone().getParent().getName() + " is Under attack!");
ChatManager.chatNationInfo(mine.getGuild().getNation(), mine.getName() + " in " + mine.getParentZone().parent.zoneName + " is Under attack!");
}
public static void loadAllMines() {
+2 -2
View File
@@ -894,7 +894,7 @@ public class NPC extends AbstractCharacter {
this.stamina.set(this.staminaMax);
}
if (this.parentZone.isPlayerCity())
if (this.parentZone.isPlayerCity)
if (NPC.GetNPCProfits(this) == null)
NPCProfits.CreateProfits(this);
@@ -1192,7 +1192,7 @@ public class NPC extends AbstractCharacter {
if (serverZone == null)
return null;
city = City.GetCityFromCache(serverZone.getPlayerCityUUID());
city = City.GetCityFromCache(serverZone.playerCityID);
if (city == null) {
+15 -15
View File
@@ -1507,16 +1507,16 @@ public class PlayerCharacter extends AbstractCharacter {
return true;
Zone zone = ZoneManager.findSmallestZone(breather.getLoc());
if (zone.getSeaLevel() != 0) {
if (zone.seaLevel != 0) {
float localAltitude = breather.getLoc().y;
if (localAltitude + breather.characterHeight < zone.getSeaLevel() - 2)
if (localAltitude + breather.characterHeight < zone.seaLevel - 2)
return false;
if (breather.isMoving()) {
if (localAltitude + breather.characterHeight < zone.getSeaLevel())
if (localAltitude + breather.characterHeight < zone.seaLevel)
return false;
}
} else {
@@ -1547,12 +1547,12 @@ public class PlayerCharacter extends AbstractCharacter {
Zone zone = ZoneManager.findSmallestZone(enterer.getLoc());
if (zone.getSeaLevel() != 0) {
if (zone.seaLevel != 0) {
float localAltitude = enterer.getLoc().y + enterer.characterHeight;
if (localAltitude < zone.getSeaLevel())
if (localAltitude < zone.seaLevel)
return true;
} else {
if (enterer.getLoc().y + enterer.characterHeight < 0)
@@ -1579,12 +1579,12 @@ public class PlayerCharacter extends AbstractCharacter {
leaveWater = 1f;
if (zone.getSeaLevel() != 0) {
if (zone.seaLevel != 0) {
float localAltitude = leaver.getLoc().y;
if (localAltitude + leaveWater < zone.getSeaLevel())
if (localAltitude + leaveWater < zone.seaLevel)
return false;
} else {
if (leaver.getLoc().y + leaveWater < 0)
@@ -1703,7 +1703,7 @@ public class PlayerCharacter extends AbstractCharacter {
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
if (zone != null) {
return zone.getSafeZone() == (byte) 1;
return zone.peaceZone == (byte) 1;
}
return false;
@@ -1797,7 +1797,7 @@ public class PlayerCharacter extends AbstractCharacter {
//DeathShroud
if (zone.getSafeZone() == 0)
if (zone.peaceZone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
//enable this to give players deathshroud if mobs kill player.
@@ -1843,7 +1843,7 @@ public class PlayerCharacter extends AbstractCharacter {
//DeathShroud
if (zone.getSafeZone() == 0)
if (zone.peaceZone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
if (doPVPEXP) {
@@ -1898,7 +1898,7 @@ public class PlayerCharacter extends AbstractCharacter {
killCleanup();
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
if (zone.getSafeZone() == 0)
if (zone.peaceZone == 0)
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
// Send death message if needed
@@ -4739,10 +4739,10 @@ public class PlayerCharacter extends AbstractCharacter {
Zone zone = ZoneManager.findSmallestZone(this.getLoc());
if (zone.getSeaLevel() != 0) {
if (zone.seaLevel != 0) {
float localAltitude = this.getLoc().y + this.centerHeight;
if (localAltitude < zone.getSeaLevel())
if (localAltitude < zone.seaLevel)
return true;
} else {
if (this.getLoc().y + this.centerHeight < 0)
@@ -4764,9 +4764,9 @@ public class PlayerCharacter extends AbstractCharacter {
Zone zone = ZoneManager.findSmallestZone(currentLoc);
if (zone.getSeaLevel() != 0) {
if (zone.seaLevel != 0) {
if (localAltitude < zone.getSeaLevel())
if (localAltitude < zone.seaLevel)
return true;
} else {
if (localAltitude < 0)
+1 -1
View File
@@ -108,7 +108,7 @@ public class Runegate {
writer.putInt(gateBuilding.getObjectType().ordinal());
writer.putInt(gateBuilding.getObjectUUID());
writer.putString(gateBuilding.getParentZone().getName());
writer.putString(gateBuilding.getParentZone().zoneName);
writer.putFloat(gateBuilding.getLoc().getLat());
writer.putFloat(gateBuilding.getLoc().getAlt());
writer.putFloat(gateBuilding.getLoc().getLong());
+1 -1
View File
@@ -1272,7 +1272,7 @@ public class Warehouse extends AbstractWorldObject {
return;
}
City city = City.getCity(cityZone.getPlayerCityUUID());
City city = City.getCity(cityZone.playerCityID);
if (city == null) {
Logger.error("Failed to load City for Warehouse with UUID " + this.getObjectUUID());
+25 -104
View File
@@ -33,31 +33,31 @@ public class Zone extends AbstractGameObject {
public final Set<Building> zoneBuildingSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
public final Set<NPC> zoneNPCSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
public final Set<Mob> zoneMobSet = Collections.newSetFromMap(new ConcurrentHashMap<>());
private final int playerCityID;
private final String zoneName;
private final float xCoord;
private final float zCoord;
private final float yCoord;
private final int loadNum;
private final byte safeZone;
private final String Icon1;
private final String Icon2;
private final String Icon3;
public final int playerCityID;
public final String zoneName;
public final float xCoord;
public final float zCoord;
public final float yCoord;
public final int loadNum;
public final byte peaceZone;
public final String Icon1;
public final String Icon2;
public final String Icon3;
public float absX = 0.0f;
public float absY = 0.0f;
public float absZ = 0.0f;
public int minLvl;
public int maxLvl;
public boolean hasBeenHotzone = false;
private ArrayList<Zone> nodes = null;
private int parentZoneID;
private Zone parent = null;
private Bounds bounds;
private boolean isNPCCity = false;
private boolean isPlayerCity = false;
private String hash;
public ArrayList<Zone> nodes = null;
public int parentZoneID;
public Zone parent = null;
public Bounds bounds;
public boolean isNPCCity = false;
public boolean isPlayerCity = false;
public String hash;
public float worldAltitude = 0;
private float seaLevel = 0f;
public float seaLevel = 0f;
public static final Set<Mob> respawnQue = Collections.newSetFromMap(new ConcurrentHashMap<>());
public static long lastRespawn = 0;
public Bounds maxBlend;
@@ -75,7 +75,7 @@ public class Zone extends AbstractGameObject {
this.zCoord = rs.getFloat("ZCoord");
this.yCoord = rs.getFloat("YOffset");
this.loadNum = rs.getInt("LoadNum");
this.safeZone = rs.getByte("SafeZone");
this.peaceZone = rs.getByte("SafeZone");
this.Icon1 = rs.getString("Icon1");
this.Icon2 = rs.getString("Icon2");
this.Icon3 = rs.getString("Icon3");
@@ -147,7 +147,7 @@ public class Zone extends AbstractGameObject {
writer.putString(city.getCityName());
else
writer.putString(zone.zoneName);
writer.put(zone.safeZone);
writer.put(zone.peaceZone);
writer.putString(zone.Icon1);
writer.putString(zone.Icon2);
writer.putString(zone.Icon3);
@@ -182,50 +182,14 @@ public class Zone extends AbstractGameObject {
// Set heightmap blending bounds
if (heightMap == null) {
this.maxBlend = this.getBounds();
this.maxBlend = bounds;
} else {
this.maxBlend = Bounds.borrow();
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), this.getBounds().getHalfExtents().subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
this.maxBlend.setBounds(new Vector2f(this.absX, this.absZ), bounds.getHalfExtents().subtract(heightMap.zone_minBlend, heightMap.zone_minBlend), 0.0f);
}
}
public int getPlayerCityUUID() {
return this.playerCityID;
}
public String getName() {
return zoneName;
}
public float getXCoord() {
return xCoord;
}
public float getYCoord() {
return yCoord;
}
public float getZCoord() {
return zCoord;
}
public int getLoadNum() {
return loadNum;
}
public byte getSafeZone() {
return safeZone;
}
public String getIcon1() {
return Icon1;
}
public Zone getParent() {
return this.parent;
}
public void setParent(final Zone value) {
this.parent = value;
@@ -254,7 +218,7 @@ public class Zone extends AbstractGameObject {
this.setBounds();
this.worldAltitude = ZoneManager.caclulateWorldAltitude(this);
if (this.getParent() == null) {
if (this.parent == null) {
this.seaLevel = MBServerStatics.SEA_FLOOR_ALTITUDE;
return;
}
@@ -271,18 +235,6 @@ public class Zone extends AbstractGameObject {
}
public float getAbsX() {
return this.absX;
}
public float getAbsY() {
return this.absY;
}
public float getAbsZ() {
return this.absZ;
}
public boolean isMacroZone() {
// Macro zones have icons.
@@ -293,23 +245,7 @@ public class Zone extends AbstractGameObject {
if (this.parent == null)
return false;
return !this.getIcon1().equals("");
}
public boolean isNPCCity() {
return this.isNPCCity;
}
public void setNPCCity(boolean value) {
this.isNPCCity = value;
}
public boolean isPlayerCity() {
return this.isPlayerCity;
}
public void setPlayerCity(boolean value) {
this.isPlayerCity = value;
return !Icon1.equals("");
}
public Vector3fImmutable getLoc() {
@@ -358,21 +294,10 @@ public class Zone extends AbstractGameObject {
if (this.getNodes().get(0).isMacroZone())
return true;
return this.getParent().equals(ZoneManager.getSeaFloor());
return this.parent.equals(ZoneManager.getSeaFloor());
}
/**
* @return the bounds
*/
public Bounds getBounds() {
return bounds;
}
public String getHash() {
return hash;
}
public void setHash() {
this.hash = DataWarehouse.hasher.encrypt(this.getObjectUUID());
@@ -392,8 +317,4 @@ public class Zone extends AbstractGameObject {
return HeightMap.heightmapByLoadNum.get(this.loadNum);
}
public float getSeaLevel() {
return seaLevel;
}
}