Errors while trying to set custom string in item's NBT on 1.20.2 server
MorkaZ opened this issue ยท 1 comments
Error:
de.tr7zw.nbtapi.NbtApiException: [?]Error while calling the method 'putString(java.lang.String,java.lang.String)', loaded: true, Enum: COMPOUND_SET_STRING, Passed Class: class java.lang.Boolean
at de.tr7zw.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:358) ~[MoxCore.jar:?]
at de.tr7zw.nbtapi.NBTReflectionUtil.setData(NBTReflectionUtil.java:615) ~[MoxCore.jar:?]
at de.tr7zw.nbtapi.NBTCompound.setString(NBTCompound.java:115) ~[MoxCore.jar:?]
at com.morkaz.moxlibrary.api.ItemUtils.setCustomTag(ItemUtils.java:134) ~[MoxCore.jar:?]
at com.morkaz.moxtransmutators.managers.GuiManager.formatDefaulTransmutatorInventory(GuiManager.java:37) ~[MoxTransmutators.jar:?]
at com.morkaz.moxtransmutators.managers.GuiManager.getNewTransmutatorInventory(GuiManager.java:28) ~[MoxTransmutators.jar:?]
at com.morkaz.moxtransmutators.managers.TransmutatorsManager.createTransmutator(TransmutatorsManager.java:103) ~[MoxTransmutators.jar:?]
at com.morkaz.moxtransmutators.listeners.SignChangeListener.signChangeListener(SignChangeListener.java:59) ~[MoxTransmutators.jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor514.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:77) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:git-Purpur-2083]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[purpur-1.20.2.jar:git-Purpur-2083]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[purpur-1.20.2.jar:git-Purpur-2083]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:617) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at net.minecraft.world.level.block.entity.SignBlockEntity.setMessages(SignBlockEntity.java:242) ~[?:?]
at net.minecraft.world.level.block.entity.SignBlockEntity.lambda$updateSignText$4(SignBlockEntity.java:188) ~[?:?]
at net.minecraft.world.level.block.entity.SignBlockEntity.updateText(SignBlockEntity.java:202) ~[?:?]
at net.minecraft.world.level.block.entity.SignBlockEntity.updateSignText(SignBlockEntity.java:187) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.updateSignText(ServerGamePacketListenerImpl.java:3459) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleSignUpdate$26(ServerGamePacketListenerImpl.java:3440) ~[?:?]
at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:718) ~[?:?]
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1351) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:193) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1328) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1321) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1299) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1187) ~[purpur-1.20.2.jar:git-Purpur-2083]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2083]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
at de.tr7zw.nbtapi.utils.nmsmappings.ReflectionMethod.run(ReflectionMethod.java:355) ~[MoxCore.jar:?]
... 35 more
Method:
public static ItemStack setCustomTag(ItemStack itemStack, String tagKey, String tagValue){
NBTItem nbtItem = getNBTItem(itemStack);
nbtItem.setString(tagKey, tagValue);
itemStack = nbtItem.getItem();
return itemStack;
}
ItemStack was just "stone" in this case. tagKey
was "moxtransmutatorgui", tagValue
was "true".
slotItem = ItemUtils.setCustomTag(slotItem, "moxtransmutatorgui", "true");
This problem did not exist before updating and because of it, most of my plugins stopped working.
Using latest purpur (paper spigot fork) 1.20.2 and latest Item-NBT-API from maven:
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>2.12.1</version>
</dependency>
Whole item-nbt-api-plugin
is extracted into my plugin jar.