Bukkit/CraftBukkit — pull request #1352 by aikar (2014-03-05 18:41:59+00:00)
Title: Improvements to Player Lookup Performance - Resolves BUKKIT-4608

***The Issue:***
Player lookup is done very ineffeciently by iterating all online players and doing a name comparison. This results in reduced performance on larger servers.

***PR Breakdown:***
This PR will maintain a HashMap along side the current CopyOnWriteArrayList in the PlayerList class.
Wherever vanilla code or CraftBukkit code would have iterated over the player list and performed a name comparison check, it has been replaced with a simple Map look-up.

PlayerList.getPlayer, PlayerList.processLogin, CraftServer.getPlayerExact, CraftOfflinePlayer.getPlayer are the areas changed.

This PR also removes unnecessary array copying of the current online players in various CraftServer methods. In these cases, iteration was still necessary, but did not require duplicating the list.

***Testing:***
General Gameplay of things that trigger Player Lookups such as Ender Pearls and Plugins.

I have used this change for 7 months now with 0 problems on a a 200-300 player server.

***JIRA Ticket:***
https://bukkit.atlassian.net/browse/BUKKIT-4608