9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

refactor: adjust equals impl in Identifier

This commit is contained in:
William
2024-11-15 12:11:02 +00:00
parent bc1f983684
commit 0627fb20e4

View File

@@ -25,6 +25,7 @@ import net.kyori.adventure.key.Key;
import org.intellij.lang.annotations.Subst;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.Comparator;
@@ -229,11 +230,8 @@ public class Identifier {
* @return {@code true} if the given object is an identifier with the same key as this identifier
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof Identifier other) {
return key.equals(other.key);
}
return false;
public boolean equals(@Nullable Object obj) {
return obj instanceof Identifier other ? toString().equals(other.toString()) : super.equals(obj);
}
// Get the config entry for the identifier