Class RunRecordsService

java.lang.Object
dev.deepcore.challenge.records.RunRecordsService

public class RunRecordsService extends Object
Manages global speedrun record persistence using SQLite. Tracks team speedrun completion times with section breakdowns.
  • Constructor Details

    • RunRecordsService

      public RunRecordsService(org.bukkit.plugin.java.JavaPlugin plugin, String dbFileName)
      Creates a records service bound to this plugin's data folder and logger.
      Parameters:
      plugin - plugin providing data folder and logger context
      dbFileName - filename of the SQLite database within the plugin data folder
  • Method Details

    • initialize

      public void initialize()
      Initializes the database connection and creates tables if they don't exist.
    • recordRun

      public RunRecord recordRun(long overallTimeMs, long overworldToNetherMs, long netherToBlazeRodsMs, long blazeRodsToEndMs, long netherToEndMs, long endToDragonMs, List<String> participants, List<String> enabledComponents, String difficulty)
      Records a completed team speedrun with section timings and enabled mechanics.
      Parameters:
      overallTimeMs - total elapsed time in milliseconds
      overworldToNetherMs - time from start to reaching Nether
      netherToBlazeRodsMs - time from Nether entry to blaze objective completion
      blazeRodsToEndMs - time from blaze objective completion to End entry
      netherToEndMs - time from Nether to End
      endToDragonMs - time from End to dragon defeat
      participants - participant names included in the run
      enabledComponents - component keys for mechanics enabled during the run
      difficulty - difficulty key for the run (easy/normal/hard)
      Returns:
      the created RunRecord
    • getBestOverallTime

      public long getBestOverallTime()
      Gets the best overall time across all recorded runs.
      Returns:
      the best overall time in milliseconds, or -1 if no records exist
    • getBestSectionTime

      public long getBestSectionTime(String section)
      Gets the best time for a specific section across all runs.
      Parameters:
      section - the section name: "overworld_to_nether", "nether_to_end", or "end_to_dragon"
      Returns:
      the best section time in milliseconds, or -1 if no records exist
    • getAllRecords

      public List<RunRecord> getAllRecords()
      Gets all recorded runs.
      Returns:
      a list of all RunRecords
    • shutdown

      public void shutdown()
      Closes the database connection.