Skip to content

Commit

Permalink
fix item builder error
Browse files Browse the repository at this point in the history
  • Loading branch information
hakan-krgn committed Dec 20, 2023
1 parent 9b2fbb7 commit ae3a330
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ public static void initialize() {
glowEnchantment = ReflectionUtils.newInstance("com.hakan.core.item.enchantment.EnchantmentGlow_%s",
new Class[]{int.class}, new Object[]{152634});

if (Arrays.asList(Enchantment.values()).contains(glowEnchantment))
return;
if (ProtocolVersion.getCurrentVersion().isOlderOrEqual(ProtocolVersion.v1_20_R2)) {
if (Arrays.asList(Enchantment.values()).contains(glowEnchantment))
return;

ReflectionUtils.setField(Enchantment.class, "acceptingNew", true);
Enchantment.registerEnchantment(glowEnchantment);
ReflectionUtils.setField(Enchantment.class, "acceptingNew", true);
Enchantment.registerEnchantment(glowEnchantment);
}
}

/**
Expand Down Expand Up @@ -364,7 +366,7 @@ public <T extends ItemBuilder> T durability(short durability) {
* @return If item stack has enchantment, returns true.
*/
public boolean hasEnchants() {
return this.enchantments.size() > 0;
return !this.enchantments.isEmpty();
}

/**
Expand Down

0 comments on commit ae3a330

Please sign in to comment.