From e013b4ddebfa5f562ba4db629bb53d9219b427e8 Mon Sep 17 00:00:00 2001 From: NEZNAMY Date: Sun, 9 Aug 2020 18:51:19 +0200 Subject: [PATCH] fixed #56 --- .../features/unlimitedtags/ArmorStand.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/neznamy/tab/platforms/bukkit/features/unlimitedtags/ArmorStand.java b/src/main/java/me/neznamy/tab/platforms/bukkit/features/unlimitedtags/ArmorStand.java index e1f4554e3..6f5f24731 100644 --- a/src/main/java/me/neznamy/tab/platforms/bukkit/features/unlimitedtags/ArmorStand.java +++ b/src/main/java/me/neznamy/tab/platforms/bukkit/features/unlimitedtags/ArmorStand.java @@ -75,7 +75,7 @@ public class ArmorStand{ if (ProtocolVersion.SERVER_VERSION.getMinorVersion() >= 15) { return new PacketPlayOut[] { new PacketPlayOutSpawnEntityLiving(entityId, uuid, EntityType.ARMOR_STAND, getArmorStandLocationFor(viewer)), - new PacketPlayOutEntityMetadata(getEntityId(), dataWatcher) + new PacketPlayOutEntityMetadata(entityId, dataWatcher) }; } else { return new PacketPlayOut[] { @@ -152,7 +152,7 @@ public class ArmorStand{ } public Location getLocation() { double x = player.getLocation().getX(); - double y = player.getLocation().getY() + yOffset + 2; + double y = getY() + yOffset + 2; double z = player.getLocation().getZ(); if (player.isSleeping()) { y -= 1.76; @@ -165,6 +165,24 @@ public class ArmorStand{ } return new Location(null,x,y,z); } + private double getY() { + //1.14+ bukkit api bug + if (player.getVehicle() != null) { + if (player.getVehicle().getType() == EntityType.HORSE) { + return player.getVehicle().getLocation().getY() + 0.85; + } + if (player.getVehicle().getType() == EntityType.DONKEY) { + return player.getVehicle().getLocation().getY() + 0.525; + } + if (player.getVehicle().getType() == EntityType.PIG) { + return player.getVehicle().getLocation().getY() + 0.325; + } + if (player.getVehicle().getType().toString().equals("STRIDER")) { //preventing errors on <1.16 + return player.getVehicle().getLocation().getY() + 1.15; + } + } + return player.getLocation().getY(); + } public int getEntityId() { return entityId; }