Added on-books for soulbound

This commit is contained in:
Auxilor 2021-05-04 10:24:55 +01:00
parent 56bbc56a6f
commit 3c8b39d7ac
2 changed files with 10 additions and 5 deletions

View File

@ -63,8 +63,10 @@ public class Soulbound extends EcoEnchant {
soulboundItems.add(itemStack);
}
if (itemStack.getItemMeta() instanceof EnchantmentStorageMeta && (((EnchantmentStorageMeta) itemStack.getItemMeta()).getStoredEnchants().containsKey(this.getEnchantment()))) {
soulboundItems.add(itemStack);
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) {
if (itemStack.getItemMeta() instanceof EnchantmentStorageMeta && (((EnchantmentStorageMeta) itemStack.getItemMeta()).getStoredEnchants().containsKey(this.getEnchantment()))) {
soulboundItems.add(itemStack);
}
}
}
@ -77,8 +79,10 @@ public class Soulbound extends EcoEnchant {
container.set(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER, 1);
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "remove-after")) {
if (meta instanceof EnchantmentStorageMeta) {
((EnchantmentStorageMeta) meta).removeStoredEnchant(this);
if (this.getConfig().getBool(EcoEnchants.CONFIG_LOCATION + "on-books")) {
if (meta instanceof EnchantmentStorageMeta) {
((EnchantmentStorageMeta) meta).removeStoredEnchant(this);
}
}
meta.removeEnchant(this);
}

View File

@ -20,4 +20,5 @@ general-config:
conflicts: [ ]
config:
remove-after: false # If soulbound should be 1-time use
remove-after: false # If soulbound should be 1-time use
on-books: true # If soulbound should work on books