-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
Since the recent enchantment changes, the number of shelves offered by the PrepareItemEnchantEvent is incorrect and must be manually checked.
The issue is in the patch for ContainerEnchantTable - rather than iterate over a new or safe integer for the quantity of buttons, the quantity of shelves is overwritten. It appears that the variable i (quantity of shelves) was mistakenly used instead of j.
Test plugin:
@EventHandler public void onPrepareItemEnchant(PrepareItemEnchantEvent event) { Bukkit.broadcastMessage(String.valueOf(event.getEnchantmentBonus())); }
Current code (L74-77):
for (i = 0; i < 3; ++i) { org.bukkit.enchantments.Enchantment enchantment = (this.h[i] >= 0) ? org.bukkit.enchantments.Enchantment.getById(this.h[i]) : null; offers[i] = ((enchantment != null) ? new EnchantmentOffer(enchantment, this.i[i], this.costs[i]) : null); }
Proposed fix:
for (j = 0; j < 3; ++j) { org.bukkit.enchantments.Enchantment enchantment = (this.h[j] >= 0) ? org.bukkit.enchantments.Enchantment.getById(this.h[j]) : null; offers[j] = ((enchantment != null) ? new EnchantmentOffer(enchantment, this.i[j], this.costs[j]) : null); }