Solved how to make hidePlayer(player) not hide them in tablist?

Discussion in 'Spigot Plugin Development' started by Swiftlicious, Jan 23, 2020.

Thread Status:
Not open for further replies.
  1. So I use the following function to hide my spectators from everyone physically:
    Code (Text):
            for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
                onlinePlayer.hidePlayer(pl, p);
                p.showPlayer(pl, onlinePlayer);
                p.canSee(onlinePlayer);
                p.showPlayer(pl, p);
                p.canSee(p);
                if (spectatorMode.contains(onlinePlayer.getName())) { onlinePlayer.showPlayer(pl, p); onlinePlayer.canSee(p); }
            }
    Doing this of course hides the player who can't see them from the tablist, is there a way (possibly using Reflection or NMS) to revert this change but still hide the player from everyone else except other spectators like I have it as.
     
  2. i think you could add a fake player ot the tablist instead for the time being
     
    • Like Like x 1
  3. Create fake entity player just like any npc plugin does so they’re gonna be on the tab list, make sure to use packet that way you can send the packet to everyone except the invisible player, that way he won’t see himself twice in the tab list
     
  4. So send the packet to all players excluding themselves?
     
  5. Exactly, that will do
     
Thread Status:
Not open for further replies.