potential feature for per-player hologram names
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>net.jitse</groupId>
|
||||
<artifactId>npclib-nms</artifactId>
|
||||
<version>2.9-SNAPSHOT</version>
|
||||
<version>2.10-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>npclib-nms-v1_9_R2</artifactId>
|
||||
|
||||
@@ -38,9 +38,25 @@ public class NPC_v1_9_R2 extends NPCBase {
|
||||
super(instance, lines);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hologram getPlayerHologram(Player player) {
|
||||
Hologram holo = super.getPlayerHologram(player);
|
||||
if (holo == null){
|
||||
holo = new Hologram(MinecraftVersion.V1_9_R2, location.clone().add(0, 0.5, 0), getPlayerLines(player));
|
||||
}
|
||||
super.textDisplayHolograms.put(player.getUniqueId(), holo);
|
||||
return holo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void createPackets() {
|
||||
this.hologram = new Hologram(MinecraftVersion.V1_9_R2, location.clone().subtract(0, 0.5, 0), text);
|
||||
Bukkit.getOnlinePlayers().forEach(this::createPackets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPackets(Player player) {
|
||||
|
||||
PacketPlayOutPlayerInfoWrapper packetPlayOutPlayerInfoWrapper = new PacketPlayOutPlayerInfoWrapper();
|
||||
|
||||
@@ -74,7 +90,7 @@ public class NPC_v1_9_R2 extends NPCBase {
|
||||
playerConnection.sendPacket(packetPlayOutNamedEntitySpawn);
|
||||
playerConnection.sendPacket(packetPlayOutEntityHeadRotation);
|
||||
|
||||
hologram.show(player);
|
||||
getPlayerHologram(player).show(player);
|
||||
|
||||
// Removing the player info after 10 seconds.
|
||||
Bukkit.getScheduler().runTaskLater(instance.getPlugin(), () ->
|
||||
|
||||
Reference in New Issue
Block a user