Fix ProtocolLib vanishing

This commit is contained in:
NotAlexNoyle committed 2026-04-22 15:00:28 -04:00
1 parent 055e4393d4
commit eb4f80f467
2 files changed
+10 -8

No files matched your search

@@ -140,6 +140,9 @@ public class VanishIndication extends Feature {
try {
if (VanishIndication.this.plugin.getVanishStateMgr().getOnlineVanishedPlayers().isEmpty())
return;
// multiple events share same packet object
event.setPacket(event.getPacket().shallowClone());
List<PlayerInfoData> infoDataList = new ArrayList<>(
@@ -53,10 +53,14 @@ public class PlayerInfoModule extends PacketAdapter {
@Override
public void onPacketSending(PacketEvent event) {
// multiple events share same packet object
event.setPacket(event.getPacket().shallowClone());
try {
// If nobody is vanished, do not touch login/player-info packets at all.
if (plugin.getVanishStateMgr().getOnlineVanishedPlayers().isEmpty())
return;
// multiple events share same packet object
event.setPacket(event.getPacket().shallowClone());
List<PlayerInfoData> rawList = event.getPacket().getPlayerInfoDataLists().read(0);
if (rawList == null)
return;
@@ -69,14 +73,9 @@ public class PlayerInfoModule extends PacketAdapter {
boolean modified = false;
for (PlayerInfoData infoData : new ArrayList<>(infoDataList)) {
if (infoData == null) {
infoDataList.remove(infoData);
modified = true;
if (infoData == null)
continue;
}
UUID uuid = extractUUID(infoData);
if (uuid == null)
continue;