mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-23 19:05:12 +01:00
Add option for precise hologram teleport
When moving holograms quickly (for example, a chat message over a player's head) lines may not be aligned correctly after moving for a while. Precise hologram teleporting prevents this issue. Some people won't need it, and disabling it may slightly improve the performance (depending on the number of holograms).
This commit is contained in:
parent
ff5ca5dddb
commit
8134005ac6
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||
public enum ConfigNode {
|
||||
|
||||
SPACE_BETWEEN_LINES("space-between-lines", 0.02),
|
||||
PRECISE_HOLOGRAM_MOVEMENT("precise-hologram-movement", true),
|
||||
IMAGES_SYMBOL("images.symbol", "[x]"),
|
||||
TRANSPARENCY_SPACE("images.transparency.space", " [|] "),
|
||||
TRANSPARENCY_COLOR("images.transparency.color", "&7"),
|
||||
|
@ -24,6 +24,7 @@ import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
public class Configuration {
|
||||
|
||||
public static double spaceBetweenLines;
|
||||
public static boolean preciseHologramMovement;
|
||||
public static String imageSymbol;
|
||||
public static String transparencySymbol;
|
||||
public static boolean updateNotification;
|
||||
@ -41,9 +42,7 @@ public class Configuration {
|
||||
public static String pingerStatusOffline;
|
||||
public static boolean pingerTrimMotd;
|
||||
public static Map<String, ServerAddress> pingerServers;
|
||||
|
||||
//public static boolean debug; update DebugHandler instead
|
||||
|
||||
|
||||
|
||||
public static void load(Plugin plugin) {
|
||||
File configFile = new File(plugin.getDataFolder(), "config.yml");
|
||||
@ -115,6 +114,8 @@ public class Configuration {
|
||||
}
|
||||
|
||||
spaceBetweenLines = config.getDouble(ConfigNode.SPACE_BETWEEN_LINES.getPath());
|
||||
preciseHologramMovement = config.getBoolean(ConfigNode.PRECISE_HOLOGRAM_MOVEMENT.getPath());
|
||||
|
||||
updateNotification = config.getBoolean(ConfigNode.UPDATE_NOTIFICATION.getPath());
|
||||
|
||||
imageSymbol = StringConverter.toReadableFormat(config.getString(ConfigNode.IMAGES_SYMBOL.getPath()));
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_10_R1;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -127,10 +128,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -189,16 +192,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_11_R1;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -136,10 +137,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -198,16 +201,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_12_R1;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -136,10 +137,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -198,16 +201,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.craftbukkit.v1_13_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.util.CraftChatMessage;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -138,10 +139,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -200,16 +203,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,12 @@
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.util.CraftChatMessage;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -138,10 +139,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && 158 < element.getLineNumber() && element.getLineNumber() < 168) {
|
||||
// Then this method is being called when creating a new movement packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -200,16 +203,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_8_R1;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
|
||||
@ -116,10 +117,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -179,24 +182,26 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_8_R2;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
@ -124,10 +125,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -187,24 +190,26 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_8_R3;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.ConsoleLogger;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
@ -124,10 +125,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 137 && element.getLineNumber() < 147) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -187,24 +190,26 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(
|
||||
getIdNMS(),
|
||||
MathHelper.floor(this.locX * 32.0D),
|
||||
MathHelper.floor(this.locY * 32.0D),
|
||||
MathHelper.floor(this.locZ * 32.0D),
|
||||
(byte) (int) (this.yaw * 256.0F / 360.0F),
|
||||
(byte) (int) (this.pitch * 256.0F / 360.0F),
|
||||
this.onGround
|
||||
);
|
||||
|
||||
for (Object obj : this.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - this.locX) + Utils.square(nmsPlayer.locZ - this.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_9_R1;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectField;
|
||||
@ -134,10 +135,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 142 && element.getLineNumber() < 152) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 142 && element.getLineNumber() < 152) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -196,16 +199,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@
|
||||
<artifactId>holographicdisplays-utils</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>holographicdisplays-config</artifactId>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -3,6 +3,7 @@ package com.gmail.filoghost.holographicdisplays.nms.v1_9_R2;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
|
||||
|
||||
import com.gmail.filoghost.holographicdisplays.api.line.HologramLine;
|
||||
import com.gmail.filoghost.holographicdisplays.disk.Configuration;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Utils;
|
||||
import com.gmail.filoghost.holographicdisplays.util.reflection.ReflectionUtils;
|
||||
@ -127,10 +128,12 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 142 && element.getLineNumber() < 152) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
StackTraceElement element = ReflectionUtils.getStackTraceElement(2);
|
||||
if (element != null && element.getFileName() != null && element.getFileName().equals("EntityTrackerEntry.java") && element.getLineNumber() > 142 && element.getLineNumber() < 152) {
|
||||
// Then this method is being called when creating a new packet, we return a fake ID!
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getId();
|
||||
@ -189,16 +192,18 @@ public class EntityNMSArmorStand extends EntityArmorStand implements NMSArmorSta
|
||||
public void setLocationNMS(double x, double y, double z) {
|
||||
super.setPosition(x, y, z);
|
||||
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
if (Configuration.preciseHologramMovement) {
|
||||
// Send a packet near to update the position.
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(this);
|
||||
|
||||
for (Object obj : super.world.players) {
|
||||
if (obj instanceof EntityPlayer) {
|
||||
EntityPlayer nmsPlayer = (EntityPlayer) obj;
|
||||
|
||||
double distanceSquared = Utils.square(nmsPlayer.locX - super.locX) + Utils.square(nmsPlayer.locZ - super.locZ);
|
||||
if (distanceSquared < 8192 && nmsPlayer.playerConnection != null) {
|
||||
nmsPlayer.playerConnection.sendPacket(teleportPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#. Plugin created by filoghost.
|
||||
#.
|
||||
space-between-lines: 0.02
|
||||
precise-hologram-movement: true
|
||||
images:
|
||||
symbol: '[x]'
|
||||
transparency:
|
||||
|
Loading…
Reference in New Issue
Block a user