diff --git a/README.md b/README.md index 7a4a410..49f36ee 100755 --- a/README.md +++ b/README.md @@ -3,27 +3,33 @@ NPCLib – Basic non-player character library.
[![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. diff --git a/api/pom.xml b/api/pom.xml index ebdebc1..27be49f 100755 --- a/api/pom.xml +++ b/api/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib - 1.2.2 + 1.3 npclib-api @@ -73,10 +73,16 @@ ${project.version} compile + + net.jitse + npclib-nms-v1_13_R2 + ${project.version} + compile + clean install - NPCLib-API-v${project.version} + npclib-api-v${project.version} diff --git a/build.sh b/build.sh index 4a69bec..fba28cf 100755 --- a/build.sh +++ b/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!" \ No newline at end of file +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" \ No newline at end of file diff --git a/commons/pom.xml b/commons/pom.xml index 0ea6dcc..f7e75d9 100755 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib - 1.2.2 + 1.3 npclib-commons @@ -16,7 +16,7 @@ org.spigotmc spigot - 1.13-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided diff --git a/commons/src/main/java/net/jitse/npclib/listeners/PlayerListener.java b/commons/src/main/java/net/jitse/npclib/listeners/PlayerListener.java index fe803ea..18a5995 100755 --- a/commons/src/main/java/net/jitse/npclib/listeners/PlayerListener.java +++ b/commons/src/main/java/net/jitse/npclib/listeners/PlayerListener.java @@ -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) { diff --git a/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java b/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java index 6716b50..f6ae8cd 100755 --- a/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java +++ b/commons/src/main/java/net/jitse/npclib/nms/holograms/Hologram.java @@ -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; diff --git a/nms/pom.xml b/nms/pom.xml index afa2d7b..93bb047 100755 --- a/nms/pom.xml +++ b/nms/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib - 1.2.2 + 1.3 npclib-nms diff --git a/nms/v1_10_R1/pom.xml b/nms/v1_10_R1/pom.xml index 7e11409..d59f6a9 100755 --- a/nms/v1_10_R1/pom.xml +++ b/nms/v1_10_R1/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_10_R1 diff --git a/nms/v1_11_R1/pom.xml b/nms/v1_11_R1/pom.xml index 603b082..e38a305 100755 --- a/nms/v1_11_R1/pom.xml +++ b/nms/v1_11_R1/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_11_R1 diff --git a/nms/v1_12_R1/pom.xml b/nms/v1_12_R1/pom.xml index aa3e833..09b3df4 100755 --- a/nms/v1_12_R1/pom.xml +++ b/nms/v1_12_R1/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_12_R1 diff --git a/nms/v1_13_R1/pom.xml b/nms/v1_13_R1/pom.xml index 600c99d..45a1e74 100755 --- a/nms/v1_13_R1/pom.xml +++ b/nms/v1_13_R1/pom.xml @@ -1,8 +1,4 @@ - - @@ -11,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_13_R1 diff --git a/nms/v1_13_R2/pom.xml b/nms/v1_13_R2/pom.xml index 62289cb..c3651fc 100755 --- a/nms/v1_13_R2/pom.xml +++ b/nms/v1_13_R2/pom.xml @@ -1,8 +1,4 @@ - - @@ -11,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_13_R2 @@ -20,7 +16,7 @@ org.spigotmc spigot - 1.13.1-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided diff --git a/nms/v1_8_R1/pom.xml b/nms/v1_8_R1/pom.xml index 4a71244..25d62d1 100755 --- a/nms/v1_8_R1/pom.xml +++ b/nms/v1_8_R1/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_8_R1 diff --git a/nms/v1_8_R2/pom.xml b/nms/v1_8_R2/pom.xml index ed4c818..4936191 100755 --- a/nms/v1_8_R2/pom.xml +++ b/nms/v1_8_R2/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_8_R2 diff --git a/nms/v1_8_R3/pom.xml b/nms/v1_8_R3/pom.xml index d887a35..3445740 100755 --- a/nms/v1_8_R3/pom.xml +++ b/nms/v1_8_R3/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_8_R3 diff --git a/nms/v1_9_R1/pom.xml b/nms/v1_9_R1/pom.xml index 4d421f6..1e450c9 100755 --- a/nms/v1_9_R1/pom.xml +++ b/nms/v1_9_R1/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_9_R1 diff --git a/nms/v1_9_R2/pom.xml b/nms/v1_9_R2/pom.xml index db98204..62d69bc 100755 --- a/nms/v1_9_R2/pom.xml +++ b/nms/v1_9_R2/pom.xml @@ -7,7 +7,7 @@ net.jitse npclib-nms - 1.2.2 + 1.3 npclib-nms-v1_9_R2 diff --git a/plugin/pom.xml b/plugin/pom.xml index 60bfc66..f9f3393 100755 --- a/plugin/pom.xml +++ b/plugin/pom.xml @@ -7,14 +7,14 @@ net.jitse npclib - 1.2.2 + 1.3 npclib-plugin ../target - NPCLib-Plugin-v${project.parent.version} + npclib-plugin-v${project.parent.version} src/main/resources diff --git a/pom.xml b/pom.xml index bb5d189..2987d62 100755 --- a/pom.xml +++ b/pom.xml @@ -8,10 +8,10 @@ net.jitse npclib - 1.2.2 + 1.3 NPCLib - https://github.com/JitseB/npclib + https://github.com/JitseB/NPCLib UTF-8 @@ -37,7 +37,7 @@ org.spigotmc spigot-api - 1.12.2-R0.1-SNAPSHOT + 1.13.2-R0.1-SNAPSHOT provided