You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace `2.9.2` with the version of the API you want to use. You can find the latest version on the download pages or in the GitHub releases.
45
+
Replace `${VERSION}` with the version of the API you want to use. You can find the latest version on the download pages or in the GitHub releases.
46
46
47
-
## Create a new NPC
47
+
## Create and manage worlds
48
48
49
-
### 1. Create the NPC data
50
-
51
-
The `NpcData` class is used to store all the information about an NPC. You can create a new instance of `NpcData` by providing a name, the UUID of the creator, and the location where the NPC should be spawned.
52
-
53
-
```java
54
-
NpcData data =newNpcData("myNpc", creatorUUID, location);
55
-
data.setSkin("OliverHD"); // use skin of the player OliverHD
You can use the NpcData object to create a new NPC. Because the implementation of the NPC is different for every Minecraft version, FancyNpcs provides a factory to create the NPC.
Do not register npcs in the first few seconds after the server has started. You need to wait at least 10 seconds before registering npcs. Otherwise, the npcs will not get registered correctly.
77
-
You can also listen to the `NpcsLoadedEvent` to know when you can register npcs.
78
-
</Callout>
79
-
80
-
<Callout>
81
-
If you don't want to persist the npc, you can do the following: `npc.setSaveToFile(false);`
82
-
</Callout>
83
-
84
-
### 4. Initially spawn the NPC for all players
85
-
86
-
To spawn the NPC for all players, you can use the following methods.
87
-
88
-
```java
89
-
npc.create();
90
-
npc.spawnForAll();
91
-
```
92
-
93
-
## Modify an existing NPC
94
-
95
-
### 1. Get the NPC object by name
96
-
97
-
You can get an NPC object by its name. The name is unique for every NPC (unless the `player-npcs` feature flag is enabled). Alternatively, you can get an NPC by its ID.
You can find the JavaDocs for the FancyNpcs API [here](https://repo.fancyinnovations.com/javadoc/releases/de/oliver/FancyNpcs/latest).
53
+
You can find the JavaDocs for the FancyWorlds API [here](https://repo.fancyinnovations.com/javadoc/releases/com/fancyinnovations/FancyWorlds/latest).
141
54
142
-
Join the [FancyInnovations Discord](https://discord.gg/ZUgYCEJUEx) for help and support. There is a dedicated channel for help about the api (`#npcs-api`).
55
+
Join the [FancyInnovations Discord](https://discord.gg/ZUgYCEJUEx) for help and support. There is a dedicated channel for help about the api (`#worlds-api`).
*You only need to the optional flags, if you want to change the world settings.
34
+
If you don't specify any flags, the world will be loaded with its existing settings.*
35
+
36
+
### Unload world
37
+
38
+
Unloads a world. There must be no players in the world for it to be unloaded, otherwise the command will fail unless you use the `--force` flag, which will teleport away players from the world before unloading it.
0 commit comments