fixed placeholder not working in name property

This commit is contained in:
D3v1s0m 2023-08-31 09:23:50 +05:30
parent 86e021f277
commit dd029786dd
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1

@ -5,6 +5,7 @@ import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import lol.pyr.znpcsplus.entity.EntityPropertyImpl;
import lol.pyr.znpcsplus.entity.PacketEntity;
import lol.pyr.znpcsplus.util.PapiUtil;
import net.kyori.adventure.text.Component;
import org.bukkit.entity.Player;
@ -29,6 +30,7 @@ public class NameProperty extends EntityPropertyImpl<Component> {
String serialized = legacy ?
AdventureSerializer.getLegacyGsonSerializer().serialize(value) :
AdventureSerializer.getGsonSerializer().serialize(value);
serialized = PapiUtil.set(player, serialized);
if (optional) properties.put(2, newEntityData(2, EntityDataTypes.OPTIONAL_COMPONENT, Optional.of(serialized)));
else properties.put(2, newEntityData(2, EntityDataTypes.STRING, serialized));
}