From c43012ef1caed94c27038652b3a11f6b9bcce6fd Mon Sep 17 00:00:00 2001 From: Wesley Wolfe Date: Sun, 6 May 2012 13:39:46 -0500 Subject: [PATCH] Fixed broken hashCode() --- src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java | 2 +- src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java index fd86834ea0..349d8d2a92 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -125,7 +125,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa @Override public int hashCode() { int hash = 5; - hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0); + hash = 97 * hash + (this.getName() != null ? this.getName().toLowerCase().hashCode() : 0); return hash; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 080a687559..3291608f32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -189,9 +189,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public boolean equals(Object obj) { - if (obj == null) { - return false; - } if (!(obj instanceof OfflinePlayer)) { return false; } @@ -655,7 +652,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().hashCode() : 0); + hash = 97 * 5 + (this.getName() != null ? this.getName().toLowerCase().hashCode() : 0); } return hash; }