mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-20 07:47:38 +01:00
Fix {player} and {displayname} not being relative to the player viewing
them.
This commit is contained in:
parent
3b49b121fb
commit
d521465385
@ -176,7 +176,12 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
|
|||||||
|
|
||||||
String customName = (String) customNameObject;
|
String customName = (String) customNameObject;
|
||||||
if (customName.contains("{player}") || customName.contains("{displayname}")) {
|
if (customName.contains("{player}") || customName.contains("{displayname}")) {
|
||||||
watchableObject.setValue(customName.replace("{player}", player.getName()).replace("{displayname}", player.getDisplayName()));
|
|
||||||
|
String replacement = customName.replace("{player}", player.getName()).replace("{displayname}", player.getDisplayName());
|
||||||
|
dataWatcherValues.set(i, new WrappedWatchableObject(watchableObject.getWatcherObject(), replacement));
|
||||||
|
PacketContainer clone = packet.shallowClone();
|
||||||
|
clone.getWatchableCollectionModifier().write(0, dataWatcherValues);
|
||||||
|
event.setPacket(clone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
|
|||||||
|
|
||||||
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.SPAWN_ENTITY_LIVING, PacketType.Play.Server.SPAWN_ENTITY, PacketType.Play.Server.ENTITY_METADATA) {
|
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.SPAWN_ENTITY_LIVING, PacketType.Play.Server.SPAWN_ENTITY, PacketType.Play.Server.ENTITY_METADATA) {
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user