Moves wrongly on Hologram.teleport()
woodyn1002 opened this issue ยท 4 comments
When using 'teleport(Location)', the hologram moves more than that location. (sorry for my bad english)
For example, when moving hologram from (0, 0, 0) to (1, 0, 0), it teleports to (2, 0, 0).
This only happens above v2.2.4. Thanks.
Now I got exactly what's the problem.
if (args[0].equalsIgnoreCase("hologram")) {
final Player player = (Player) sender;
final Hologram hologram = HologramsAPI.createHologram(this, player.getLocation().add(0.0, 2.0, 0.0));
hologram.appendTextLine("Hologram Test");
hologram.getVisibilityManager().hideTo(player);
new BukkitRunnable() {
int ticksRun;
public void run() {
ticksRun++;
hologram.teleport(player.getLocation().add(0.0, 2.0, 0.0));
if (ticksRun > 50 && !hologram.getVisibilityManager().isVisibleTo(player)) {
hologram.getVisibilityManager().showTo(player);
}
if (ticksRun > 100) {
hologram.delete();
cancel();
}
}
}.runTaskTimer(this, 1L, 1L);
return true;
}
This code means when I run the command, it creates a new Hologram, hide to myself (only visible to other players), then 50 ticks later show to myself, 50 more ticks later the hologram disappears.
In v2.2.3:
https://youtu.be/fPdFdfU3EZ4
In v2.2.4:
https://youtu.be/qM42IyjRXAI
As you can see, when hologram becomes visible to a player, if that player is moving, the hologram teleports to wrong location. This only happens on v2.2.4.
I'm using the latest Spigot (1.11.2) and ProtocolLib (4.2.0)
This issue makes a big problem on my plugin.
http://i.imgur.com/GpeIWFo.png
I want to let the hologram be above player's head, but it goes away because of this issue.
Thanks.
Thanks for providing all the details. My guess is because of client desync, and I removed the fix in this commit 1a6c99c (because it was working without showing/hiding the hologram)
I will work on it.
This fixes it: d8955fc (already tested).