Vanish API

Discussion in 'Bukkit Preview' started by Amaranth, Feb 9, 2012.

  1. Offline

    Amaranth

    This feature provides new API for hiding players from each other. The implementation provides three new methods on the Player class: showPlayer, hidePlayer, and canSee. All three of these take a Player as an argument.

    Player.hidePlayer removes a specified player from view. This will send a packet to remove them from the user list as well as hiding them in-game. This also makes them appear offline when the user runs /list and /tell. This:
    Code:
    playerA.hidePlayer(playerB);
    will hide playerB from playerA both in game as well as in the user list, /list, and /tell.

    Player.showPlayer is the reverse, this will make the specified player visible again in all the ways hidePlayer had hidden them.

    Player.canSee is used for checking to see if a player can see another specified player and can be used for hiding from view in your own implementation of /list as well as other areas you'd list online players.

    It is expected that a Vanish plugin would listen to PlayerJoinEvent and immediately hide all currently invisible players from the newly joining player.

    This API does not hide chat and join/quit messages or create fake join/quit messages. A plugin that wants such features will need to implement them on their own.

    For an example of how a Vanish plugin would use this API look at https://github.com/amaranth/SimpleVanish
     
    iKeirNez, MyPictures, hammale and 3 others like this.

Share This Page