From 44743b772b9e81aa280573663b44c429c7bee6a7 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 18 Oct 2023 11:21:29 -0400 Subject: [PATCH] Every building does not need a rebuild mine method. --- src/engine/gameManager/BuildingManager.java | 11 +++++++++++ src/engine/objects/Building.java | 13 +------------ src/engine/workthreads/HourlyJobThread.java | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index 7c21db71..1d68332b 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -851,4 +851,15 @@ public enum BuildingManager { } } + + public static void rebuildMine(Building mineBuilding) { + mineBuilding.setRank(1); + mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(mineBuilding.rank); + + // New rank mean new max hit points. + + mineBuilding.healthMax = mineBuilding.getBlueprint().getMaxHealth(mineBuilding.rank); + mineBuilding.setCurrentHitPoints(mineBuilding.healthMax); + mineBuilding.getBounds().setBounds(mineBuilding); + } } diff --git a/src/engine/objects/Building.java b/src/engine/objects/Building.java index e2521bca..05d9984d 100644 --- a/src/engine/objects/Building.java +++ b/src/engine/objects/Building.java @@ -89,7 +89,7 @@ public class Building extends AbstractWorldObject { private int maxGold; private int effectFlags = 0; private String name = ""; - private int rank; + public int rank; private boolean ownerIsNPC = true; private boolean spireIsActive = false; private ConcurrentHashMap timers = null; @@ -954,17 +954,6 @@ public class Building extends AbstractWorldObject { } - public final void rebuildMine() { - this.setRank(1); - this.meshUUID = this.getBlueprint().getMeshForRank(this.rank); - - // New rank mean new max hit points. - - this.healthMax = this.getBlueprint().getMaxHealth(this.rank); - this.setCurrentHitPoints(this.healthMax); - this.getBounds().setBounds(this); - } - public final void refreshGuild() { UpdateObjectMsg uom = new UpdateObjectMsg(this, 5); diff --git a/src/engine/workthreads/HourlyJobThread.java b/src/engine/workthreads/HourlyJobThread.java index 556175c9..811a9c90 100644 --- a/src/engine/workthreads/HourlyJobThread.java +++ b/src/engine/workthreads/HourlyJobThread.java @@ -163,7 +163,7 @@ public class HourlyJobThread implements Runnable { mine.nationName = nation.getName(); mine.nationTag = nation.getGuildTag(); - mineBuilding.rebuildMine(); + BuildingManager.rebuildMine(mineBuilding); WorldGrid.updateObject(mineBuilding); ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().parent.zoneName + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active.");