Skip to content

Commit

Permalink
Merge pull request #7101 from TownyAdvanced/feat/immediate-newday-sch…
Browse files Browse the repository at this point in the history
…edule

Immediately schedule upcoming newday on paper
  • Loading branch information
LlmDl authored Nov 22, 2023
2 parents 2816160 + c529f3c commit 454028f
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.TownyMessaging;
import com.palmergames.bukkit.towny.TownySettings;
import com.palmergames.bukkit.towny.scheduling.impl.FoliaTaskScheduler;
import com.palmergames.util.TimeMgmt;
import org.bukkit.NamespacedKey;
import java.util.Timer;
Expand Down Expand Up @@ -44,7 +45,7 @@ public void run() {
long secondsUntilNextNewDay = TimeMgmt.townyTime();

// If the next new day is less than 2 minutes away, schedule the new day.
if (secondsUntilNextNewDay < TimeUnit.MINUTES.toSeconds(2)) {
if (plugin.getScheduler() instanceof FoliaTaskScheduler || secondsUntilNextNewDay < TimeUnit.MINUTES.toSeconds(2)) {
TownyMessaging.sendDebugMsg("New Day time finalized for: " + TimeMgmt.formatCountdownTime(secondsUntilNextNewDay) + " from now.");
scheduleUpComingNewDay(secondsUntilNextNewDay);
// Else the new day scheduler will run again at half the secondsUntilNextNewDay, to check again.
Expand Down

0 comments on commit 454028f

Please sign in to comment.