diff --git a/pom.xml b/pom.xml
index 5b43edc..4b8eec6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
4.0.0
net.sourcewriters.minecraft
vcompat
- 2.0.1
+ 2.1.0
vCompat
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java
index d6a5ea0..0ed0dff 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/Hologram.java
@@ -116,6 +116,22 @@ public void teleport(Location location) {
* Entity handle
*/
+ @Override
+ public Hologram updateVisibility() {
+ int amount;
+ synchronized (entities) {
+ amount = entities.size();
+ }
+ for (int index = 0; index < amount; index++) {
+ NmsArmorStand entity;
+ synchronized (entities) {
+ entity = entities.get(index);
+ }
+ entity.updateVisibility();
+ }
+ return this;
+ }
+
public Hologram show(Player... players) {
int amount;
synchronized (entities) {
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java
index c5c5edf..4575c5b 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/CustomEntity.java
@@ -3,6 +3,7 @@
import java.util.UUID;
import org.bukkit.Location;
+import org.bukkit.entity.Player;
public abstract class CustomEntity {
@@ -67,5 +68,13 @@ public Location getLocation() {
public abstract void setInvulnerable(boolean invulnerable);
public abstract void teleport(Location location);
+
+ public abstract CustomEntity updateVisibility();
+
+ public abstract CustomEntity show(Player... players);
+
+ public abstract CustomEntity hide(Player... players);
+
+ public abstract boolean isShown(Player player);
}
\ No newline at end of file
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java
index d01576a..10027ae 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/entity/handler/EntityManager.java
@@ -6,10 +6,22 @@
import java.util.Optional;
import java.util.UUID;
-public class EntityManager {
+import org.bukkit.entity.Player;
+
+import net.sourcewriters.minecraft.vcompat.listener.PlayerListener;
+import net.sourcewriters.minecraft.vcompat.listener.handler.IPlayerHandler;
+import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer;
+
+public class EntityManager implements IPlayerHandler {
private final ArrayList entities = new ArrayList<>();
+ private boolean registered = false;
+
+ public EntityManager() {
+ start();
+ }
+
public CustomEntity create(EntityType type) {
return create(REGISTRY.getBuilderOrNull(type));
}
@@ -68,4 +80,36 @@ protected UUID generateId() {
return current;
}
+ /*
+ * Listening
+ */
+
+ public void start() {
+ if (registered) {
+ return;
+ }
+ registered = true;
+ PlayerListener.registerHandler(this);
+ }
+
+ public void stop() {
+ if (!registered) {
+ return;
+ }
+ registered = false;
+ PlayerListener.unregisterHandler(this);
+ }
+
+ @Override
+ public void onJoin(NmsPlayer player) {
+ Player bukkitPlayer = player.getBukkitPlayer();
+ CustomEntity[] entities = getAll();
+ for (CustomEntity entity : entities) {
+ if (!entity.isShown(bukkitPlayer)) {
+ continue;
+ }
+ entity.hide(bukkitPlayer).show(bukkitPlayer);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java b/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java
new file mode 100644
index 0000000..a9e07b1
--- /dev/null
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/listener/PlayerListener.java
@@ -0,0 +1,85 @@
+package net.sourcewriters.minecraft.vcompat.listener;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.plugin.Plugin;
+
+import net.sourcewriters.minecraft.vcompat.listener.handler.IPlayerHandler;
+import net.sourcewriters.minecraft.vcompat.reflection.PlayerProvider;
+import net.sourcewriters.minecraft.vcompat.reflection.VersionControl;
+import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer;
+
+public final class PlayerListener implements Listener {
+
+ public static final PlayerListener INSTANCE = new PlayerListener();
+
+ public static void register(Plugin plugin) {
+ Bukkit.getPluginManager().registerEvents(INSTANCE, plugin);
+ }
+
+ public static void registerHandler(IPlayerHandler handler) {
+ INSTANCE.register(handler);
+ }
+
+ public static void unregisterHandler(IPlayerHandler handler) {
+ INSTANCE.unregister(handler);
+ }
+
+ private final PlayerProvider> provider = VersionControl.get().getPlayerProvider();
+
+ private final List handlers = Collections.synchronizedList(new ArrayList<>());
+ private final Set set = Collections.synchronizedSet(new HashSet<>());
+
+ public void register(IPlayerHandler handler) {
+ if (handlers.contains(handler)) {
+ return;
+ }
+ handlers.add(handler);
+ }
+
+ public void unregister(IPlayerHandler handler) {
+ if (!handlers.contains(handler)) {
+ return;
+ }
+ handlers.remove(handler);
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onJoin(PlayerJoinEvent event) {
+ Player player = event.getPlayer();
+ if (set.contains(player.getUniqueId())) {
+ return;
+ }
+ set.add(player.getUniqueId());
+ NmsPlayer nmsPlayer = provider.getPlayer(player);
+ for (IPlayerHandler handler : handlers) {
+ handler.onJoin(nmsPlayer);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public void onQuit(PlayerQuitEvent event) {
+ Player player = event.getPlayer();
+ if (!set.contains(player.getUniqueId())) {
+ return;
+ }
+ set.remove(player.getUniqueId());
+ NmsPlayer nmsPlayer = provider.getPlayer(player);
+ for (IPlayerHandler handler : handlers) {
+ handler.onLeave(nmsPlayer);
+ }
+ }
+
+}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java b/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java
new file mode 100644
index 0000000..e3f789e
--- /dev/null
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/listener/handler/IPlayerHandler.java
@@ -0,0 +1,11 @@
+package net.sourcewriters.minecraft.vcompat.listener.handler;
+
+import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer;
+
+public interface IPlayerHandler {
+
+ default void onJoin(NmsPlayer player) {}
+
+ default void onLeave(NmsPlayer player) {}
+
+}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java
index 776a49d..04936e2 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/PlayerProvider.java
@@ -8,6 +8,7 @@
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
+import net.sourcewriters.minecraft.vcompat.reflection.data.persistence.PersistentContainer;
import net.sourcewriters.minecraft.vcompat.reflection.entity.NmsPlayer;
public abstract class PlayerProvider extends VersionHandler {
@@ -30,6 +31,10 @@ public NmsPlayer getPlayer(Player player) {
if (players.containsKey(player.getUniqueId())) {
NmsPlayer nmsPlayer = players.get(player.getUniqueId());
if (nmsPlayer.getBukkitPlayer() != player) {
+ Object container = nmsPlayer.getDataAdapter().getHandle();
+ if (container instanceof PersistentContainer) {
+ ((PersistentContainer>) container).delete();
+ }
players.put(player.getUniqueId(), nmsPlayer = createPlayer(player));
}
return nmsPlayer;
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java
index 3f645dd..c70a125 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/data/persistence/PersistentContainer.java
@@ -142,11 +142,11 @@ protected void read(NbtCompound compound) {
super.fromNbt(compound);
}
- protected void shutdown() {
+ public void shutdown() {
observer.shutdown();
}
- protected void delete() {
+ public void delete() {
lock.writeLock().lock();
observer.save();
super.getRoot().clear();
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java
index eda705f..ea115fa 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/entity/NmsEntity.java
@@ -42,6 +42,8 @@ public interface NmsEntity {
void setLocation(Location location);
Location getLocation();
+
+ void updateVisibility();
boolean isShown(Player player);
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java
index fb117a6..1d3cd41 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_10_R1/entity/Entity1_10_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java
index ef45a48..f8209e0 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_11_R1/entity/Entity1_11_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java
index f94a4df..b0bf472 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_12_R1/entity/Entity1_12_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java
index 87cd345..38653c3 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R1/entity/Entity1_13_R1.java
@@ -58,6 +58,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -132,7 +133,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java
index 6ec7d1b..a839bb1 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_13_R2/entity/Entity1_13_R2.java
@@ -58,6 +58,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -132,7 +133,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java
index 8c3517f..9a62cbc 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_14_R1/entity/Entity1_14_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java
index e82de9e..7b8d3cd 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_15_R1/entity/Entity1_15_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java
index 20d6539..0365a06 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R1/entity/Entity1_16_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java
index bd67eac..e65fbe7 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R2/entity/Entity1_16_R2.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java
index d6025b7..01d37be 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_16_R3/entity/Entity1_16_R3.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(CraftChatMessage.fromStringOrNull(name));
+ updateVisibility();
}
@Override
@@ -131,7 +132,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java
index 222b102..3bb5277 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R1/entity/Entity1_8_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -129,7 +130,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java
index 12c4913..7ab61b4 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R2/entity/Entity1_8_R2.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -129,7 +130,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java
index b624f1e..cfe965d 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_8_R3/entity/Entity1_8_R3.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -129,7 +130,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.a, vector.b, vector.c);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java
index fd6adac..10eb5a4 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R1/entity/Entity1_9_R1.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -129,7 +130,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}
diff --git a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java
index 70f8f98..0deb812 100644
--- a/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java
+++ b/src/main/java/net/sourcewriters/minecraft/vcompat/reflection/provider/v1_9_R2/entity/Entity1_9_R2.java
@@ -57,6 +57,7 @@ public NmsBoundingBox getBoundingBox() {
@Override
public void setCustomName(String name) {
handle.setCustomName(name);
+ updateVisibility();
}
@Override
@@ -129,7 +130,8 @@ public Location getLocation() {
return new Location(handle.getWorld().getWorld(), vector.x, vector.y, vector.z);
}
- private void updateVisibility() {
+ @Override
+ public void updateVisibility() {
if (visible.isEmpty()) {
return;
}