Skip to content

Commit

Permalink
Fix not hiding player from others on join. And 1.2.6, for real
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Sep 30, 2024
1 parent 7636bf2 commit b56edbc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,17 @@ public void hideFakePlayer(UUID disguiseUUID)
public void handle(Player player)
{
var hiddenPlayers = new ObjectArrayList<>(this.hiddenPlayers);
var changed = hiddenPlayers.removeIf(uuid -> uuid.equals(player.getUniqueId()));
var isPlayerHiddenFromOthers = hiddenPlayers.removeIf(uuid -> uuid.equals(player.getUniqueId()));

var packet = new ClientboundPlayerInfoRemovePacket(hiddenPlayers);
this.sendPacket(player, packet);

if (isPlayerHiddenFromOthers)
{
var hidePacket = new ClientboundPlayerInfoRemovePacket(List.of(player.getUniqueId()));
Bukkit.getOnlinePlayers().forEach(p -> this.sendPacket(p, hidePacket));
}

this.fakePlayers.forEach((disguiseUUID, profile) ->
{
var infoPacket = new ClientboundPlayerInfoUpdatePacket(
Expand Down

0 comments on commit b56edbc

Please sign in to comment.