сравнение H2Player по id и uuid
This commit is contained in:
@@ -11,6 +11,7 @@ import mc.core.world.World;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@@ -41,4 +42,18 @@ public class H2Player implements Player {
|
||||
public void setWorld(World world) {
|
||||
this.$refWorld = new WeakReference<>(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
if (obj == null || getClass() != obj.getClass()) return false;
|
||||
H2Player player = (H2Player) obj;
|
||||
return id == player.id &&
|
||||
Objects.equals(uuid, player.uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, uuid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user