mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fix enchanted books not being created with the proper data
This commit is contained in:
parent
006a7bf277
commit
aed4cb87be
@ -1,9 +1,11 @@
|
||||
Version 2.1.165
|
||||
Fixed a bug where Enchanted Books dropped by mcMMO (in Fishing) did not function correctly
|
||||
The mcMMO system which tracks player placed blocks has had some major rewrites (thanks t00thpick1)
|
||||
mcMMO will now be compatible with changes to world height (1.17 compatibility)
|
||||
Added missing cooldown locale message 'Commands.Database.Cooldown'
|
||||
|
||||
NOTES:
|
||||
Books dropped before this fix will not be usable and should just be chucked in lava, the broken books have blue names, the working books have yellow names.
|
||||
t00thpick1 has taken time to rewrite our block meta tracking system to be more efficient, easier to maintain, and support upcoming features such as world height changes
|
||||
This new system is compatible with the old one, it will convert old files to the new format as needed.
|
||||
This update shouldn't break anything as the API is the same
|
||||
|
@ -37,6 +37,7 @@ import org.bukkit.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.util.BoundingBox;
|
||||
@ -466,11 +467,13 @@ public class FishingManager extends SkillManager {
|
||||
EnchantmentWrapper enchantmentWrapper = getRandomEnchantment(fishingTreasureBook.getLegalEnchantments());
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if(itemMeta == null)
|
||||
if(itemMeta == null) {
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
itemMeta.addEnchant(enchantmentWrapper.getEnchantment(), enchantmentWrapper.getEnchantmentLevel(), ExperienceConfig.getInstance().allowUnsafeEnchantments());
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) itemMeta;
|
||||
enchantmentStorageMeta.addStoredEnchant(enchantmentWrapper.getEnchantment(), enchantmentWrapper.getEnchantmentLevel(), ExperienceConfig.getInstance().allowUnsafeEnchantments());
|
||||
itemStack.setItemMeta(enchantmentStorageMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user