3. Management & Control
The IWorldManager manages all worlds, while the IManageableWorld object allows control over a specific world.
Retrieve worlds
// Retrive a single world
Optional<IManageableWorld> worldOpt = worldManager.getWorld("Lobby");
// Retrive all worlds
List<IManageableWorld> allWorlds = worldManager.getWorlds();
World actions
Each IManageableWorld object provides methods for control:
Method | Description |
| Loads the world from the hard drive (Bukkit World Init). |
| Unloads the world and teleports players to the main spawn. |
| Irrevocably deletes the world (files & database entry). |
| Deletes the world and regenerates it (reset). Optionally with backup (true) or without (false). |
| Creates a copy of the world under a new name. |
Example: Performing a world reset
worldManager.getWorld(“Farmworld”).ifPresent(world -> {
// Reset world and keep copy of old world
world.reCreate(true);
});
Example: Remove world (from the system)
If you want to remove a world from GWorld (including deleting the files):
// Option A: Directly via the object (recommended)
world.deleteMap();
// Option B: Over the manager
worldManager.removeWorld(world);
No comments to display
No comments to display