Bukkit/Bukkit — pull request #1094 by unon1100 (2014-08-04 04:00:05+00:00)
Title: Fix tab crashes

If you are on a large server, and you press [tab] after typing '/deop' or '/whitelist add', it can crash large servers.
This is a result of calling the method getOfflinePlayers, which is not an appropriate method to be calling. getOperators makes much more sense for '/deop' as it is a much smaller Collection. The only downside is that because it is a Set rather than a list, iterating through it is a small bit slower than iterating through a List of the same size, but iterating through a Set of maybe 10 people is much more efficient than iterating through a list of a few thousand.

Proof of concept: http://pastebin.com/35yFbfz9

This increases efficiency by a very large amount. Doing this with other commands does not have a similar effect as they do not call the getOfflinePlayers() method, but with this command it will crash any large server.

In terms of /whitelist add, the tab completion for that should be removed in general. It is an extremely minor inconvenience, but fixes something that could easily crash any large server. While permissions are needed. it is very easy to want to add a friend to a lobby that was previously unwhitelisted, but now is. You type most of their name, tab complete, and instead of whitelisting your friend, the server crashes.

JIRA bug:
BUKKIT-5742 - https://bukkit.atlassian.net/browse/BUKKIT-5742