%blank% for empty hologram line
This commit is contained in:
parent
b1cea2a860
commit
91e737bc22
1 changed files with 10 additions and 0 deletions
|
@ -6,15 +6,25 @@ import lol.pyr.znpcsplus.entity.EntityPropertyRegistryImpl;
|
||||||
import lol.pyr.znpcsplus.packets.PacketFactory;
|
import lol.pyr.znpcsplus.packets.PacketFactory;
|
||||||
import lol.pyr.znpcsplus.util.NpcLocation;
|
import lol.pyr.znpcsplus.util.NpcLocation;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class HologramText extends HologramLine<Component> {
|
public class HologramText extends HologramLine<Component> {
|
||||||
|
|
||||||
|
private static final Component BLANK = Component.text("%blank%");
|
||||||
|
|
||||||
public HologramText(EntityPropertyRegistryImpl propertyRegistry, PacketFactory packetFactory, NpcLocation location, Component text) {
|
public HologramText(EntityPropertyRegistryImpl propertyRegistry, PacketFactory packetFactory, NpcLocation location, Component text) {
|
||||||
super(text, packetFactory, EntityTypes.ARMOR_STAND, location);
|
super(text, packetFactory, EntityTypes.ARMOR_STAND, location);
|
||||||
addProperty(propertyRegistry.getByName("name"));
|
addProperty(propertyRegistry.getByName("name"));
|
||||||
addProperty(propertyRegistry.getByName("invisible"));
|
addProperty(propertyRegistry.getByName("invisible"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(Player player) {
|
||||||
|
if (!getValue().equals(BLANK)) {
|
||||||
|
super.show(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public <T> T getProperty(EntityProperty<T> key) {
|
public <T> T getProperty(EntityProperty<T> key) {
|
||||||
|
|
Loading…
Reference in a new issue