Update DOCUMENTATION.md

This commit is contained in:
Jitse Boonstra 2019-08-03 18:12:06 +02:00 committed by GitHub
parent 74b115e733
commit 5b2f3fc84a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -2,9 +2,9 @@
NPCLib Basic non-player character library.<br>
=
This is an API made specifically for spigot servers (Minecraft). Current supported versions: **1.7.10\* - 1.13.2**. Lightweight replacement for Citizens. NPCLib only uses packets instead of registering the entity in the actual Minecraft server.
This is an API made specifically for spigot servers (Minecraft). Current supported versions: **1.7.10\* - 1.14.4**. Lightweight replacement for Citizens. NPCLib only uses packets instead of registering the entity in the actual Minecraft server.
\*NPCLib has basic support for 1.7.10, as it not currently support multi-line text for this version (yet).
\*NPCLib has basic support for 1.7.10 and is not actively maintained.
## Documentation
@ -37,15 +37,15 @@ Now you have an instance of the library, it is time to create your first NPC! Yo
If you want your NPC to have a custom skin, either [create your own Skin object](#create-skin-object) or fetch the data from [mineskin.org](https://mineskin.org) using the [SkinFetcher](#skin-fetcher) class.
```Java
// Skin parameter: The skin you would like the NPC to have (may be null).
// AutoHideDistance parameter: The distance NPCLib will use to automatically hide the NPC (default = 50).
// Lines parameter: The text you would like to display above the NPC's head (may be null).
NPC npc = library.createNPC(Skin skin, double autoHideDistance, List<String> lines);
// Lines parameter: The text you would like to display above the NPC's head (optional).
NPC npc = library.createNPC(List<String> lines);
```
Even though you have created the NPC object now, you will not be able to see it just yet. We first need to show it to the player. The NPC does not show up to players automatically because NPCLib relies on packets rather than registering the actual entity in the Minecraft server.
Even though you have created the NPC object now, you will not be able to see it just yet. We first need to need to do some other things. The NPC does not show up to players automatically because NPCLib relies on packets rather than registering the actual entity in the Minecraft server.
```Java
npc.setLocation(Location location);
npc.create(); // Generates the packets.
npc.show(Player player);
```
@ -61,15 +61,15 @@ When you are done using the NPC, you will have to destroy all NPCs accordingly:
npc.destroy();
```
If you're destroying NPCs, because you are reloading your plugin. I recommend using the following method (as it does not use any schedulers):
When you are done with the NPC, you can destroy it accordingly. This will remove the NPC from the internal registry and hide it from all players that can (still) see it:
```Java
npc.destroy(true);
npc.destroy();
```
#### NPC handling
Every NPC is given a unique identifier (`NPC#getEntityId`)that should be used throughout your plugin to identify which NPC has been interacted with.
Every NPC is given a unique identifier (`NPC#getId`)that should be used throughout your plugin to identify which NPC has been interacted with.
#### Create skin object
@ -94,4 +94,4 @@ The ID in this method is the ID that is in the URL of your MineSkin skin (e.g. h
### Useful events
Events you may want to use are `NPCSpawnEvent`, `NPCDestroyEvent` and `NPCInteractEvent`.
Events you may want to use are `NPCShowEvent`, `NPCHideEvent` and `NPCInteractEvent`.