mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
Add identity checks with various implementations of equals(Object).
This commit is contained in:
parent
4705f75fa0
commit
4a7efdc3a4
|
@ -96,7 +96,8 @@ public class HashMapLOW <K, V> {
|
|||
// By specification, not intended to be useful here.
|
||||
if (obj instanceof Entry<?, ?>) {
|
||||
final Entry<?, ?> entry = (Entry<?, ?>) obj;
|
||||
return (key == null ? entry.getKey() == null : key.equals(entry.getKey()))
|
||||
return obj == this
|
||||
|| (key == null ? entry.getKey() == null : key.equals(entry.getKey()))
|
||||
&& (value == null ? entry.getValue() == null : value.equals(entry.getValue()));
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -54,11 +54,16 @@ public class TestCoordMap {
|
|||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof Pos){
|
||||
Pos other = (Pos) obj;
|
||||
return other.hash == hash && other.x == x && other.y == y && other.z == z;
|
||||
}
|
||||
else return false;
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
@ -153,6 +153,9 @@ public class BlockChangeReference {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || !(obj instanceof BlockChangeReference)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -228,6 +228,9 @@ public class BlockChangeTracker {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || !(obj instanceof BlockChangeEntry)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,9 @@ public class RegisteredPermission {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof Integer) {
|
||||
return id.intValue() == ((Integer) obj).intValue();
|
||||
}
|
||||
|
|
|
@ -170,6 +170,9 @@ public abstract class BlockCache {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof IBlockCacheNode) {
|
||||
final IBlockCacheNode other = (IBlockCacheNode) obj;
|
||||
return id == other.getType()
|
||||
|
|
|
@ -463,6 +463,9 @@ public class BlockProperties {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof BlockBreakKey) {
|
||||
final BlockBreakKey other = (BlockBreakKey) obj;
|
||||
// TODO: Some should be equals later.
|
||||
|
|
Loading…
Reference in New Issue
Block a user