mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-14 03:35:51 -07:00
Made OfflinePlayer and Player share the same .equals and .hashcode
This commit is contained in:
@@ -97,4 +97,26 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof OfflinePlayer)) {
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer other = (OfflinePlayer)obj;
|
||||
if ((this.getName() == null) || (other.getName() == null)) {
|
||||
return false;
|
||||
}
|
||||
return this.getName().equalsIgnoreCase(other.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 97 * hash + (this.getName() != null ? this.getName().hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user