mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06: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
|
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)
|
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)
|
mcMMO will now be compatible with changes to world height (1.17 compatibility)
|
||||||
Added missing cooldown locale message 'Commands.Database.Cooldown'
|
Added missing cooldown locale message 'Commands.Database.Cooldown'
|
||||||
|
|
||||||
NOTES:
|
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
|
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 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
|
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.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
@ -466,11 +467,13 @@ public class FishingManager extends SkillManager {
|
|||||||
EnchantmentWrapper enchantmentWrapper = getRandomEnchantment(fishingTreasureBook.getLegalEnchantments());
|
EnchantmentWrapper enchantmentWrapper = getRandomEnchantment(fishingTreasureBook.getLegalEnchantments());
|
||||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||||
|
|
||||||
if(itemMeta == null)
|
if(itemMeta == null) {
|
||||||
return itemStack;
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
itemMeta.addEnchant(enchantmentWrapper.getEnchantment(), enchantmentWrapper.getEnchantmentLevel(), ExperienceConfig.getInstance().allowUnsafeEnchantments());
|
EnchantmentStorageMeta enchantmentStorageMeta = (EnchantmentStorageMeta) itemMeta;
|
||||||
itemStack.setItemMeta(itemMeta);
|
enchantmentStorageMeta.addStoredEnchant(enchantmentWrapper.getEnchantment(), enchantmentWrapper.getEnchantmentLevel(), ExperienceConfig.getInstance().allowUnsafeEnchantments());
|
||||||
|
itemStack.setItemMeta(enchantmentStorageMeta);
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user