mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-28 05:15:11 +01:00
Track placeholders when using setText()
This commit is contained in:
parent
cf2db447b8
commit
5064c989ed
@ -10,6 +10,7 @@ import com.gmail.filoghost.holographicdisplays.api.line.TextLine;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSNameable;
|
||||
import com.gmail.filoghost.holographicdisplays.nms.interfaces.entity.NMSRideable;
|
||||
import com.gmail.filoghost.holographicdisplays.object.CraftHologram;
|
||||
import com.gmail.filoghost.holographicdisplays.placeholder.PlaceholdersManager;
|
||||
import com.gmail.filoghost.holographicdisplays.util.Offsets;
|
||||
|
||||
public class CraftTextLine extends CraftTouchableLine implements TextLine {
|
||||
@ -37,8 +38,16 @@ public class CraftTextLine extends CraftTouchableLine implements TextLine {
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
|
||||
if (nmsNameble != null && text != null && !text.isEmpty()) {
|
||||
if (nmsNameble != null) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
nmsNameble.setCustomNameNMS(text);
|
||||
} else {
|
||||
nmsNameble.setCustomNameNMS(null);
|
||||
}
|
||||
|
||||
if (getParent().isAllowPlaceholders()) {
|
||||
PlaceholdersManager.trackIfNecessary(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,10 +212,13 @@ public class PlaceholdersManager {
|
||||
}
|
||||
|
||||
// It could be already tracked!
|
||||
if (linesToUpdate.add(lineData)) {
|
||||
updatePlaceholders(lineData);
|
||||
if (!linesToUpdate.add(lineData)) {
|
||||
linesToUpdate.remove(lineData);
|
||||
linesToUpdate.add(lineData);
|
||||
}
|
||||
|
||||
updatePlaceholders(lineData);
|
||||
|
||||
} else {
|
||||
|
||||
// The name needs to be updated anyways.
|
||||
|
Loading…
Reference in New Issue
Block a user