Example #1
0
  @Override
  public void hidePlayer(Player player, Player toHide) {
    if (player != null && toHide != null && !player.equals(toHide)) {
      if (!hiddenPlayersMap.containsKey(player) || !hiddenPlayersMap.get(player).contains(toHide)) {
        hiddenPlayersMap.get(player).add(toHide);

        net.minecraft.entity.EntityTrackerEntry entry = tracker.getTrackerEntry(toHide.getID());
        entry.a(((CanaryPlayer) player).getHandle());

        PlayerListData listEntry = toHide.getPlayerListData(PlayerListAction.REMOVE_PLAYER);
        player.sendPlayerListData(listEntry);
      }
    }
  }
Example #2
0
  @Override
  public void showPlayer(Player player, Player toShow) {
    if (player != null && toShow != null && !player.equals(toShow)) {
      if (hiddenPlayersMap.containsKey(player) && hiddenPlayersMap.get(player).contains(toShow)) {
        hiddenPlayersMap.get(player).remove(toShow);

        PlayerListData listEntry = toShow.getPlayerListData(PlayerListAction.ADD_PLAYER);
        player.sendPlayerListData(listEntry);

        net.minecraft.entity.EntityTrackerEntry entry = tracker.getTrackerEntry(toShow.getID());
        entry.b(((CanaryPlayer) player).getHandle());
      }
    }
  }