Updates for v1.3.
This commit is contained in:
parent
e0f7ed2ab7
commit
a6e8c0f4ce
47
README.md
47
README.md
|
@ -3,27 +3,33 @@ NPCLib – Basic non-player character library.<br>
|
|||
[![Release](https://jitpack.io/v/JitseB/NPCLib.svg)](https://github.com/JitseB/NPCLib/releases)
|
||||
[![Build Status](https://travis-ci.com/JitseB/NPCLib.svg?branch=master)](https://travis-ci.com/JitseB/NPCLib)
|
||||
[![JDK](https://img.shields.io/badge/Using-Java%208-blue.svg)](http://jdk.java.net/8/)
|
||||
[![Versions](https://img.shields.io/badge/MC-1.8%20--%201.13-blue.svg)](https://github.com/JitseB/NPCLib/releases)
|
||||
[![Versions](https://img.shields.io/badge/MC-1.8%20--%201.13.2-blue.svg)](https://github.com/JitseB/NPCLib/releases)
|
||||
=
|
||||
|
||||
This is an API made specifically for spigot servers (Minecraft). Current supported versions: **1.8 - 1.13**. 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.8 - 1.13.2**. Lightweight replacement for Citizens. NPCLib only uses packets instead of registering the entity in the actual Minecraft server.
|
||||
|
||||
**Resource**: https://www.spigotmc.org/resources/npclib.55884/
|
||||
**Thread**: https://www.spigotmc.org/threads/npclib-–-basic-non-player-character-library.314460/
|
||||
**Preview**: https://youtu.be/LqwdqIxPIvE
|
||||
**SpigotMC Resource** https://www.spigotmc.org/resources/npclib.55884/
|
||||
**SpigotMC Thread** https://www.spigotmc.org/threads/npclib-–-basic-non-player-character-library.314460/
|
||||
|
||||
**Preview** (click to play video)
|
||||
|
||||
[![YouTube Video](http://img.youtube.com/vi/LqwdqIxPIvE/0.jpg)](http://www.youtube.com/watch?v=LqwdqIxPIvE "NPCLib – Basic non-player character library (Minecraft).")
|
||||
|
||||
## Donate
|
||||
|
||||
[![PayPal](https://cdn.rawgit.com/twolfson/paypal-github-button/1.0.0/dist/button.svg)](https://paypal.me/jitseboonstra)
|
||||
|
||||
Alternatively, you can help the project by starring the repository or telling others about NPCLib :smile:
|
||||
Alternatively, you can help the project by starring the repository or telling others about NPCLib. :smile:
|
||||
|
||||
## Usage
|
||||
## Developers
|
||||
|
||||
It is recommended to shade `NPCLib-API-v*.jar` into your plugin.
|
||||
Alternatively, you may put `NPCLib-Plugin-v*.jar` under your `plugins` folder. By using this option, you do not need to shade the API JAR anymore. Though, do not forget to add `NPCLib` as a dependency in your `plugin.yml`!
|
||||
### Usage
|
||||
|
||||
You can download the latest release [here](https://github.com/JitseB/NPCLib/releases/latest).
|
||||
It is recommended to shade `npclib-api-v*.jar` into your plugin.
|
||||
Alternatively, you can put `npclib-plugin-v*.jar` under your `plugins` folder. By doing this, you no longer need to shade the API JAR. Though, do not forget to add `NPCLib` as a dependency in your `plugin.yml`!
|
||||
|
||||
|
||||
[Click here](https://github.com/JitseB/NPCLib/releases/latest) to download the latest release.
|
||||
|
||||
```Java
|
||||
// First we define our (global) library variable.
|
||||
|
@ -33,26 +39,35 @@ You can download the latest release [here](https://github.com/JitseB/NPCLib/rele
|
|||
|
||||
```Java
|
||||
|
||||
// Creating an NPC.
|
||||
// Creating a new NPC instance.
|
||||
NPC npc = lib.createNPC(skin, lines);
|
||||
|
||||
// The generate the packets for the NPC.
|
||||
// Then let the library generate the necessary packets.
|
||||
npc.create(location);
|
||||
|
||||
// Then *finally* you can show/hide it to/from players.
|
||||
// You are all set! You can now show/hide it to/from players.
|
||||
npc.show(player);
|
||||
npc.hide(player);
|
||||
|
||||
// If you do not use the NPC anymore, destroy the NPC accordingly.
|
||||
// If you do not wish to use the NPC anymore, destroy it accordingly.
|
||||
npc.destroy();
|
||||
```
|
||||
|
||||
Usable events: `NPCSpawnEvent`, `NPCDestroyEvent` and `NPCInteractEvent`.
|
||||
### Events
|
||||
|
||||
Events you may want to use are `NPCSpawnEvent`, `NPCDestroyEvent` and `NPCInteractEvent`.
|
||||
|
||||
### Building your own version
|
||||
|
||||
1. [Download](https://github.com/JitseB/NPCLib/archive/master.zip) or clone this repository.
|
||||
2. Build the plugin using `sh build.sh`. Alternatively, you can build the API JAR manually using `mvn clean install`.
|
||||
|
||||
You can build the plugin using `mvn clean install -pPlugin`.
|
||||
|
||||
## License and plugins using NPCLib
|
||||
|
||||
NPCLib is licensed under the [MIT license](https://github.com/JitseB/NPCLib/blob/master/LICENSE.md).
|
||||
Developers are free to use NPCLib for both private and commercial use. Though, it would be nice to acknowledge me.
|
||||
Developers are free to use NPCLib for both private and commercial use. However, it would be nice to acknowledge me.
|
||||
|
||||
You (the developer) can also contact me if you wish to be added to the list below.
|
||||
|
||||
|
|
10
api/pom.xml
10
api/pom.xml
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-api</artifactId>
|
||||
|
@ -73,10 +73,16 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms-v1_13_R2</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<finalName>NPCLib-API-v${project.version}</finalName>
|
||||
<finalName>npclib-api-v${project.version}</finalName>
|
||||
</build>
|
||||
</project>
|
||||
|
|
15
build.sh
15
build.sh
|
@ -1,10 +1,11 @@
|
|||
echo "Building NPCLib jars..."
|
||||
#!/bin/bash
|
||||
|
||||
echo "Building JARs..."
|
||||
|
||||
ls jars >> /dev/null 2>&1 || mkdir jars
|
||||
|
||||
echo "Building NPCLib-API.jar..."
|
||||
mvn clean install >> /dev/null 2>&1 && cp ./api/target/*.jar ./jars && echo "Finished building NPCLib-API.jar." || echo "Failed building NPCLib-API.jar. Please rebuild manually!"
|
||||
echo "Building npclib-api.jar..."
|
||||
/usr/local/apache-maven-3.5.4/bin/mvn clean install >> /dev/null 2>&1 && cp ./api/target/*.jar ./jars && echo "Finished building NPCLib API" || echo "Failed building NPCLib API. Please rebuild manually"
|
||||
|
||||
echo "Building NPCLib-Plugin.jar..."
|
||||
mvn clean install -Pplugin >> /dev/null 2>&1 && cp ./target/*.jar ./jars && echo "Finished building NPCLib-Plugin.jar." || echo "Failed building NPCLib-Plugin.jar. Please rebuild manually!"
|
||||
|
||||
echo "Finished building NPCLib jars!"
|
||||
echo "Building npclib-plugin.jar..."
|
||||
/usr/local/apache-maven-3.5.4/bin/mvn clean install -Pplugin >> /dev/null 2>&1 && cp ./target/*.jar ./jars && echo "Finished building NPCLib plugin" || echo "Failed building NPCLib plugin. Please rebuild manually"
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-commons</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -77,7 +77,7 @@ public class PlayerListener implements Listener {
|
|||
// This will cause issues otherwise (e.g. custom skin disappearing).
|
||||
double hideDistance = npc.getAutoHideDistance();
|
||||
double distanceSquared = player.getLocation().distanceSquared(npc.getLocation());
|
||||
boolean inRange = distanceSquared <= (hideDistance * hideDistance) || distanceSquared <= (Bukkit.getViewDistance() << 4);
|
||||
boolean inRange = distanceSquared <= (hideDistance * hideDistance) && distanceSquared <= (Bukkit.getViewDistance() << 4);
|
||||
if (npc.getAutoHidden().contains(player.getUniqueId())) {
|
||||
// Check if the player and NPC are within the range to sendShowPackets it again.
|
||||
if (inRange) {
|
||||
|
|
|
@ -5,13 +5,8 @@
|
|||
package net.jitse.npclib.nms.holograms;
|
||||
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import net.minecraft.server.v1_13_R1.EntityArmorStand;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Nameable;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftArmorStand;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_10_R1</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_11_R1</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_12_R1</artifactId>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018 Jitse Boonstra
|
||||
-->
|
||||
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
@ -11,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_13_R1</artifactId>
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Copyright (c) 2018 Jitse Boonstra
|
||||
-->
|
||||
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
@ -11,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_13_R2</artifactId>
|
||||
|
@ -20,7 +16,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<version>1.13.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_8_R1</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_8_R2</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_8_R3</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_9_R1</artifactId>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_9_R2</artifactId>
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-plugin</artifactId>
|
||||
|
||||
<build>
|
||||
<directory>../target</directory>
|
||||
<finalName>NPCLib-Plugin-v${project.parent.version}</finalName>
|
||||
<finalName>npclib-plugin-v${project.parent.version}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -8,10 +8,10 @@
|
|||
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib</artifactId>
|
||||
<version>1.2.2</version>
|
||||
<version>1.3</version>
|
||||
|
||||
<name>NPCLib</name>
|
||||
<url>https://github.com/JitseB/npclib</url>
|
||||
<url>https://github.com/JitseB/NPCLib</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.13.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
Loading…
Reference in New Issue