From b0d6903262cfad6de5aa5c056a366418ddfdeb26 Mon Sep 17 00:00:00 2001 From: vytskalt Date: Sun, 13 Oct 2024 16:35:14 +0300 Subject: [PATCH] fix removing score on packetevents --- .../packetevents/ObjectivePacketAdapterImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/versions/packetevents/src/main/java/net/megavex/scoreboardlibrary/implementation/packetAdapter/packetevents/ObjectivePacketAdapterImpl.java b/versions/packetevents/src/main/java/net/megavex/scoreboardlibrary/implementation/packetAdapter/packetevents/ObjectivePacketAdapterImpl.java index e66448b..51ee7db 100644 --- a/versions/packetevents/src/main/java/net/megavex/scoreboardlibrary/implementation/packetAdapter/packetevents/ObjectivePacketAdapterImpl.java +++ b/versions/packetevents/src/main/java/net/megavex/scoreboardlibrary/implementation/packetAdapter/packetevents/ObjectivePacketAdapterImpl.java @@ -1,6 +1,7 @@ package net.megavex.scoreboardlibrary.implementation.packetAdapter.packetevents; import com.github.retrooper.packetevents.PacketEventsAPI; +import com.github.retrooper.packetevents.manager.server.ServerVersion; import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDisplayScoreboard; @@ -107,12 +108,10 @@ public void removeScore(@NotNull Collection players, @NotNull String ent objectiveName ); - for (Player player : players) { - if (packetEvents.getPlayerManager().getClientVersion(player).isNewerThanOrEquals(ClientVersion.V_1_20_3)) { - provider.sendPacket(players, newPacket); - } else { - provider.sendPacket(players, oldPacket); - } + if (packetEvents.getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_20_3)) { + provider.sendPacket(players, newPacket); + } else { + provider.sendPacket(players, oldPacket); } }