Exclude vanished players from tab complete list

Part 2 of fixing #1745
This commit is contained in:
TfT_02
2014-02-28 21:55:32 +01:00
parent 53fdf750f4
commit e56d5a0454
14 changed files with 48 additions and 30 deletions

View File

@ -220,6 +220,19 @@ public final class CommandUtils {
}
}
public static List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<String>();
for (Player onlinePlayer : mcMMO.p.getServer().getOnlinePlayers()) {
if (player != null && player.canSee(onlinePlayer)) {
onlinePlayerNames.add(onlinePlayer.getName());
}
}
return onlinePlayerNames;
}
/**
* Get a matched player name if one was found in the database.
*