# 3. Management & Control

<span style="white-space: pre-wrap;">The </span>`<span class="editor-theme-code">IWorldManager</span>`<span style="white-space: pre-wrap;"> manages all worlds, while the </span>`<span class="editor-theme-code">IManageableWorld</span>`<span style="white-space: pre-wrap;"> object allows control over a specific world.</span>

# Retrieve worlds

```java
// Retrive a single world
Optional<IManageableWorld> worldOpt = worldManager.getWorld("Lobby");

// Retrive all worlds
List<IManageableWorld> allWorlds = worldManager.getWorlds();
```

## World actions

<span style="white-space: pre-wrap;">Each </span>`<span class="editor-theme-code">IManageableWorld</span>`<span style="white-space: pre-wrap;"> object provides methods for control:</span>

<table id="bkmrk-methodebeschreibungl" style="margin-bottom: 32px;"><colgroup><col></col><col></col></colgroup><tbody><tr><td style="border: 1px solid;">**Method**

</td><td style="border: 1px solid;">**Description**

</td></tr><tr><td style="border: 1px solid;"><code>&#60;span class&#61;&#34;editor&#45;theme&#45;code&#34;&#62;loadMap&#40;&#41;&#60;&#47;span&#62;</code>

</td><td style="border: 1px solid;">Loads the world from the hard drive (Bukkit World Init).

</td></tr><tr><td style="border: 1px solid;"><code>&#60;span class&#61;&#34;editor&#45;theme&#45;code&#34;&#62;unloadMap&#40;&#41;&#60;&#47;span&#62;</code>

</td><td style="border: 1px solid;">Unloads the world and teleports players to the main spawn.

</td></tr><tr><td style="border: 1px solid;"><code>&#60;span class&#61;&#34;editor&#45;theme&#45;code&#34;&#62;deleteMap&#40;&#41;&#60;&#47;span&#62;</code>

</td><td style="border: 1px solid;">Irrevocably deletes the world (files &amp; database entry).

</td></tr><tr><td style="border: 1px solid;"><code>&#60;span class&#61;&#34;editor&#45;theme&#45;code&#34;&#62;reCreate&#40;boolean save&#41;&#60;&#47;span&#62;</code>

</td><td style="border: 1px solid;">Deletes the world and regenerates it (reset). Optionally with backup (true) or without (false).

</td></tr><tr><td style="border: 1px solid;"><code>&#60;span class&#61;&#34;editor&#45;theme&#45;code&#34;&#62;clone&#40;String name&#41;&#60;&#47;span&#62;</code>

</td><td style="border: 1px solid;">Creates a copy of the world under a new name.

</td></tr></tbody></table>

### Example: Performing a world reset

```java
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):

```java
// Option A: Directly via the object (recommended)
world.deleteMap();

// Option B: Over the manager
worldManager.removeWorld(world);
```