Vanishing a player?

Discussion in 'Plugin Development' started by XbannisherX, Jun 12, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    XbannisherX

    How is it possible to make a player vanish?
    somebody got a example mayby?
     
  2. Player.hidePlayer(Player)
     
    TheGamesHawk2001 likes this.
  3. Offline

    XbannisherX

  4. Offline

    r0306

    XbannisherX
    Also, the Player in front is the player that the argument is hidden from to make the player vanish from all players on the server,

    Code:
     List<Player> hiddenFrom = new ArrayList<Player>(); //defined as a class variable
    Player player = playertohide;
    for (Player p : Bukkit.getServer().getOnlinePlayers()) {
        p.hidePlayer(player);
        hiddenFrom.add(p);
    }
     
    XbannisherX likes this.
  5. Offline

    nala3

    of course, you would want to keep track of who is hidden, so you may want to throw the player object into a list for later reference ;)
     
  6. Offline

    r0306

    nala3
    Updated. BTW, would there need to be a playerjoinlistener to hide the player from any newcomers?
     
  7. Offline

    nala3

    indeed there would.

    EDIT: I noticed your modified code up there, is not correct. You want to add each player who is hidden to the list. not every player on the server
     
  8. Offline

    r0306

  9. Offline

    XbannisherX

    this helped me very much ;)
     
  10. Offline

    r0306

    Ok.
     
Thread Status:
Not open for further replies.

Share This Page