Enable scoreboard updates and comment out hover text

Uncommented the code in `updateScoreboard` and `addViewer` methods in `Leaderboard.java` to ensure scoreboard updates are sent to players. Commented out the components in `HoverText.java` related to setting text display names.
This commit is contained in:
Teriuihi 2024-10-20 21:43:46 +02:00
parent 316bbad36e
commit 5cbaf3f24c
2 changed files with 7 additions and 6 deletions

View File

@ -55,12 +55,13 @@ public class HoverText {
PacketContainer metaPacket = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
metaPacket.getIntegers().write(0, entityId);
WrappedDataWatcher watcher = new WrappedDataWatcher();
// watcher.setEntity();
WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(MinecraftReflection.getIChatBaseComponentClass());
WrappedDataWatcher.WrappedDataWatcherObject displayName = new WrappedDataWatcher.WrappedDataWatcherObject(2, serializer);
WrappedChatComponent component = WrappedChatComponent.fromText(text);
// WrappedDataWatcher.Serializer serializer = WrappedDataWatcher.Registry.get(MinecraftReflection.getIChatBaseComponentClass());
// WrappedDataWatcher.WrappedDataWatcherObject displayName = new WrappedDataWatcher.WrappedDataWatcherObject(2, serializer);
// WrappedChatComponent component = WrappedChatComponent.fromText(text);
watcher.setObject(displayName, Optional.of(component.getHandle()));
// watcher.setObject(displayName, Optional.of(component.getHandle()));
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(3, WrappedDataWatcher.Registry.get(Boolean.class)), true); // Custom Name Visible
watcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) 0x20); // Invisible

View File

@ -84,7 +84,7 @@ public class Leaderboard {
}
private void updateScoreboard(Player player) {
// metaPacket.values().forEach(metaPacket -> protocolManager.sendServerPacket(player, metaPacket));
metaPacket.values().forEach(metaPacket -> protocolManager.sendServerPacket(player, metaPacket));
}
public void addViewer(Player player) {
@ -93,7 +93,7 @@ public class Leaderboard {
}
protocolManager.sendServerPacket(player, title.entitySpawnPacket());
lines.forEach(line -> protocolManager.sendServerPacket(player, line.entitySpawnPacket()));
// updateScoreboard(player);
updateScoreboard(player);
viewers.put(player.getUniqueId(), player);
}