Browse Source

30 minute mine windows

lakebane-master
FatBoy-DOTC 8 months ago
parent
commit
24bc0097be
  1. 9
      src/engine/objects/Mine.java
  2. 4
      src/engine/server/world/WorldServer.java
  3. 49
      src/engine/workthreads/HourlyJobThread.java

9
src/engine/objects/Mine.java

@ -60,6 +60,7 @@ public class Mine extends AbstractGameObject {
public boolean hasProduced = false; public boolean hasProduced = false;
public int liveTime; public int liveTime;
public Boolean fullHour = true;
public static ArrayList<Mine> ChinaMines = new ArrayList<>(); public static ArrayList<Mine> ChinaMines = new ArrayList<>();
public static ArrayList<Mine> EuroMines = new ArrayList<>(); public static ArrayList<Mine> EuroMines = new ArrayList<>();
@ -122,9 +123,17 @@ public class Mine extends AbstractGameObject {
public static void SetTimes(){ public static void SetTimes(){
EuroMines.get(0).liveTime = 12; EuroMines.get(0).liveTime = 12;
EuroMines.get(0).fullHour = true;
EuroMines.get(1).liveTime = 12; EuroMines.get(1).liveTime = 12;
EuroMines.get(1).fullHour = false;
EuroMines.get(2).liveTime = 12; EuroMines.get(2).liveTime = 12;
EuroMines.get(2).fullHour = false;
EuroMines.get(3).liveTime = 12; EuroMines.get(3).liveTime = 12;
EuroMines.get(3).fullHour = true;
EuroMines.get(4).liveTime = 13; EuroMines.get(4).liveTime = 13;
EuroMines.get(5).liveTime = 13; EuroMines.get(5).liveTime = 13;
EuroMines.get(6).liveTime = 13; EuroMines.get(6).liveTime = 13;

4
src/engine/server/world/WorldServer.java

@ -230,7 +230,11 @@ public class WorldServer {
Thread hourlyJobThread = new Thread(new HourlyJobThread()); Thread hourlyJobThread = new Thread(new HourlyJobThread());
hourlyJobThread.setName("hourlyJob"); hourlyJobThread.setName("hourlyJob");
hourlyJobThread.start(); hourlyJobThread.start();
if(LocalDateTime.now().isAfter(LocalDateTime.now().withMinute(30).withSecond(0))) {
nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1); nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
}else{
nextHourlyJobTime = LocalDateTime.now().withMinute(30).withSecond(0);
}
} }
if (LocalDateTime.now().isAfter(nextWareHousePushTime)) { if (LocalDateTime.now().isAfter(nextWareHousePushTime)) {

49
src/engine/workthreads/HourlyJobThread.java

@ -95,13 +95,16 @@ public class HourlyJobThread implements Runnable {
// Open Mines owned by nations having their WOO // Open Mines owned by nations having their WOO
// set to the current mine window. // set to the current mine window.
if (mine.liveTime == LocalDateTime.now().getHour() && mine.wasClaimed == false) {
if (mine.liveTime == if (mine.fullHour == true) {
LocalDateTime.now().getHour() && mine.wasClaimed == false) {
HourlyJobThread.mineWindowOpen(mine); HourlyJobThread.mineWindowOpen(mine);
continue; continue;
} }
else if(LocalDateTime.now().isBefore(LocalDateTime.now().withMinute(29).withSecond(59))) {
mineWindowOpen(mine);
continue;
}
}
// Close the mine if it reaches this far // Close the mine if it reaches this far
mineWindowClose(mine); mineWindowClose(mine);
@ -190,46 +193,8 @@ public class HourlyJobThread implements Runnable {
Logger.info("Hourly job is now running."); Logger.info("Hourly job is now running.");
//try {
// Use the same hotZone this hour up and until
// the HotZone_Duration from the ConfigManager
//if (ZoneManager.hotZone == null)
// ZoneManager.generateAndSetRandomHotzone();
//else
// ZoneManager.hotZoneCycle = ZoneManager.hotZoneCycle + 1;
//if (ZoneManager.hotZoneCycle > Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue()))
// ZoneManager.generateAndSetRandomHotzone();
//if (ZoneManager.hotZone == null) {
// Logger.error("Null HotZone returned from ZoneManager");
//} else {
// Logger.info("HotZone switched to: " + ZoneManager.hotZone.getName());
//}
//} catch (Exception e) {
// Logger.error(e.toString());
//}
// Open or Close mines for the current mine window.
processMineWindow(); processMineWindow();
// Deposit mine resources to Guilds
//for (Mine mine : Mine.getMines()) {
// try {
// if (mine.hasProduced == false) {
/// mine.depositMineResources();
// }
// } catch (Exception e) {
// Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID());
// }
//}
// Reset time-gated access to WOO slider. // Reset time-gated access to WOO slider.
// *** Do this after the mines open/close! // *** Do this after the mines open/close!

Loading…
Cancel
Save