Class BiomeTrackerManager

java.lang.Object
com.storytimeproductions.stweaks.util.BiomeTrackerManager

public class BiomeTrackerManager extends Object
Manages tracking of biomes discovered by players. The class interacts with the database to persist and retrieve biome discovery data.
  • Constructor Details

    • BiomeTrackerManager

      public BiomeTrackerManager(DbManager dbManager, org.bukkit.plugin.java.JavaPlugin plugin)
      Constructs a new BiomeTrackerManager instance.
      Parameters:
      dbManager - The DbManager instance used to interact with the SQLite database.
  • Method Details

    • getDiscoveredBiomes

      public Set<String> getDiscoveredBiomes(UUID uuid)
      Retrieves a set of biomes that the player with the given UUID has discovered.
      Parameters:
      uuid - The UUID of the player.
      Returns:
      A set of biome keys that the player has discovered.
    • markBiomeDiscovered

      public boolean markBiomeDiscovered(UUID uuid, String biomeKey)
      Marks a biome as discovered for the player with the given UUID. If the biome is not already marked as discovered, it will be inserted into the database.
      Parameters:
      uuid - The UUID of the player.
      biomeKey - The biome key to mark as discovered.
      Returns:
      true if this is the first time the player has discovered this biome, false otherwise.
    • syncAndLoadBiomeItems

      public void syncAndLoadBiomeItems(Set<org.bukkit.block.Biome> allBiomes)
      Synchronizes and loads the biome-to-item mapping from the biome_item.yml configuration file. It ensures that any biomes that are not already mapped in the file are added, and any biomes that are no longer relevant are removed from the in-memory map.

      The method reads the configuration file to populate the biomeItemMap and ensures that the biome items are correctly associated with their respective biomes.

      Parameters:
      allBiomes - A set of all available biomes in the game. This is used to ensure that the configuration file is in sync with the current set of biomes.
    • formatBiomeName

      public static String formatBiomeName(String key)
      Formats the biome key into a human-readable name by capitalizing the first letter of each word and replacing underscores with spaces.
      Parameters:
      key - The biome key (e.g., "minecraft/desert").
      Returns:
      The formatted biome name (e.g., "Desert").