Bukkit/CraftBukkit — pull request #1383 by dualspiral (2014-05-26 20:48:25+00:00)
Title: [C] Update .equals() and .hashCode() methods in CraftPlayer to be equivalent to those in CraftOfflinePlayer. Fixes BUKKIT-5634.

**The Issue**

Since the update to 1.7.8, `CraftPlayer` and `CraftOfflinePlayer` has used two different algorithms to determine equality and their hashcodes, CraftPlayer being based on a player's name and CraftOfflinePlayer based on the player's UUID. Plugins that used methods that compared an `OfflinePlayer` with a `Player` now return that the two entities are not equal, when previously, they were reported to be equal.

**Justification for this PR**

This is to fix any plugin that used this property of OfflinePlayer and Player objects prior to 1.7.8. For example, any player using the `contains` method on a list of `OfflinePlayer` objects using a `Player` object as an argument will always return false post 1.7.8 due to the hash codes not being equal.

**PR Breakdown**

This PR changes two methods in `CraftPlayer`
* `hashCode` now returns the hash code of the player's UUID
* `equals` performs the equality test on the UUIDs of the players, not the names.

**Testing**

A small test plugin can be compiled from code at https://gist.github.com/dualspiral/e575d4daf03cb3124f1f
Please note that you must have logged into the test server once and restarted it before using this plugin. Once you have done this, use the command `/hashtest`. This will check to see if the OfflinePlayer and Player objects are equivalent. A warning will appear if you do this and the OfflinePlayer is actually a Player object - which would render this test invalid.

**JIRA ticket**

BUKKIT-5634: https://bukkit.atlassian.net/browse/BUKKIT-5634