Open Fusezion opened 11 months ago
There’s no way we could suppress this exception as you’re setting the ItemStack to Air in the event which then resulting Minecraft’s attempt to apply the enchant into a non-existent ItemMeta (Air does not have ItemMeta, highly probable).
Yeah, looking into this, it seems like something spigot/paper should defend against, rather than Skript. I don't see how we'd be able to solve this without just not allowing the item to be set to Air. Leaving open for others' opinions.
For example, clearing the applied enchants fails because of:
set enchanted item to air
...
set enchanted item to stone # now no enchants are applied
This doesn't seem like something we really should be trying to work around.
Skript/Server Version
Bug Description
When you set
enchanted item
in anon item enchant
event to air or any other invalid item, instead of setting slot to air or silently failing you're instead given a console stacktrace for null pointer when it attempts to add enchantments.Expected Behavior
Silently error in console since why not
Steps to Reproduce
Errors or Screenshots
Other
I'll be completely honest I am unsure how you should go about fixing this, as the error doesn't stem from
enchanted item
but rather the item being nulled out whenapplied enchantments
attempt to be added.After a bit further testing I've learned that if I do
clear applied enchantments
when I set it toair
it does fail silently so possible adding asgetMaterial()
and comparing#isItem()
and!#isAir()
if either fail clear applied enchantments?I would probably label this a server issue rather than skript but this is the easiest solution I've found for now
Agreement