Class WorldManager

java.lang.Object
ActiverseUtils.WorldManager

public class WorldManager extends Object
WorldManager - Handles saving and loading world data Manages world.json and player.json files in Worlds/[WorldName]/ directories This is a significantly harder class to implement than the others, so don't mess with it unless you know what you're doing
Version:
1.4.1
Author:
Knivier
  • Constructor Details

    • WorldManager

      public WorldManager()
  • Method Details

    • ensureWorldsDirectory

      public static void ensureWorldsDirectory()
      Creates the Worlds directory if it doesn't exist
    • getWorldList

      public static List<String> getWorldList()
      Gets list of all world names (directories in Worlds/)
    • getWorldPath

      public static String getWorldPath(String worldName)
      Gets the path to a world directory
    • getWorldJsonPath

      public static String getWorldJsonPath(String worldName)
      Gets the path to world.json
    • getPlayerJsonPath

      public static String getPlayerJsonPath(String worldName)
      Gets the path to player.json
    • saveWorldData

      public static void saveWorldData(String worldName, long seed, int tileSize, int worldWidth, int worldHeight)
      Saves world data to world.json
    • loadWorldData

      public static WorldManager.WorldData loadWorldData(String worldName)
      Loads world data from world.json
    • savePlayerData

      public static void savePlayerData(String worldName, WorldManager.PlayerData playerData)
      Saves player data to player.json
    • loadPlayerData

      public static WorldManager.PlayerData loadPlayerData(String worldName)
      Loads player data from player.json
    • saveModifiedBlocks

      public static void saveModifiedBlocks(String worldName, Map<String, WorldManager.BlockData> modifiedBlocks)
      Saves modified blocks (terrain tiles that were placed/destroyed)
    • loadModifiedBlocks

      public static Map<String, WorldManager.BlockData> loadModifiedBlocks(String worldName)
      Loads modified blocks