This commit is contained in:
filoghost 2019-06-03 10:45:33 +02:00
parent ba6d18306e
commit fa1f8d260e
3 changed files with 21 additions and 21 deletions

View File

@ -309,7 +309,7 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
CraftTextLine textLine = (CraftTextLine) line; CraftTextLine textLine = (CraftTextLine) line;
if (textLine.isSpawned()) { if (textLine.isSpawned()) {
sendSpawnArmorStandPacket(player, (NMSArmorStand) textLine.getNmsNameble()); sendSpawnArmorStandPacket(player, (NMSArmorStand) textLine.getNmsNameable());
} }
} else if (line instanceof CraftItemLine) { } else if (line instanceof CraftItemLine) {

View File

@ -35,7 +35,7 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
private String text; private String text;
private List<RelativePlaceholder> relativePlaceholders; private List<RelativePlaceholder> relativePlaceholders;
private NMSNameable nmsNameble; private NMSNameable nmsNameable;
public CraftTextLine(CraftHologram parent, String text) { public CraftTextLine(CraftHologram parent, String text) {
@ -53,14 +53,14 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
if (nmsNameble != null) { if (nmsNameable != null) {
if (text != null && !text.isEmpty()) { if (text != null && !text.isEmpty()) {
nmsNameble.setCustomNameNMS(text); nmsNameable.setCustomNameNMS(text);
if (getParent().isAllowPlaceholders()) { if (getParent().isAllowPlaceholders()) {
PlaceholdersManager.trackIfNecessary(this); PlaceholdersManager.trackIfNecessary(this);
} }
} else { } else {
nmsNameble.setCustomNameNMS(""); // It will not appear nmsNameable.setCustomNameNMS(""); // It will not appear
if (getParent().isAllowPlaceholders()) { if (getParent().isAllowPlaceholders()) {
PlaceholdersManager.untrack(this); PlaceholdersManager.untrack(this);
} }
@ -86,8 +86,8 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
@Override @Override
public void setTouchHandler(TouchHandler touchHandler) { public void setTouchHandler(TouchHandler touchHandler) {
if (nmsNameble != null) { if (nmsNameable != null) {
Location loc = nmsNameble.getBukkitEntityNMS().getLocation(); Location loc = nmsNameable.getBukkitEntityNMS().getLocation();
super.setTouchHandler(touchHandler, loc.getWorld(), loc.getX(), loc.getY() - getTextOffset(), loc.getZ()); super.setTouchHandler(touchHandler, loc.getWorld(), loc.getX(), loc.getY() - getTextOffset(), loc.getZ());
} else { } else {
super.setTouchHandler(touchHandler, null, 0, 0, 0); super.setTouchHandler(touchHandler, null, 0, 0, 0);
@ -98,13 +98,13 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
public void spawn(World world, double x, double y, double z) { public void spawn(World world, double x, double y, double z) {
super.spawn(world, x, y, z); super.spawn(world, x, y, z);
nmsNameble = HolographicDisplays.getNMSManager().spawnNMSArmorStand(world, x, y + getTextOffset(), z, this); nmsNameable = HolographicDisplays.getNMSManager().spawnNMSArmorStand(world, x, y + getTextOffset(), z, this);
if (text != null && !text.isEmpty()) { if (text != null && !text.isEmpty()) {
nmsNameble.setCustomNameNMS(text); nmsNameable.setCustomNameNMS(text);
} }
nmsNameble.setLockTick(true); nmsNameable.setLockTick(true);
} }
@ -112,9 +112,9 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
public void despawn() { public void despawn() {
super.despawn(); super.despawn();
if (nmsNameble != null) { if (nmsNameable != null) {
nmsNameble.killEntityNMS(); nmsNameable.killEntityNMS();
nmsNameble = null; nmsNameable = null;
} }
} }
@ -129,8 +129,8 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
public void teleport(double x, double y, double z) { public void teleport(double x, double y, double z) {
super.teleport(x, y, z); super.teleport(x, y, z);
if (nmsNameble != null) { if (nmsNameable != null) {
nmsNameble.setLocationNMS(x, y + getTextOffset(), z); nmsNameable.setLocationNMS(x, y + getTextOffset(), z);
} }
} }
@ -138,17 +138,17 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
public int[] getEntitiesIDs() { public int[] getEntitiesIDs() {
if (isSpawned()) { if (isSpawned()) {
if (touchSlime != null) { if (touchSlime != null) {
return ArrayUtils.add(touchSlime.getEntitiesIDs(), nmsNameble.getIdNMS()); return ArrayUtils.add(touchSlime.getEntitiesIDs(), nmsNameable.getIdNMS());
} else { } else {
return new int[] {nmsNameble.getIdNMS()}; return new int[] {nmsNameable.getIdNMS()};
} }
} else { } else {
return new int[0]; return new int[0];
} }
} }
public NMSNameable getNmsNameble() { public NMSNameable getNmsNameable() {
return nmsNameble; return nmsNameable;
} }
private double getTextOffset() { private double getTextOffset() {

View File

@ -109,7 +109,7 @@ public class PlaceholdersManager {
Iterator<DynamicLineData> iter = linesToUpdate.iterator(); Iterator<DynamicLineData> iter = linesToUpdate.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
DynamicLineData data = iter.next(); DynamicLineData data = iter.next();
if (data.getEntity() == line.getNmsNameble()) { if (data.getEntity() == line.getNmsNameable()) {
iter.remove(); iter.remove();
data.getEntity().setCustomNameNMS(data.getOriginalName()); data.getEntity().setCustomNameNMS(data.getOriginalName());
} }
@ -117,7 +117,7 @@ public class PlaceholdersManager {
} }
public static void trackIfNecessary(CraftTextLine line) { public static void trackIfNecessary(CraftTextLine line) {
NMSNameable nameableEntity = line.getNmsNameble(); NMSNameable nameableEntity = line.getNmsNameable();
if (nameableEntity == null) { if (nameableEntity == null) {
return; return;
} }