Browse Source

30 minute mine windows

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
9107540212
  1. 31
      src/engine/objects/Mine.java
  2. 4
      src/engine/server/world/WorldServer.java
  3. 25
      src/engine/workthreads/HourlyJobThread.java

31
src/engine/objects/Mine.java

@ -60,7 +60,7 @@ public class Mine extends AbstractGameObject { @@ -60,7 +60,7 @@ public class Mine extends AbstractGameObject {
public boolean hasProduced = false;
public int liveTime;
public Boolean fullHour = true;
public Boolean firstThirty = true;
public static ArrayList<Mine> ChinaMines = new ArrayList<>();
public static ArrayList<Mine> EuroMines = new ArrayList<>();
@ -123,17 +123,9 @@ public class Mine extends AbstractGameObject { @@ -123,17 +123,9 @@ public class Mine extends AbstractGameObject {
public static void SetTimes(){
EuroMines.get(0).liveTime = 12;
EuroMines.get(0).fullHour = true;
EuroMines.get(1).liveTime = 12;
EuroMines.get(1).fullHour = false;
EuroMines.get(2).liveTime = 12;
EuroMines.get(2).fullHour = false;
EuroMines.get(3).liveTime = 12;
EuroMines.get(3).fullHour = true;
EuroMines.get(4).liveTime = 13;
EuroMines.get(5).liveTime = 13;
EuroMines.get(6).liveTime = 13;
@ -256,6 +248,27 @@ public class Mine extends AbstractGameObject { @@ -256,6 +248,27 @@ public class Mine extends AbstractGameObject {
ChinaMines.add(serverMines.get(33));
AmericaMines.add(serverMines.get(34));
SetTimes();
for(Mine mine : EuroMines){
if(EuroMines.indexOf(mine) %2 == 0 ){
mine.firstThirty = true;
} else{
mine.firstThirty = false;
}
}
for(Mine mine : AmericaMines){
if(AmericaMines.indexOf(mine) %2 == 0 ){
mine.firstThirty = true;
} else{
mine.firstThirty = false;
}
}
for(Mine mine : ChinaMines){
if(ChinaMines.indexOf(mine) %2 == 0 ){
mine.firstThirty = true;
} else{
mine.firstThirty = false;
}
}
} catch (Exception e) {
e.printStackTrace();
}

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

@ -231,9 +231,9 @@ public class WorldServer { @@ -231,9 +231,9 @@ public class WorldServer {
hourlyJobThread.setName("hourlyJob");
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(1).plusHours(1);
}else{
nextHourlyJobTime = LocalDateTime.now().withMinute(30).withSecond(0);
nextHourlyJobTime = LocalDateTime.now().withMinute(30).withSecond(1);
}
}

25
src/engine/workthreads/HourlyJobThread.java

@ -21,6 +21,7 @@ import engine.objects.*; @@ -21,6 +21,7 @@ import engine.objects.*;
import engine.server.world.WorldServer;
import org.pmw.tinylog.Logger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
@ -93,18 +94,32 @@ public class HourlyJobThread implements Runnable { @@ -93,18 +94,32 @@ public class HourlyJobThread implements Runnable {
continue;
}
// Open Mines owned by nations having their WOO
// set to the current mine window.
if (mine.liveTime == LocalDateTime.now().getHour() && mine.wasClaimed == false) {
if (mine.fullHour == true) {
HourlyJobThread.mineWindowOpen(mine);
if(mine.firstThirty == true && LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0)) && LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0))){
mineWindowOpen(mine);
continue;
}
else if(LocalDateTime.now().isBefore(LocalDateTime.now().withMinute(29).withSecond(59))) {
if(mine.firstThirty == false && LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.liveTime).withMinute(30).withSecond(0)) && LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.liveTime).withMinute(0).withSecond(0).plusHours(1))){
mineWindowOpen(mine);
continue;
}
}
// Open Mines owned by nations having their WOO
// set to the current mine window.
//if (mine.liveTime == LocalDateTime.now().getHour() && mine.wasClaimed == false) {
/// if (mine.fullHour == true) {
// HourlyJobThread.mineWindowOpen(mine);
// continue;
// }
// else if(LocalDateTime.now().isBefore(LocalDateTime.now().withMinute(29).withSecond(59))) {
// mineWindowOpen(mine);
// continue;
// }
//}
// Close the mine if it reaches this far
mineWindowClose(mine);

Loading…
Cancel
Save