| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -75,11 +75,14 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public int level; | 
					 | 
					 | 
					 | 
					    public int level; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public AtomicBoolean isDeranking = new AtomicBoolean(false); | 
					 | 
					 | 
					 | 
					    public AtomicBoolean isDeranking = new AtomicBoolean(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public LocalDateTime maintDateTime; | 
					 | 
					 | 
					 | 
					    public LocalDateTime maintDateTime; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    protected Resists resists; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /*  The Blueprint class has methods able to derive | 
					 | 
					 | 
					 | 
					    /*  The Blueprint class has methods able to derive | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     *  all defining characteristics of this building, | 
					 | 
					 | 
					 | 
					     *  all defining characteristics of this building, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public int blueprintUUID = 0; | 
					 | 
					 | 
					 | 
					    public int blueprintUUID = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public int rank; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public ArrayList<Vector3fImmutable> patrolPoints; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    public ProtectionState protectionState = ProtectionState.NONE; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    protected Resists resists; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private float w = 1.0f; | 
					 | 
					 | 
					 | 
					    private float w = 1.0f; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private Vector3f meshScale = new Vector3f(1.0f, 1.0f, 1.0f); | 
					 | 
					 | 
					 | 
					    private Vector3f meshScale = new Vector3f(1.0f, 1.0f, 1.0f); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int doorState = 0; | 
					 | 
					 | 
					 | 
					    private int doorState = 0; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -88,15 +91,12 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int maxGold; | 
					 | 
					 | 
					 | 
					    private int maxGold; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private int effectFlags = 0; | 
					 | 
					 | 
					 | 
					    private int effectFlags = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private String name = ""; | 
					 | 
					 | 
					 | 
					    private String name = ""; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public int rank; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private boolean ownerIsNPC = true; | 
					 | 
					 | 
					 | 
					    private boolean ownerIsNPC = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private boolean spireIsActive = false; | 
					 | 
					 | 
					 | 
					    private boolean spireIsActive = false; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<String, JobContainer> timers = null; | 
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<String, JobContainer> timers = null; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<String, Long> timestamps = null; | 
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<String, Long> timestamps = null; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<Integer, BuildingFriends> friends; | 
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<Integer, BuildingFriends> friends; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<Integer, Condemned> condemned; | 
					 | 
					 | 
					 | 
					    private ConcurrentHashMap<Integer, Condemned> condemned; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ArrayList<Vector3fImmutable> patrolPoints; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public ProtectionState protectionState = ProtectionState.NONE; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private ArrayList<Building> children = null; | 
					 | 
					 | 
					 | 
					    private ArrayList<Building> children = null; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -164,7 +164,7 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault()); | 
					 | 
					 | 
					 | 
					                this.upgradeDateTime = LocalDateTime.ofInstant(upgradeTimeStamp.toInstant(), ZoneId.systemDefault()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } catch (Exception e) { | 
					 | 
					 | 
					 | 
					        } catch (Exception e) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e.toString()); | 
					 | 
					 | 
					 | 
					            Logger.error("Failed for object " + this.blueprintUUID + ' ' + this.getObjectUUID() + e); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -954,7 +954,6 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Submit upgrade job if building is currently set to rank.
 | 
					 | 
					 | 
					 | 
					        // Submit upgrade job if building is currently set to rank.
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        try { | 
					 | 
					 | 
					 | 
					        try { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -970,18 +969,6 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        this.friends = BuildingManager._buildingFriends.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); | 
					 | 
					 | 
					 | 
					        this.friends = BuildingManager._buildingFriends.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        this.condemned = BuildingManager._buildingCondemned.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); | 
					 | 
					 | 
					 | 
					        this.condemned = BuildingManager._buildingCondemned.computeIfAbsent(this.getObjectUUID(), k -> new ConcurrentHashMap<>()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //LOad Owners in Cache so we do not have to continuely look in the db for owner.
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.ownerIsNPC) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (NPC.getNPC(this.ownerUUID) == null) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load NPC Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else if (this.ownerUUID != 0) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (PlayerCharacter.getPlayerCharacter(this.ownerUUID) == null) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Logger.info("Building UID " + this.getObjectUUID() + " Failed to Load Player Owner with ID " + this.ownerUUID + " Location " + this.getLoc().toString()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // Set bounds for this building
 | 
					 | 
					 | 
					 | 
					        // Set bounds for this building
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Bounds buildingBounds = Bounds.borrow(); | 
					 | 
					 | 
					 | 
					        Bounds buildingBounds = Bounds.borrow(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -995,7 +982,7 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            this.children = new ArrayList<>(); | 
					 | 
					 | 
					 | 
					            this.children = new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.parentBuildingID != 0) { | 
					 | 
					 | 
					 | 
					        if (this.parentBuildingID != 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Building parent = BuildingManager.getBuildingFromCache(this.parentBuildingID); | 
					 | 
					 | 
					 | 
					            Building parent = BuildingManager.getBuilding(this.parentBuildingID); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (parent != null) { | 
					 | 
					 | 
					 | 
					            if (parent != null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                parent.children.add(this); | 
					 | 
					 | 
					 | 
					                parent.children.add(this); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -1400,10 +1387,7 @@ public class Building extends AbstractWorldObject { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public boolean assetIsProtected() { | 
					 | 
					 | 
					 | 
					    public boolean assetIsProtected() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        boolean outValue = false; | 
					 | 
					 | 
					 | 
					        boolean outValue = protectionState.equals(ProtectionState.PROTECTED); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (protectionState.equals(ProtectionState.PROTECTED)) | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            outValue = true; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (protectionState.equals(ProtectionState.CONTRACT)) | 
					 | 
					 | 
					 | 
					        if (protectionState.equals(ProtectionState.CONTRACT)) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            outValue = true; | 
					 | 
					 | 
					 | 
					            outValue = true; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |