edit custom item fix #91
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
This is a small one-liner fix. I hadn’t looked a lot into this plugin’s code before, so I hope the change makes sense.
For me, it fixed an issue where I couldn’t edit custom items after reloading the plugin. I always got the message that I can edit the CustomItem, but nothing happened and the GUI kinda crashed and I had to reload the plugin. In the console there was this error:
[21:07:03 WARN]: [CustomCrafting] Task #692 for CustomCrafting v4.19.0.1 generated an exception java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()" because "itemMeta" is null at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.custom_items.CustomItem.lambda$create$3(CustomItem.java:615) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at java.base/java.util.Optional.map(Optional.java:260) ~[?:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.custom_items.CustomItem.create(CustomItem.java:611) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.custom_items.CustomItem.create(CustomItem.java:597) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at customcrafting-spigot-4.19.0.1.jar/me.wolfyscript.customcrafting.gui.item_creator.MenuItemCreator.onUpdateAsync(MenuItemCreator.java:261) ~[customcrafting-spigot-4.19.0.1.jar:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.gui.GuiWindow.openInventory(GuiWindow.java:278) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.gui.GuiWindow.lambda$callUpdate$1(GuiWindow.java:268) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.gui.GuiWindow.callUpdate(GuiWindow.java:270) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at wolfyutils-spigot-4.19-SNAPSHOT.jar/me.wolfyscript.utilities.api.inventory.gui.GuiWindow.lambda$update$0(GuiWindow.java:261) ~[wolfyutils-spigot-4.19-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:78) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:474) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1659) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1529) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1251) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-138-5395ae3] at java.base/java.lang.Thread.run(Thread.java:1570) ~[?:?]Let me know if there's a better way to approach it. Happy to adjust if needed.
Thanks for the awesome work on the plugin
Cheers
Janschuri