Remove getConflictsWithEverything for legacy Eco Enchant

This commit is contained in:
alexcrea 2024-12-21 21:14:37 +01:00
parent 1e3b193d46
commit 0c223dd411
No known key found for this signature in database
GPG key ID: 43FD265DB0DBF91F
3 changed files with 15 additions and 23 deletions

View file

@ -11,10 +11,6 @@ import java.util.Set;
*/
public class EcoEnchant {
public boolean getConflictsWithEverything() {
return false;
}
public boolean conflictsWith(@NotNull Enchantment enchant) {
return false;
}

View file

@ -22,19 +22,19 @@ public class CAEcoEnchant extends CABukkitEnchantment implements AdditionalTestE
@Override
public boolean isEnchantConflict(@NotNull Map<CAEnchantment, Integer> enchantments, @NotNull Material itemMat) {
if(!enchantments.isEmpty()) {
if (this.ecoEnchant.getConflictsWithEverything()) {
if(enchantments.isEmpty()) return false;
if (this.ecoEnchant.getConflictsWithEverything()) {
return true;
}
for (CAEnchantment other : enchantments.keySet()) {
if(other instanceof CABukkitEnchantment otherVanilla
&& this.ecoEnchant.conflictsWith(otherVanilla.getEnchant())){
return true;
}
for (CAEnchantment other : enchantments.keySet()) {
if(other instanceof CABukkitEnchantment otherVanilla
&& this.ecoEnchant.conflictsWith(otherVanilla.getEnchant())){
return true;
}
}
}
return false;
}

View file

@ -23,16 +23,12 @@ public class CALegacyEcoEnchant extends CABukkitEnchantment implements Additiona
@Override
public boolean isEnchantConflict(@NotNull Map<CAEnchantment, Integer> enchantments, @NotNull Material itemMat) {
if (!enchantments.isEmpty()) {
if (this.ecoEnchant.getConflictsWithEverything()) {
return true;
}
if (enchantments.isEmpty()) return false;
for (CAEnchantment other : enchantments.keySet()) {
if (other instanceof CABukkitEnchantment otherVanilla
&& this.ecoEnchant.conflictsWith(otherVanilla.getEnchant())) {
return true;
}
for (CAEnchantment other : enchantments.keySet()) {
if (other instanceof CABukkitEnchantment otherVanilla
&& this.ecoEnchant.conflictsWith(otherVanilla.getEnchant())) {
return true;
}
}