Skript icon indicating copy to clipboard operation
Skript copied to clipboard

hasConflictingEnchant is missing in Skript

Open Darkweasam opened this issue 5 years ago • 3 comments

Suggestion

Hello, I do not seem to find this expression/condition in Skript at all, meaning I cannot check for mutually-exclusive enchantments on an item before adding a new vanilla enchantment to it

https://papermc.io/javadocs/paper/1.16/org/bukkit/inventory/meta/ItemMeta.html#hasConflictingEnchant(org.bukkit.enchantments.Enchantment)

hasConflictingEnchant boolean hasConflictingEnchant​(@NotNull @NotNull Enchantment ench) Checks if the specified enchantment conflicts with any enchantments in this ItemMeta.

Parameters: ench - enchantment to test Returns: true if the enchantment conflicts, false otherwise

Why?

I would like to add Sharpness 6 and other unobtainable vanilla enchantments through anvil and I don't seem to find a better way than this:

on anvil prepare:
    if slot 0 of event-inventory is an enchanted book:
        set {_bookslot} to 0
        set {_itemslot} to slot 1 of event-inventory
    else if slot 1 of event-inventory is an enchanted book:
        set {_bookslot} to 1
        set {_itemslot} to slot 0 of event-inventory
    else:
        stop
    if stored enchants of slot {_bookslot} of event-inventory contains sharpness 6:
        set {_i} to {_itemslot}
        enchant {_i} with sharpness 6
        set event-slot to {_i} 

However with such skript, I am able to add sharpness6 to a sword that already has Smite for example (because I cannot find a way to check for conflicting enchants this way without adding ALL checks manually into my skript)

In short, I would like to be able higher levels of enchanted books for my swords/armors yet keep the original vanilla mutually-exclusive enchantments rule of Minecraft

Other

No response

Agreement

  • [X] I have read the guidelines above and confirm I am following them with this suggestion.

Darkweasam avatar Aug 04 '21 16:08 Darkweasam

I don't see how this is an issue... if you want a feature, then you need to give more details. If you need help, join the skUnity Discord server and ask there.

Th-Underscore avatar Aug 04 '21 18:08 Th-Underscore

Then there wouldn't be suggestion form. Let's begin with skript-reflect - if vanilla skript or addons don't provide something BUT bukkit api does, then skript-reflect is your best friend and that's it. It would be a nice touch, but not many people would even know and actually use it. In short; completely pointless.

HW2955 avatar Aug 04 '21 18:08 HW2955

Good suggestion 👍

TPGamesNL avatar Aug 05 '21 09:08 TPGamesNL