Merge branch 'master' into fix/getPlayerHolo-npe

This commit is contained in:
Jitse Boonstra
2020-07-28 12:18:01 +02:00
committed by GitHub
25 changed files with 25 additions and 408 deletions
+2 -2
View File
@@ -8,7 +8,7 @@
<parent>
<artifactId>npclib</artifactId>
<groupId>net.jitse</groupId>
<version>2.10-SNAPSHOT</version>
<version>2.9-SNAPSHOT</version>
</parent>
<artifactId>npclib-api</artifactId>
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -85,13 +85,13 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
Validate.notNull(targetPlayer, "Player cannot be null.");
List<String> originalLines = getPlayerLines(targetPlayer);
setPlayerLines(uniqueLines, targetPlayer);
if (update){
if (originalLines.size() != uniqueLines.size()){ // recreate the entire hologram
if (update) {
if (originalLines.size() != uniqueLines.size()) { // recreate the entire hologram
Hologram originalhologram = getPlayerHologram(targetPlayer);
originalhologram.hide(targetPlayer); // essentially destroy the hologram
textDisplayHolograms.remove(targetPlayer.getUniqueId()); // remove the old obj
}
if (isShown(targetPlayer)) { //only show hologram if the player is in range
Hologram hologram = getPlayerHologram(targetPlayer);
List<Object> updatePackets = hologram.getUpdatePackets(getPlayerLines(targetPlayer));
@@ -217,7 +217,7 @@ public abstract class NPCBase implements NPC, NPCPacketHandler {
public boolean inViewOf(Player player) {
Vector dir = location.toVector().subtract(player.getEyeLocation().toVector()).normalize();
return dir.dot(player.getLocation().getDirection()) >= cosFOV;
return dir.dot(player.getEyeLocation().getDirection()) >= cosFOV;
}
@Override