Skip to content

Commit

Permalink
Add more verbose logging for daily tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Almighty-Satan committed Sep 14, 2024
1 parent d39a5d0 commit c8d6b05
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/de/cuuky/varo/threads/daily/DailyTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,39 @@ private static long getNextReset(long offset) {
private void startTimer(long offset) {
if (Main.getVaroGame().getGameState() == GameState.STARTED && Main.getVaroGame().getLastDayTimer() != null) {
Date date = Main.getVaroGame().getLastDayTimer();
for (int i = 0; i < getDateDiff(date, new Date(), TimeUnit.DAYS); i++) {
if (ConfigSetting.DEBUG_OPTIONS.getValueAsBoolean())
System.out.println("DAILY RECTIFY");

long dateDiff = getDateDiff(date, new Date(), TimeUnit.DAYS);
for (long i = 0; i < dateDiff; i++) {
System.out.println(Main.getConsolePrefix() + "Catching up with daily tasks...");
doDailyChecks();
}

Main.getVaroGame().setLastDayTimer(new Date());
}

long nextTaskSeconds = getNextReset(offset);
System.out.println(Main.getConsolePrefix() + "Next daily task: " + nextTaskSeconds);
new BukkitRunnable() {
@Override
public void run() {
try {
System.out.println(Main.getConsolePrefix() + "Running daily timer...");

new VaroBackup();
Main.getVaroGame().setLastDayTimer(new Date());

if (Main.getVaroGame().getGameState() == GameState.STARTED) {
if (ConfigSetting.DEBUG_OPTIONS.getValueAsBoolean())
System.out.println("DAILY");

if (Main.getVaroGame().getGameState() == GameState.STARTED)
doDailyChecks();
}
} catch (Throwable e) {
e.printStackTrace();
}

startTimer(6L * 60L * 60L * 1000L);
}
}.runTaskLater(Main.getInstance(), getNextReset(offset) * 20);
}.runTaskLater(Main.getInstance(), nextTaskSeconds * 20L);
}

public void doDailyChecks() {
System.out.println(Main.getConsolePrefix() + "Running daily checks...");
for (Checker checkers : checker) {
try {
checkers.check();
Expand Down

0 comments on commit c8d6b05

Please sign in to comment.