Class TreasureTask

java.lang.Object
com.Moshu.TreasureHunt.TreasureTask

public class TreasureTask extends Object
Manages the scheduling and execution of treasure hunt tasks. This class handles both scheduled treasure spawns and random treasure generation based on configured intervals and conditions. The class provides two main task types: - Scheduler tasks: Execute based on predefined schedules - Random tasks: Execute based on chance and cooldown systems
  • Constructor Details

    • TreasureTask

      public TreasureTask()
  • Method Details

    • updateLastHunt

      public static void updateLastHunt()
      Updates the timestamp of the last treasure hunt. Used to track cooldown periods between hunts.
    • schedulerTask

      public static void schedulerTask()
      Starts the scheduler task that checks for scheduled treasure spawns. Runs every 15 seconds (300 ticks) and processes all configured treasure schedulers. Prevents spawning treasures too frequently by maintaining timestamps.
    • task

      public static void task()
      Starts the random treasure generation task. Creates tasks for each treasure data configuration with random delays and processes them based on chance and cooldown systems.