From bf69045b0b27bf8f2145a4f87e7b2250120c8966 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 2 Jun 2024 15:58:26 -0500 Subject: [PATCH] SECOND AFTER ROLLBACK: serialize MineTimes correctly --- src/engine/objects/Mine.java | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 300ec1b7..62f882dc 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -63,10 +63,6 @@ public class Mine extends AbstractGameObject { public HashMap> dividedPlayers; public boolean hasProduced = false; - - public int liveTime; - public Boolean firstThirty = true; - public static ArrayList ChinaMines = new ArrayList<>(); public static ArrayList EuroMines = new ArrayList<>(); public static ArrayList AmericaMines = new ArrayList<>(); @@ -177,7 +173,6 @@ public class Mine extends AbstractGameObject { for (Mine mine : serverMines) { Mine.mineMap.put(mine, mine.buildingID); Mine.towerMap.put(mine.buildingID, mine); - //mine.mineType = MineProduction.LUMBER; } } @@ -194,15 +189,7 @@ public class Mine extends AbstractGameObject { writer.putInt(mine.getObjectUUID()); writer.putInt(mine.getObjectUUID()); //actually a hash of mine writer.putString(mine.mineType.name); - if(ChinaMines.contains((mine))) { - writer.putString("Chinese" + " {" + mine.capSize + " Man}"); - } else if(AmericaMines.contains(mine)){ - writer.putString("American" + " {" + mine.capSize + " Man}"); - } else if(EuroMines.contains(mine)){ - writer.putString("European" + " {" + mine.capSize + " Man}"); - }else{ - writer.putString("Unknown" + " {" + mine.capSize + " Man}"); - } + writer.putString(mine.capSize + " Man "); writer.putInt(mine.production.hash); writer.putInt(mine.getModifiedProductionAmount()); writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here @@ -210,13 +197,7 @@ public class Mine extends AbstractGameObject { // Errant mines are currently open. Set time to now. - LocalDateTime mineOpenTime;// = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0); - if(mine.firstThirty == true){ - mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).withNano(0); - } - else{ - mineOpenTime = LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0).withNano(0); - } + LocalDateTime mineOpenTime = LocalDateTime.now().withHour(mine.liveHour).withMinute(mine.liveMinute).withSecond(0).withNano(0); LocalDateTime mineCloseTime = mineOpenTime.plusMinutes(30); if(LocalDateTime.now().isAfter(mineCloseTime)){