fix inverted equal logic

This commit is contained in:
alexcrea 2025-05-01 19:01:16 +02:00
parent ee5c31ad40
commit b67d956e39
No known key found for this signature in database
GPG key ID: 027DD67D2D3280C5
2 changed files with 4 additions and 3 deletions

View file

@ -76,7 +76,7 @@ public class CAEnchantmentRegistry {
*/
public boolean register(@NotNull CAEnchantment enchantment) {
if (byKeyMap.containsKey(enchantment.getKey())) {
if (!enchantment.equals(byKeyMap.get(enchantment.getKey()))) {
if (Objects.equals(enchantment, byKeyMap.get(enchantment.getKey()))) {
// We are trying to register the exact same enchantment. so we just skip it.
return false;
}

View file

@ -18,6 +18,7 @@ import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.logging.Level;
/**
@ -163,7 +164,7 @@ public class CABukkitEnchantment extends CAEnchantmentBase {
return false;
}
return this.bukkit.equals(other.getEnchant());
return Objects.equals(this.bukkit, other.getEnchant());
}
}