Added option for soulbound to be 1-time use

This commit is contained in:
Auxilor 2021-03-04 18:20:12 +00:00
parent dd9181f615
commit df2191f0e7
2 changed files with 9 additions and 1 deletions

View File

@ -75,6 +75,14 @@ public class Soulbound extends EcoEnchant {
assert meta != null; assert meta != null;
PersistentDataContainer container = meta.getPersistentDataContainer(); PersistentDataContainer container = meta.getPersistentDataContainer();
container.set(this.getPlugin().getNamespacedKeyFactory().create("soulbound"), PersistentDataType.INTEGER, 1); 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);
}
meta.removeEnchant(this);
}
itemStack.setItemMeta(meta); itemStack.setItemMeta(meta);
} }

View File

@ -20,4 +20,4 @@ general-config:
conflicts: [] conflicts: []
config: config:
# No config is available for this enchantment remove-after: false # If soulbound should be 1-time use