diff options
author | Daniel Naylor <git@drnaylor.co.uk> | 2014-05-26 20:33:10 +0100 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-05-26 19:45:07 -0500 |
commit | 0a45c3ebf79b8077d7ae324ba186639ed66f8446 (patch) | |
tree | aac78296ca1939217e67fb73eca85fa784023112 /src | |
parent | 38fbe60d4689ff026f09767ac9a5656da0549c2d (diff) | |
download | craftbukkit-0a45c3ebf79b8077d7ae324ba186639ed66f8446.tar craftbukkit-0a45c3ebf79b8077d7ae324ba186639ed66f8446.tar.gz craftbukkit-0a45c3ebf79b8077d7ae324ba186639ed66f8446.tar.lz craftbukkit-0a45c3ebf79b8077d7ae324ba186639ed66f8446.tar.xz craftbukkit-0a45c3ebf79b8077d7ae324ba186639ed66f8446.zip |
Use UUIDs in CraftPlayer equals and hashCode methods. Fixes BUKKIT-5634
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 55ea121b..a0e27bc3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -222,18 +222,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return false; } OfflinePlayer other = (OfflinePlayer) obj; - if ((this.getName() == null) || (other.getName() == null)) { + if ((this.getUniqueId() == null) || (other.getUniqueId() == null)) { return false; } - boolean nameEquals = this.getName().equalsIgnoreCase(other.getName()); + boolean uuidEquals = this.getUniqueId().equals(other.getUniqueId()); boolean idEquals = true; if (other instanceof CraftPlayer) { idEquals = this.getEntityId() == ((CraftPlayer) other).getEntityId(); } - return nameEquals && idEquals; + return uuidEquals && idEquals; } @Override @@ -947,7 +947,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public int hashCode() { if (hash == 0 || hash == 485) { - hash = 97 * 5 + (this.getName() != null ? this.getName().toLowerCase().hashCode() : 0); + hash = 97 * 5 + (this.getUniqueId() != null ? this.getUniqueId().hashCode() : 0); } return hash; } |