fixed placeholder not working in name property
This commit is contained in:
parent
86e021f277
commit
dd029786dd
1 changed files with 2 additions and 0 deletions
|
@ -5,6 +5,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||||
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
|
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
|
||||||
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
|
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
|
||||||
import lol.pyr.znpcsplus.entity.PacketEntity;
|
import lol.pyr.znpcsplus.entity.PacketEntity;
|
||||||
|
import lol.pyr.znpcsplus.util.PapiUtil;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ public class NameProperty extends EntityPropertyImpl<Component> {
|
||||||
String serialized = legacy ?
|
String serialized = legacy ?
|
||||||
AdventureSerializer.getLegacyGsonSerializer().serialize(value) :
|
AdventureSerializer.getLegacyGsonSerializer().serialize(value) :
|
||||||
AdventureSerializer.getGsonSerializer().serialize(value);
|
AdventureSerializer.getGsonSerializer().serialize(value);
|
||||||
|
serialized = PapiUtil.set(player, serialized);
|
||||||
if (optional) properties.put(2, newEntityData(2, EntityDataTypes.OPTIONAL_COMPONENT, Optional.of(serialized)));
|
if (optional) properties.put(2, newEntityData(2, EntityDataTypes.OPTIONAL_COMPONENT, Optional.of(serialized)));
|
||||||
else properties.put(2, newEntityData(2, EntityDataTypes.STRING, serialized));
|
else properties.put(2, newEntityData(2, EntityDataTypes.STRING, serialized));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue