Improved auto-show handling and fix for #59
This commit is contained in:
@@ -108,9 +108,23 @@ public class Hologram {
|
|||||||
worldClass = worldClass.getSuperclass();
|
worldClass = worldClass.getSuperclass();
|
||||||
}
|
}
|
||||||
|
|
||||||
Reflection.ConstructorInvoker entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
// Reflection.ConstructorInvoker entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
||||||
|
// Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass, double.class, double.class, double.class) :
|
||||||
|
// Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass));
|
||||||
|
// Replacement for issue #59
|
||||||
|
Reflection.ConstructorInvoker entityArmorStandConstructor = null;
|
||||||
|
try {
|
||||||
|
entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
||||||
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass, double.class, double.class, double.class) :
|
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass, double.class, double.class, double.class) :
|
||||||
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass));
|
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass));
|
||||||
|
} catch (IllegalStateException exception) {
|
||||||
|
worldClass = worldClass.getSuperclass();
|
||||||
|
|
||||||
|
entityArmorStandConstructor = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
||||||
|
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass, double.class, double.class, double.class) :
|
||||||
|
Reflection.getConstructor(ENTITY_ARMOR_STAND_CLASS, worldClass));
|
||||||
|
}
|
||||||
|
// end #59
|
||||||
|
|
||||||
for (String line : text) {
|
for (String line : text) {
|
||||||
Object entityArmorStand = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
Object entityArmorStand = (version.isAboveOrEqual(MinecraftVersion.V1_14_R1) ?
|
||||||
|
|||||||
@@ -62,7 +62,10 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
if (to == null || (from.getBlockX() != to.getBlockX()
|
// 11/4/20: Added pitch and yaw to the if statement. If the change in this is 10 or more degrees, check the movement.
|
||||||
|
if (to == null || (Math.abs(from.getPitch() - to.getPitch()) <= 10
|
||||||
|
|| Math.abs(from.getYaw() - to.getYaw()) <= 10
|
||||||
|
|| from.getBlockX() != to.getBlockX()
|
||||||
|| from.getBlockY() != to.getBlockY()
|
|| from.getBlockY() != to.getBlockY()
|
||||||
|| from.getBlockZ() != to.getBlockZ()))
|
|| from.getBlockZ() != to.getBlockZ()))
|
||||||
handleMove(event.getPlayer()); // Verify the player changed which block they are on. Since PlayerMoveEvent is one of the most called events, this is worth it.
|
handleMove(event.getPlayer()); // Verify the player changed which block they are on. Since PlayerMoveEvent is one of the most called events, this is worth it.
|
||||||
|
|||||||
Reference in New Issue
Block a user