diff --git a/common/src/main/java/me/filoghost/holographicdisplays/common/nms/NMSPacketList.java b/common/src/main/java/me/filoghost/holographicdisplays/common/nms/NMSPacketList.java index 293a5c2d..787fd372 100644 --- a/common/src/main/java/me/filoghost/holographicdisplays/common/nms/NMSPacketList.java +++ b/common/src/main/java/me/filoghost/holographicdisplays/common/nms/NMSPacketList.java @@ -10,25 +10,25 @@ import org.bukkit.inventory.ItemStack; public interface NMSPacketList { - void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ); + void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ); - void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, String customName); + void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, String customName); - void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, IndividualCustomName individualCustomName); + void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, IndividualCustomName individualCustomName); void addArmorStandNameChangePackets(EntityID entityID, String customName); void addArmorStandNameChangePackets(EntityID entityID, IndividualCustomName individualCustomName); - void addItemSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, ItemStack itemStack); + void addItemSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, ItemStack itemStack); void addItemStackChangePackets(EntityID entityID, ItemStack itemStack); - void addSlimeSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ); + void addSlimeSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ); void addEntityDestroyPackets(EntityID... entityIDs); - void addTeleportPackets(EntityID entityID, double locationX, double locationY, double locationZ); + void addTeleportPackets(EntityID entityID, double positionX, double positionY, double positionZ); void addMountPackets(EntityID vehicleEntityID, EntityID passengerEntityID); diff --git a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityLivingSpawnNMSPacket.java b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityLivingSpawnNMSPacket.java index daf4dfdb..bdc7cca4 100644 --- a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityLivingSpawnNMSPacket.java +++ b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityLivingSpawnNMSPacket.java @@ -13,7 +13,7 @@ class EntityLivingSpawnNMSPacket extends VersionNMSPacket { private final Packet rawPacket; - EntityLivingSpawnNMSPacket(EntityID entityID, int entityTypeID, double locationX, double locationY, double locationZ) { + EntityLivingSpawnNMSPacket(EntityID entityID, int entityTypeID, double positionX, double positionY, double positionZ) { PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); packetByteBuffer.writeVarInt(entityID.getNumericID()); @@ -21,9 +21,9 @@ class EntityLivingSpawnNMSPacket extends VersionNMSPacket { packetByteBuffer.writeVarInt(entityTypeID); // Position - packetByteBuffer.writeDouble(locationX); - packetByteBuffer.writeDouble(locationY); - packetByteBuffer.writeDouble(locationZ); + packetByteBuffer.writeDouble(positionX); + packetByteBuffer.writeDouble(positionY); + packetByteBuffer.writeDouble(positionZ); // Rotation packetByteBuffer.writeByte(0); diff --git a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntitySpawnNMSPacket.java b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntitySpawnNMSPacket.java index 49d2d706..95e4c5bd 100644 --- a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntitySpawnNMSPacket.java +++ b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntitySpawnNMSPacket.java @@ -13,7 +13,7 @@ class EntitySpawnNMSPacket extends VersionNMSPacket { private final Packet rawPacket; - EntitySpawnNMSPacket(EntityID entityID, int entityTypeID, double locationX, double locationY, double locationZ) { + EntitySpawnNMSPacket(EntityID entityID, int entityTypeID, double positionX, double positionY, double positionZ) { PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); packetByteBuffer.writeVarInt(entityID.getNumericID()); @@ -21,9 +21,9 @@ class EntitySpawnNMSPacket extends VersionNMSPacket { packetByteBuffer.writeVarInt(entityTypeID); // Position - packetByteBuffer.writeDouble(locationX); - packetByteBuffer.writeDouble(locationY); - packetByteBuffer.writeDouble(locationZ); + packetByteBuffer.writeDouble(positionX); + packetByteBuffer.writeDouble(positionY); + packetByteBuffer.writeDouble(positionZ); // Rotation packetByteBuffer.writeByte(0); diff --git a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityTeleportNMSPacket.java b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityTeleportNMSPacket.java index ecf84a1f..57b1e733 100644 --- a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityTeleportNMSPacket.java +++ b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/EntityTeleportNMSPacket.java @@ -13,15 +13,15 @@ class EntityTeleportNMSPacket extends VersionNMSPacket { private final Packet rawPacket; - EntityTeleportNMSPacket(EntityID entityID, double locationX, double locationY, double locationZ) { + EntityTeleportNMSPacket(EntityID entityID, double positionX, double positionY, double positionZ) { PacketByteBuffer packetByteBuffer = PacketByteBuffer.get(); packetByteBuffer.writeVarInt(entityID.getNumericID()); - // Location - packetByteBuffer.writeDouble(locationX); - packetByteBuffer.writeDouble(locationY); - packetByteBuffer.writeDouble(locationZ); + // Position + packetByteBuffer.writeDouble(positionX); + packetByteBuffer.writeDouble(positionY); + packetByteBuffer.writeDouble(positionZ); // Rotation packetByteBuffer.writeByte(0); diff --git a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/VersionNMSPacketList.java b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/VersionNMSPacketList.java index 5b9e3f28..f6d064cc 100644 --- a/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/VersionNMSPacketList.java +++ b/nms/v1_17_r1/src/main/java/me/filoghost/holographicdisplays/nms/v1_17_R1/VersionNMSPacketList.java @@ -21,8 +21,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { private static final boolean USE_ENTITY_LIST_DESTROY_PACKET = useEntityListDestroyPacket(); @Override - public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ) { - add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ)); + public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ) { + add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); add(EntityMetadataNMSPacket.builder(entityID) .setArmorStandMarker() .build() @@ -30,8 +30,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { } @Override - public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, String customName) { - add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ)); + public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, String customName) { + add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); add(EntityMetadataNMSPacket.builder(entityID) .setArmorStandMarker() .setCustomName(customName) @@ -40,8 +40,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { } @Override - public void addArmorStandSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, IndividualCustomName individualCustomName) { - add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, locationX, locationY, locationZ)); + public void addArmorStandSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, IndividualCustomName individualCustomName) { + add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.ARMOR_STAND, positionX, positionY, positionZ)); add(new IndividualNMSPacket(player -> EntityMetadataNMSPacket.builder(entityID) .setArmorStandMarker() .setCustomName(individualCustomName.get(player)) @@ -66,8 +66,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { } @Override - public void addItemSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ, ItemStack itemStack) { - add(new EntitySpawnNMSPacket(entityID, EntityTypeID.ITEM, locationX, locationY, locationZ)); + public void addItemSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ, ItemStack itemStack) { + add(new EntitySpawnNMSPacket(entityID, EntityTypeID.ITEM, positionX, positionY, positionZ)); add(EntityMetadataNMSPacket.builder(entityID) .setItemStack(itemStack) .build() @@ -83,8 +83,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { } @Override - public void addSlimeSpawnPackets(EntityID entityID, double locationX, double locationY, double locationZ) { - add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.SLIME, locationX, locationY, locationZ)); + public void addSlimeSpawnPackets(EntityID entityID, double positionX, double positionY, double positionZ) { + add(new EntityLivingSpawnNMSPacket(entityID, EntityTypeID.SLIME, positionX, positionY, positionZ)); add(EntityMetadataNMSPacket.builder(entityID) .setInvisible() .setSlimeSmall() // Required for a correct client-side collision box @@ -104,8 +104,8 @@ class VersionNMSPacketList extends AbstractNMSPacketList { } @Override - public void addTeleportPackets(EntityID entityID, double locationX, double locationY, double locationZ) { - add(new EntityTeleportNMSPacket(entityID, locationX, locationY, locationZ)); + public void addTeleportPackets(EntityID entityID, double positionX, double positionY, double positionZ) { + add(new EntityTeleportNMSPacket(entityID, positionX, positionY, positionZ)); } @Override diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java index f7c52d82..6bd4d565 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/AlignCommand.java @@ -54,7 +54,7 @@ public class AlignCommand extends HologramSubCommand { } hologram.setPosition(newPosition); - hologramEditor.saveChanges(hologram, ChangeType.EDIT_LOCATION); + hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION); sender.sendMessage(ColorScheme.PRIMARY + "Hologram \"" + hologram.getName() + "\"" + " aligned to the hologram \"" + referenceHologram.getName() + "\"" diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MovehereCommand.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MovehereCommand.java index b9ab9445..72fc6bdc 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MovehereCommand.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/commands/subs/MovehereCommand.java @@ -35,7 +35,7 @@ public class MovehereCommand extends HologramSubCommand { InternalHologram hologram = hologramEditor.getHologram(args[0]); hologram.setPosition(player.getLocation()); - hologramEditor.saveChanges(hologram, ChangeType.EDIT_LOCATION); + hologramEditor.saveChanges(hologram, ChangeType.EDIT_POSITION); hologramEditor.teleportLookingDown(player, player.getLocation()); player.sendMessage(ColorScheme.PRIMARY + "You moved the hologram '" + hologram.getName() + "' near to you."); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/event/InternalHologramChangeEvent.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/event/InternalHologramChangeEvent.java index 87b47e4b..45eac379 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/event/InternalHologramChangeEvent.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/event/InternalHologramChangeEvent.java @@ -43,7 +43,7 @@ public class InternalHologramChangeEvent extends Event { CREATE, EDIT_LINES, - EDIT_LOCATION, + EDIT_POSITION, DELETE } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java index afa1a126..cc6bee19 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologram.java @@ -59,21 +59,21 @@ public abstract class BaseHologram extends BaseH checkNotDeleted(); lines.add(line); - updateLineLocations(); + updateLinePositions(); } public void addLines(List newLines) { checkNotDeleted(); lines.addAll(newLines); - updateLineLocations(); + updateLinePositions(); } public void insertLine(int afterIndex, T line) { checkNotDeleted(); lines.add(afterIndex, line); - updateLineLocations(); + updateLinePositions(); } public void setLine(int index, T line) { @@ -81,7 +81,7 @@ public abstract class BaseHologram extends BaseH T previousLine = lines.set(index, line); previousLine.setDeleted(); - updateLineLocations(); + updateLinePositions(); } public void setLines(List newLines) { @@ -89,14 +89,14 @@ public abstract class BaseHologram extends BaseH clearLines(); lines.addAll(newLines); - updateLineLocations(); + updateLinePositions(); } public void removeLine(int index) { checkNotDeleted(); lines.remove(index).setDeleted(); - updateLineLocations(); + updateLinePositions(); } public void removeLine(T line) { @@ -104,7 +104,7 @@ public abstract class BaseHologram extends BaseH lines.remove(line); line.setDeleted(); - updateLineLocations(); + updateLinePositions(); } public void clearLines() { @@ -190,7 +190,7 @@ public abstract class BaseHologram extends BaseH this.isInLoadedChunk.invalidate(); } - updateLineLocations(); + updateLinePositions(); } private int getChunkCoordinate(double positionCoordinate) { @@ -201,7 +201,7 @@ public abstract class BaseHologram extends BaseH * When spawning at a location, the top part of the first line should be exactly on that location. * The second line is below the first, and so on. */ - private void updateLineLocations() { + private void updateLinePositions() { double currentLineY = y; for (int i = 0; i < lines.size(); i++) { @@ -212,7 +212,7 @@ public abstract class BaseHologram extends BaseH currentLineY -= Settings.spaceBetweenLines; } - line.setLocation(x, currentLineY, z); + line.setPosition(x, currentLineY, z); } } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java index a592549f..75522428 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/BaseHologramLine.java @@ -38,7 +38,7 @@ public abstract class BaseHologramLine extends BaseHologramComponent implements } @Override - public final void setLocation(double x, double y, double z) { + public final void setPosition(double x, double y, double z) { this.x = x; this.y = y; this.z = z; diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java index fd3f2ba6..a23bdcc9 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/base/EditableHologramLine.java @@ -7,7 +7,7 @@ package me.filoghost.holographicdisplays.plugin.hologram.base; public interface EditableHologramLine { - void setLocation(double x, double y, double z); + void setPosition(double x, double y, double z); double getHeight(); diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ClickableLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ClickableLineTracker.java index 5fe95bb1..1278b622 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ClickableLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ClickableLineTracker.java @@ -12,7 +12,7 @@ import me.filoghost.holographicdisplays.plugin.hologram.base.BaseClickableLine; import me.filoghost.holographicdisplays.plugin.listener.LineClickListener; import org.jetbrains.annotations.MustBeInvokedByOverriders; -public abstract class ClickableLineTracker extends LocationBasedLineTracker { +public abstract class ClickableLineTracker extends PositionBasedLineTracker { private static final double SLIME_HEIGHT = 0.5; @@ -93,15 +93,15 @@ public abstract class ClickableLineTracker extends @MustBeInvokedByOverriders @Override - protected void addLocationChangePackets(NMSPacketList packetList) { + protected void addPositionChangePackets(NMSPacketList packetList) { if (spawnSlimeEntities) { - packetList.addTeleportPackets(vehicleEntityID, locationX, getSlimeLocationY(), locationZ); + packetList.addTeleportPackets(vehicleEntityID, positionX, getSlimePositionY(), positionZ); } } private void addSlimeSpawnPackets(NMSPacketList packetList) { - packetList.addArmorStandSpawnPackets(vehicleEntityID, locationX, getSlimeLocationY(), locationZ); - packetList.addSlimeSpawnPackets(slimeEntityID, locationX, getSlimeLocationY(), locationZ); + packetList.addArmorStandSpawnPackets(vehicleEntityID, positionX, getSlimePositionY(), positionZ); + packetList.addSlimeSpawnPackets(slimeEntityID, positionX, getSlimePositionY(), positionZ); packetList.addMountPackets(vehicleEntityID, slimeEntityID); } @@ -109,8 +109,8 @@ public abstract class ClickableLineTracker extends packetList.addEntityDestroyPackets(slimeEntityID, vehicleEntityID); } - private double getSlimeLocationY() { - return locationY + ((line.getHeight() - SLIME_HEIGHT) / 2); + private double getSlimePositionY() { + return positionY + ((line.getHeight() - SLIME_HEIGHT) / 2); } } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java index 223a723b..7e6db835 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/ItemLineTracker.java @@ -41,7 +41,7 @@ public class ItemLineTracker extends ClickableLineTracker { if (spawnItemEntities && hasTrackedPlayers()) { for (Player trackedPlayer : getTrackedPlayers()) { - if (CollisionHelper.isInPickupRange(trackedPlayer, locationX, locationY, locationZ)) { + if (CollisionHelper.isInPickupRange(trackedPlayer, positionX, positionY, positionZ)) { line.onPickup(trackedPlayer); } } @@ -118,17 +118,17 @@ public class ItemLineTracker extends ClickableLineTracker { @MustBeInvokedByOverriders @Override - protected void addLocationChangePackets(NMSPacketList packetList) { - super.addLocationChangePackets(packetList); + protected void addPositionChangePackets(NMSPacketList packetList) { + super.addPositionChangePackets(packetList); if (spawnItemEntities) { - packetList.addTeleportPackets(vehicleEntityID, locationX, getItemLocationY(), locationZ); + packetList.addTeleportPackets(vehicleEntityID, positionX, getItemPositionY(), positionZ); } } private void addItemSpawnPackets(NMSPacketList packetList) { - packetList.addArmorStandSpawnPackets(vehicleEntityID, locationX, getItemLocationY(), locationZ); - packetList.addItemSpawnPackets(itemEntityID, locationX, getItemLocationY(), locationZ, itemStack); + packetList.addArmorStandSpawnPackets(vehicleEntityID, positionX, getItemPositionY(), positionZ); + packetList.addItemSpawnPackets(itemEntityID, positionX, getItemPositionY(), positionZ, itemStack); packetList.addMountPackets(vehicleEntityID, itemEntityID); } @@ -136,8 +136,8 @@ public class ItemLineTracker extends ClickableLineTracker { packetList.addEntityDestroyPackets(itemEntityID, vehicleEntityID); } - private double getItemLocationY() { - return locationY; + private double getItemPositionY() { + return positionY; } } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/PositionBasedLineTracker.java similarity index 58% rename from plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java rename to plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/PositionBasedLineTracker.java index 21767312..2ca901a6 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/LocationBasedLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/PositionBasedLineTracker.java @@ -12,37 +12,37 @@ import org.bukkit.Location; import org.bukkit.entity.Player; import org.jetbrains.annotations.MustBeInvokedByOverriders; -abstract class LocationBasedLineTracker extends LineTracker { +abstract class PositionBasedLineTracker extends LineTracker { private static final int ENTITY_VIEW_RANGE = 64; - protected double locationX; - protected double locationY; - protected double locationZ; - private boolean locationChanged; + protected double positionX; + protected double positionY; + protected double positionZ; + private boolean positionChanged; - LocationBasedLineTracker(T line, NMSManager nmsManager) { + PositionBasedLineTracker(T line, NMSManager nmsManager) { super(line, nmsManager); } @MustBeInvokedByOverriders @Override protected void detectChanges() { - double locationX = line.getX(); - double locationY = line.getY(); - double locationZ = line.getZ(); - if (this.locationX != locationX || this.locationY != locationY || this.locationZ != locationZ) { - this.locationX = locationX; - this.locationY = locationY; - this.locationZ = locationZ; - this.locationChanged = true; + double positionX = line.getX(); + double positionY = line.getY(); + double positionZ = line.getZ(); + if (this.positionX != positionX || this.positionY != positionY || this.positionZ != positionZ) { + this.positionX = positionX; + this.positionY = positionY; + this.positionZ = positionZ; + this.positionChanged = true; } } @MustBeInvokedByOverriders @Override protected void clearDetectedChanges() { - this.locationChanged = false; + this.positionChanged = false; } @Override @@ -52,8 +52,8 @@ abstract class LocationBasedLineTracker extends Line return false; } - double diffX = Math.abs(playerLocation.getX() - locationX); - double diffZ = Math.abs(playerLocation.getZ() - locationZ); + double diffX = Math.abs(playerLocation.getX() - positionX); + double diffZ = Math.abs(playerLocation.getZ() - positionZ); return diffX <= (double) ENTITY_VIEW_RANGE && diffZ <= (double) ENTITY_VIEW_RANGE @@ -63,11 +63,11 @@ abstract class LocationBasedLineTracker extends Line @MustBeInvokedByOverriders @Override protected void addChangesPackets(NMSPacketList packetList) { - if (locationChanged) { - addLocationChangePackets(packetList); + if (positionChanged) { + addPositionChangePackets(packetList); } } - protected abstract void addLocationChangePackets(NMSPacketList packetList); + protected abstract void addPositionChangePackets(NMSPacketList packetList); } diff --git a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java index 3759a75e..0a59dd80 100644 --- a/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java +++ b/plugin/src/main/java/me/filoghost/holographicdisplays/plugin/hologram/tracking/TextLineTracker.java @@ -77,11 +77,11 @@ public class TextLineTracker extends ClickableLineTracker { super.addSpawnPackets(packetList); if (!allowPlaceholders) { - packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText.getWithoutReplacements()); + packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText.getWithoutReplacements()); } else if (displayText.containsIndividualPlaceholders()) { - packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText::getWithIndividualReplacements); + packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText::getWithIndividualReplacements); } else { - packetList.addArmorStandSpawnPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ, displayText.getWithGlobalReplacements()); + packetList.addArmorStandSpawnPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ, displayText.getWithGlobalReplacements()); } } @@ -109,13 +109,13 @@ public class TextLineTracker extends ClickableLineTracker { @MustBeInvokedByOverriders @Override - protected void addLocationChangePackets(NMSPacketList packetList) { - super.addLocationChangePackets(packetList); - packetList.addTeleportPackets(armorStandEntityID, locationX, getArmorStandLocationY(), locationZ); + protected void addPositionChangePackets(NMSPacketList packetList) { + super.addPositionChangePackets(packetList); + packetList.addTeleportPackets(armorStandEntityID, positionX, getArmorStandPositionY(), positionZ); } - private double getArmorStandLocationY() { - return locationY - 0.29; + private double getArmorStandPositionY() { + return positionY - 0.29; } }