[Bleeding] Added Vanish API for hiding players from each other.

Adds Player.hidePlayer, Player.showPlayer, and Player.canSee for managing
what players are hidden from a player. When someone is hidden from a player
the player cannot see them in the user list or /list and they cannot /tell
them so they appear to be completely gone from the server.

By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
Bukkit/Spigot
2012-01-31 13:50:12 -06:00
parent b2d95b3937
commit f7f18879e3
4 changed files with 40 additions and 1 deletions

View File

@@ -19,6 +19,10 @@ public class ListCommand extends VanillaCommand {
StringBuilder players = new StringBuilder();
for (Player player : Bukkit.getOnlinePlayers()) {
// If a player is hidden from the sender don't show them in the list
if (sender instanceof Player && !((Player) sender).canSee(player))
continue;
if (players.length() > 0) {
players.append(", ");
}

View File

@@ -24,7 +24,8 @@ public class TellCommand extends VanillaCommand {
Player player = Bukkit.getPlayerExact(args[0]);
if (player == null) {
// If a player is hidden from the sender pretend they are offline
if (player == null || (sender instanceof Player && !((Player) sender).canSee(player))) {
sender.sendMessage("There's no player by that name online.");
} else {
StringBuilder message = new StringBuilder();