use of com.loohp.interactionvisualizer.entityholders.DynamicVisualizerEntity in project InteractionVisualizer by LOOHP.
the class PacketManager method dynamicEntity.
public static void dynamicEntity() {
Bukkit.getScheduler().runTaskTimerAsynchronously(InteractionVisualizer.plugin, () -> {
Iterator<DynamicVisualizerEntity> itr = dynamicTracking.keySet().iterator();
while (itr.hasNext()) {
DynamicVisualizerEntity entity = itr.next();
Set<Player> players = dynamicTracking.get(entity);
if (players == null || players.isEmpty()) {
itr.remove();
continue;
}
Iterator<Player> itr2 = players.iterator();
while (itr2.hasNext()) {
Player player = itr2.next();
Location location = player.getEyeLocation();
if (!location.getWorld().equals(entity.getWorld())) {
itr2.remove();
} else {
ServerPacketSender.teleportEntity(player, entity.getEntityId(), entity.getViewingLocation(location, location.getDirection()));
}
}
}
}, 0, 2);
}
Aggregations