Class WorldScheduler

java.lang.Object
io.github.protasm.jvmud.engine.time.WorldScheduler

public final class WorldScheduler extends Object
Owns deterministic world time and scheduled work for one JVMud world.

The scheduler does not run on a background thread. Callers explicitly advance world time, which makes tests, admin tooling, and future persistence checkpoints repeatable.

  • Constructor Details

    • WorldScheduler

      public WorldScheduler()
  • Method Details

    • currentTick

      public long currentTick()
      Returns the current deterministic world tick.
    • scheduleAfter

      public ScheduledTask scheduleAfter(long delayTicks, Runnable action)
      Schedules one action after a non-negative number of ticks.
      Returns:
      a handle that can cancel the scheduled action before it runs
    • scheduleRecurring

      public ScheduledTask scheduleRecurring(long initialDelayTicks, long intervalTicks, Runnable action)
      Schedules a recurring action.
      Parameters:
      initialDelayTicks - non-negative delay before the first run
      intervalTicks - positive interval between later runs
      Returns:
      a handle that can cancel future occurrences
    • advanceBy

      public void advanceBy(long ticks)
      Advances world time by the supplied non-negative number of ticks.
    • advanceTo

      public void advanceTo(long targetTick)
      Advances world time to an absolute target tick and runs all due work in deterministic order.
      Throws:
      IllegalArgumentException - if the target would move time backward