Browse Source

maintenance fix

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
1c48b28d4e
  1. 17
      src/engine/gameManager/MaintenanceManager.java
  2. 10
      src/engine/objects/City.java
  3. 2
      src/engine/workthreads/DestroyCityThread.java

17
src/engine/gameManager/MaintenanceManager.java

@ -170,21 +170,6 @@ public enum MaintenanceManager {
public static void HandleMaintenanceDerank(Building tol){ public static void HandleMaintenanceDerank(Building tol){
setMaintDateTime(tol, tol.maintDateTime.plusDays(1)); //failed to pay maintenance, set next date for tomorrow setMaintDateTime(tol, tol.maintDateTime.plusDays(1)); //failed to pay maintenance, set next date for tomorrow
if(tol.getRank() == 1) tol.destroyOrDerank(null);
destroyAllCityAssets(tol.getCity());
try {
tol.destroyOrDerank(null);
}catch(Exception e){
}
}
public static void destroyAllCityAssets(City city){
if(city == null)
Logger.error("Maintenance Failed To Find City To Destroy");
for(Building building : city.getParent().zoneBuildingSet){
building.setRank(-1);
DbManager.removeFromCache(building);
}
city.getParent().zoneBuildingSet.clear();
} }
} }

10
src/engine/objects/City.java

@ -1019,7 +1019,15 @@ public class City extends AbstractWorldObject {
destroyCityThread.setName("deestroyCity:" + this.getName()); destroyCityThread.setName("deestroyCity:" + this.getName());
destroyCityThread.start(); destroyCityThread.start();
} }
public static void destroyAllCityAssets(City city){
if(city == null)
Logger.error("Maintenance Failed To Find City To Destroy");
for(Building building : city.getParent().zoneBuildingSet){
building.setRank(-1);
DbManager.removeFromCache(building);
}
city.getParent().zoneBuildingSet.clear();
}
public final void transfer(AbstractCharacter newOwner) { public final void transfer(AbstractCharacter newOwner) {
Thread transferCityThread = new Thread(new TransferCityThread(this, newOwner)); Thread transferCityThread = new Thread(new TransferCityThread(this, newOwner));

2
src/engine/workthreads/DestroyCityThread.java

@ -55,7 +55,7 @@ public class DestroyCityThread implements Runnable {
cityZone = city.getParent(); cityZone = city.getParent();
formerGuild = city.getTOL().getGuild(); formerGuild = city.getTOL().getGuild();
City.destroyAllCityAssets(city);
// Former guild loses it's tree! // Former guild loses it's tree!
if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) { if (DbManager.GuildQueries.SET_GUILD_OWNED_CITY(formerGuild.getObjectUUID(), 0)) {

Loading…
Cancel
Save