Skip to content

Commit

Permalink
Move over FancyNpcs docs
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Jan 4, 2024
1 parent 40386be commit ad594bf
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Writerside/fp.tree
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@
<toc-element topic="FN-Getting-started.md"/>
<toc-element topic="FN-Commands.md"/>
<toc-element topic="FN-API.md"/>
<toc-element topic="FN-Misc.md">
<toc-element topic="FN-Multiple-lines.md"/>
</toc-element>
</toc-element>
<toc-element topic="FancyHolograms.md">
<toc-element topic="FH-Getting-started.md"/>
<toc-element topic="FH-Commands.md"/>
<toc-element topic="FH-API.md"/>
<toc-element topic="FH-API.md">
</toc-element>
</toc-element>
<toc-element topic="Test.md">
<toc-element topic="Test-Markdown.md">
Expand Down
4 changes: 4 additions & 0 deletions Writerside/redirection-rules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@
<description>Created after removal of "This is the first topic" from FancyPlugins</description>
<accepts>Default-topic.html</accepts>
</rule>
<rule id="1f230ebb">
<description>Created after removal of "Getting started" from FancyPlugins</description>
<accepts>FN-API-Getting-started.html</accepts>
</rule>
</rules>
37 changes: 36 additions & 1 deletion Writerside/topics/FH-API.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# API

TODO
## Including the API into your project

### Gradle

```gradle
repositories {
maven("https://repo.fancyplugins.de/releases")
...
}
```

```gradle
dependencies {
compileOnly("de.oliver:FancyHolograms:version")
...
}
```

### Maven

```maven
<repository>
<id>fancyplugins-releases</id>
<name>FancyPlugins Repository</name>
<url>https://repo.fancyplugins.de/releases</url>
</repository>
```

```maven
<dependency>
<groupId>de.oliver</groupId>
<artifactId>FancyHolograms</artifactId>
<version>VERSION</version>
</dependency>
```
103 changes: 102 additions & 1 deletion Writerside/topics/FN-API.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,104 @@
# API

TODO
## Including the API into your project

### Gradle

```gradle
repositories {
maven("https://repo.fancyplugins.de/releases")
...
}
```

```gradle
dependencies {
compileOnly("de.oliver:FancyNpcs:version")
...
}
```

### Maven

```maven
<repository>
<id>fancyplugins-releases</id>
<name>FancyPlugins Repository</name>
<url>https://repo.fancyplugins.de/releases</url>
</repository>
```

```maven
<dependency>
<groupId>de.oliver</groupId>
<artifactId>FancyNpcs</artifactId>
<version>VERSION</version>
</dependency>
```

## List of all events

### NpcCreateEvent

Is fired when a new NPC is being created

### NpcRemoveEvent

Is fired when a NPC is being removed

### NpcSpawnEvent

Is fired when a NPC is being spawned

### NpcModifyEvent

Is fired when a NPC is being modified

### NpcInteractEvent

Is fired when a player interacts with a NPC

### NpcStartLookingEvent

Is fired when NPC starts looking at a player

### NpcStopLookingEvent

Is fired when NPC stops looking at a player

## Creating a NPC

```java
NpcData data = new NpcData("myNpc", creatorUUID, location);
SkinFetcher skin = new SkinFetcher("username or url");
data.setSkin(skin);
data.setDisplayName("<red>cool displayname");

Npc npc = FancyNpcsPlugin.get().getNpcAdapter().apply(data);
FancyNpcsPlugin.get().getNpcManager().registerNpc(npc);
npc.create();
npc.spawnForAll();
```

## Modify a NPC

```java
Npc npc = FancyNpcsPlugin.get().getNpcManager().getNpc("myNpc");
npc.getData().setDisplayName("New cool display name");

npc.updateForAll();

// for some modifications you need to respawn the npc
npc.removeForAll();
npc.spawnForAll();
```

## Remove a NPC

```java
Npc npc = FancyNpcsPlugin.get().getNpcManager().getNpc("myNpc");
npc.removeForAll();

FancyNpcsPlugin.get().getNpcManager().removeNpc(npc);
```
194 changes: 193 additions & 1 deletion Writerside/topics/FN-Commands.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,195 @@
# Commands

TODO
This page provides detailed information about the various commands available in FancyNpcs, allowing you to make the
most out of its features.

## /FancNpcs ...

This command is to manage the plugin itself.

### version

Description: Shows the current version of the plugin<br>
Syntax: ``/FancyNpcs version``<br>
Permission: ``FancyNpcs.admin``

### reload

Description: Reloads the language file and all npcs<br>
Syntax: ``/FancyNpcs reload``<br>
Permission: ``FancyNpcs.admin``

### save

Description: Saves all npcs to disk<br>
Syntax: ``/FancyNpcs save``<br>
Permission: ``FancyNpcs.admin``

### featureFlags

Description: Shows a list of all enabled feature flags<br>
Syntax: ``/FancyNpcs featureFlags``<br>
Permission: ``FancyNpcs.admin``

## /Npc ...

This command is to manage the npcs.

For all subcommands of /npc - ``FancyNpcs.npc.*``<br>

### help

Description: Shows a list of all commands<br>
Syntax: ``/Npc help``<br>
Permission: ``FancyNpcs.npc.help`` or ``FancyNpcs.npc.*``

### info

Description: Shows all important information about an npc<br>
Syntax: ``/Npc into (npc)``<br>
Permission: ``FancyNpcs.npc.info`` or ``FancyNpcs.npc.*``

### create

Description: Creates a new npc at your location<br>
Syntax: ``/Npc create (npc)``<br>
Permission: ``FancyNpcs.npc.create`` or ``FancyNpcs.npc.*``

### remove

Description: Removes the npc<br>
Syntax: ``/Npc remove (npc)``<br>
Permission: ``FancyNpcs.npc.remove`` or ``FancyNpcs.npc.*``

### copy

Description: Creates a copy of the npc<br>
Syntax: ``/Npc copy (npc) (new name)``<br>
Permission: ``FancyNpcs.npc.copy`` or ``FancyNpcs.npc.*``

### list

Description: Shows a list of all created npcs<br>
Syntax: ``/Npc list``<br>
Permission: ``FancyNpcs.npc.list`` or ``FancyNpcs.npc.*``

### type

Description: Changes the entity type of the npc<br>
Syntax: ``/Npc type (npc name) (type)``<br>
Permission: ``FancyNpcs.npc.type`` or ``FancyNpcs.npc.*``

When using any entity type other than Player, the following features are disabled:

- Changing the skin
- Changing the equipment
- Showing in tab

### attribute

Description: Changes a type-specific attribute of the npc<br>
Syntax: ``/Npc attribute (npc name) (attribute) (value)``<br>
Permission: ``FancyNpcs.npc.attribute`` or ``FancyNpcs.npc.*``

### displayName

Description: Changes the displayname of the npc<br>
Syntax: ``/Npc displayName (npc name) (display name ...)``<br>
Permission: ``FancyNpcs.npc.displayName`` or ``FancyNpcs.npc.*``<br>
Placeholders:

- all placeholders from PlaceholderAPI
- ``<empty>`` will make the displayname disappear completely

### showInTab

Description: Changes whether the npc will be shown in the tablist or not<br>
Syntax: ``/Npc showInTab (npc name) ('true' | 'false')``<br>
Permission: ``FancyNpcs.npc.showInTab`` or ``FancyNpcs.npc.*``

### skin

Description: Changes the skin of the npc<br>
Syntax: ``/Npc skin (npc name) (username | url to .png)``<br>
Syntax: ``/Npc skin`` - uses your skin<br>
Permission: ``FancyNpcs.npc.skin`` or ``FancyNpcs.npc.*``

### equipment

Description: Equips the npc with item you are holding in your mainhand<br>
Syntax: ``/Npc equipment (npc name) (slot)``<br>
Permission: ``FancyNpcs.npc.equipment`` or ``FancyNpcs.npc.*``

### glowing

Description: Changes whether the npc should glow or not<br>
Syntax: ``/Npc glowing (npc name) ('true' | 'false')``<br>
Permission: ``FancyNpcs.npc.glowing`` or ``FancyNpcs.npc.*``

### glowingColor

Description: Changes the color of the glowing effect<br>
Syntax: ``/Npc glowingColor (npc name) (color)``<br>
Permission: ``FancyNpcs.npc.glowingColor`` or ``FancyNpcs.npc.*``

### collidable

Description: Changes whether the NPC will be collidable or not<br>
Syntax: ``/Npc collidable (npc name) ('true' | 'false')``<br>
Permission: ``FancyNpcs.npc.collidable`` or ``FancyNpcs.npc.*``

### turnToPlayer

Description: Changes whether the npc will turn to near players or not<br>
Syntax: ``/Npc turnToPlayer (npc name) ('true' | 'false')``<br>
Permission: ``FancyNpcs.npc.turnToPlayer`` or ``FancyNpcs.npc.*``

### message

Description: Changes the messages that will be sent to the player when interacting with the npc<br>
Syntax: ``/Npc message (npc name) add (message)`` - adds a new message<br>
Syntax: ``/Npc message (npc name) set (index) (message)`` - sets a message at an index<br>
Syntax: ``/Npc message (npc name) remove (index)`` - removes a message at an index<br>
Syntax: ``/Npc message (npc name) clear`` - removes all messages<br>
Permission: ``FancyNpcs.npc.message`` or ``FancyNpcs.npc.*``<br>
Placeholders:

- all placeholders from PlaceholderAPI

### playerCommand

Description: Changes the command that the player executes when interacting with the npc<br>
Syntax: ``/Npc playerCommand (npc name) ('none' | message ...)``<br>
Permission: ``FancyNpcs.npc.playerCommand`` or ``FancyNpcs.npc.*``<br>
Placeholders:

- all placeholders from PlaceholderAPI

### serverCommand

Description: Changes the command that the console executes when interacting with the npc<br>
Syntax: ``/Npc serverCommand (npc name) ('none' | message ...)``<br>
Permission: ``FancyNpcs.npc.serverCommand`` or ``FancyNpcs.npc.*``<br>
Placeholders:

- all placeholders from PlaceholderAPI
- ``{player}`` - the player's username

### interactionCooldown

Description: Changes the cooldown for player interactions with the npc<br>
Syntax: ``/Npc interactionCooldown (npc name) (time in seconds)``<br>
Permission: ``FancyNpcs.npc.interactionCooldown`` or ``FancyNpcs.npc.*``<br>

### moveHere

Description: Teleports the npc to you<br>
Syntax: ``/Npc moveHere (npc name)``<br>
Permission: ``FancyNpcs.npc.moveHere`` or ``FancyNpcs.npc.*``

### teleport

Description: Teleports the npc to the provided location<br>
Syntax: ``/Npc teleport (npc name) (x) (y) (z) [world]``<br>
_The ``world`` parameter is optional._<br>
Permission: ``FancyNpcs.npc.teleport`` or ``FancyNpcs.npc.*``
3 changes: 3 additions & 0 deletions Writerside/topics/FN-Misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Misc

Miscellaneous topics that don't fit anywhere else.
12 changes: 12 additions & 0 deletions Writerside/topics/FN-Multiple-lines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Multiple lines

To have multiple lines as the display name of an NPC follow the following steps:

1. download the [FancyHolograms](https://modrinth.com/plugin/fancyholograms/versions) plugin and put it in the plugins
folder
2. start your server and make sure the FancyNpcs and FancyHolograms plugin have both loaded
3. create a hologram with multiple lines
4. create a npc
5. link the hologram with the npc `/hologram edit <hologram> linkWithNpc <npc>`
6. you can now move the npc around and the hologram will always follow
7. to unlink simply run `/hologram edit <hologram> unlinkWithNpc`
Loading

0 comments on commit ad594bf

Please sign in to comment.