Class WorldManager
java.lang.Object
ActiverseUtils.WorldManager
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCreates the Worlds directory if it doesn't existstatic StringgetPlayerJsonPath(String worldName) Gets the path to player.jsonstatic StringgetWorldJsonPath(String worldName) Gets the path to world.jsonGets list of all world names (directories in Worlds/)static StringgetWorldPath(String worldName) Gets the path to a world directorystatic Map<String, WorldManager.BlockData> loadModifiedBlocks(String worldName) Loads modified blocksstatic WorldManager.PlayerDataloadPlayerData(String worldName) Loads player data from player.jsonstatic WorldManager.WorldDataloadWorldData(String worldName) Loads world data from world.jsonstatic voidsaveModifiedBlocks(String worldName, Map<String, WorldManager.BlockData> modifiedBlocks) Saves modified blocks (terrain tiles that were placed/destroyed)static voidsavePlayerData(String worldName, WorldManager.PlayerData playerData) Saves player data to player.jsonstatic voidsaveWorldData(String worldName, long seed, int tileSize, int worldWidth, int worldHeight) Saves world data to world.json
-
Constructor Details
-
WorldManager
public WorldManager()
-
-
Method Details
-
ensureWorldsDirectory
public static void ensureWorldsDirectory()Creates the Worlds directory if it doesn't exist -
getWorldList
-
getWorldPath
-
getWorldJsonPath
-
getPlayerJsonPath
-
saveWorldData
public static void saveWorldData(String worldName, long seed, int tileSize, int worldWidth, int worldHeight) Saves world data to world.json -
loadWorldData
Loads world data from world.json -
savePlayerData
Saves player data to player.json -
loadPlayerData
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
Loads modified blocks
-