Updated API Usages (markdown)
parent
abb695ad07
commit
c4b3acd280
|
@ -35,4 +35,46 @@ worldManager.loadWorld("creative");
|
|||
```
|
||||
Things to note:
|
||||
* You cannot unload the default world defined in `level-name` of `server.properties`.
|
||||
* You can only load worlds that are known by Multiverse, use the `MVWorldManager#addWorld` method mentioned previously.
|
||||
* You can only load worlds that are known by Multiverse, use the `MVWorldManager#addWorld` method mentioned previously.
|
||||
|
||||
### Deleting a world
|
||||
The world is no longer of use? you can delete it with a simple API method.
|
||||
```java
|
||||
worldManager.deleteWorld("uselessworld");
|
||||
```
|
||||
Things to note:
|
||||
* You __cannot__ undo this action or restore the world back.
|
||||
* You can only delete worlds that can be loaded by the server.
|
||||
* If the world folder is already removed from the server files, use [`MVWorldManager#removeWorldFromConfig`](http://ci.onarandombox.com/job/Multiverse-Core/javadoc/com/onarandombox/MultiverseCore/api/MVWorldManager.html#removeWorldFromConfig-java.lang.String-) method.
|
||||
|
||||
## MultiverseWorld
|
||||
A class on top of the Bukkit's World object to provide additional world management features. This may also be used in methods of the other Multiverse modules.
|
||||
|
||||
### Getting a MultiverseWorld instance
|
||||
With the world manager you have earlier, we can use that to get a MultiverseWorld.
|
||||
```java
|
||||
MultiverseWorld creativeWorld = world.getMVWorld("creative");
|
||||
```
|
||||
|
||||
### Changing GameMode property
|
||||
Since this is a creative world, we want people to be set to creative mode when entering the world.
|
||||
```java
|
||||
creativeWorld.setGameMode(GameMode.CREATIVE);
|
||||
```
|
||||
Things to note:
|
||||
* This can be bypassed with `mv.bypass.gamemode.WORLDNAME` permission node.
|
||||
* This doesn't not restrict the use of minecraft `/gamemode` (if you have the perms for it), just an enforcement upon entering a world.
|
||||
|
||||
### Modifying and getting world alias
|
||||
World alias allows you to display the world to players with fancy colours and styles.
|
||||
Setting alias:
|
||||
```java
|
||||
creativeWorld.setAlias("&cCreative Wonder");
|
||||
```
|
||||
Sending alias to a player.
|
||||
```
|
||||
public void tellMeWhereAmI(MultiverseWorld world, Player player) {
|
||||
String worldAlias = world.getColoredWorldString();
|
||||
player.sendMessage("You are at " + worldAlias);
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue