Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin couldn't save trade with a custom banner #159

Open
2 tasks done
ChristopherPS96 opened this issue Oct 30, 2023 · 4 comments
Open
2 tasks done

Plugin couldn't save trade with a custom banner #159

ChristopherPS96 opened this issue Oct 30, 2023 · 4 comments

Comments

@ChristopherPS96
Copy link

Stack trace

[15:43:28 ERROR]: [TradeShop] com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 26 column 76 path $.l::world::19979.0::4.0::20296.0.product[0].itemStack.meta.display-name
--------------------------------------------------------------------------------------
{
"l::world::19979.0::4.0::20296.0": {
"shopLoc": {
"div": "::",
"worldName": "world",
"x": 19979.0,
"y": 4.0,
"z": 20296.0
},
"owner": {
"player": "a6da4ce6-afa3-400f-a610-d29f70eabeee",
"role": "OWNER"
},
"managers": [],
"members": [],
"shopType": "ITRADE",
"product": [
{
"itemStack": {
"==": "org.bukkit.inventory.ItemStack",
"v": 3465,
"type": "PURPLE_BANNER",
"meta": {
"==": "ItemMeta",
"meta-type": "BANNER",
"display-name": "{\"italic\":false,\"text\":\"Clan Rat Banner\"
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated string at line 26 column 76 path $.l::world::19979.0::4.0::20296.0.product[0].itemStack.meta.display-name
at com.google.gson.internal.Streams.parse(Streams.java:61) ~[gson-2.10.jar:?]
at com.google.gson.JsonParser.parseReader(JsonParser.java:102) ~[gson-2.10.jar:?]
at com.google.gson.JsonParser.parseReader(JsonParser.java:70) ~[gson-2.10.jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonConfiguration.loadFile(JsonConfiguration.java:115) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonShopConfiguration.loadFile(JsonShopConfiguration.java:145) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonConfiguration.<init>(JsonConfiguration.java:63) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonShopConfiguration.<init>(JsonShopConfiguration.java:51) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.getShopConfiguration(DataStorage.java:292) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.getShopConfiguration(DataStorage.java:287) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.loadShopFromSign(DataStorage.java:180) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.Shop.loadShop(Shop.java:168) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.Shop.loadShop(Shop.java:178) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.listeners.ShopProtectionListener.onBlockBreak(ShopProtectionListener.java:208) ~[TradeShop-514985 (PP).jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor113.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:git-Paper-196]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.1.jar:git-Paper-196]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.1.jar:git-Paper-196]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.level.ServerPlayerGameMode.destroyBlock(ServerPlayerGameMode.java:378) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.destroyAndAck(ServerPlayerGameMode.java:337) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction(ServerPlayerGameMode.java:215) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handlePlayerAction(ServerGamePacketListenerImpl.java:1927) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:42) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.a(ServerboundPlayerActionPacket.java:15) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:51) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-196]
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:1338) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1315) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1308) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1170) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
at java.lang.Thread.run(Unknown Source) ~[?:?]
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated string at line 26 column 76 path $.l::world::19979.0::4.0::20296.0.product[0].itemStack.meta.display-name
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1657) ~[gson-2.10.jar:?]
at com.google.gson.stream.JsonReader.nextQuotedValue(JsonReader.java:1042) ~[gson-2.10.jar:?]
at com.google.gson.stream.JsonReader.nextString(JsonReader.java:824) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.TypeAdapters$28.readTerminal(TypeAdapters.java:747) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:791) ~[gson-2.10.jar:?]
at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725) ~[gson-2.10.jar:?]
at com.google.gson.internal.Streams.parse(Streams.java:49) ~[gson-2.10.jar:?]
... 39 more
[15:43:28 ERROR]: Could not pass event BlockBreakEvent to TradeShop v2.6.1-STABLE
java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonObject.entrySet()" because "this.jsonObj" is null
at org.shanerx.tradeshop.data.storage.Json.JsonShopConfiguration.loadFile(JsonShopConfiguration.java:147) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonConfiguration.<init>(JsonConfiguration.java:63) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.Json.JsonShopConfiguration.<init>(JsonShopConfiguration.java:51) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.getShopConfiguration(DataStorage.java:292) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.getShopConfiguration(DataStorage.java:287) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.data.storage.DataStorage.loadShopFromSign(DataStorage.java:180) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.Shop.loadShop(Shop.java:168) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.Shop.loadShop(Shop.java:178) ~[TradeShop-514985 (PP).jar:?]
at org.shanerx.tradeshop.shop.listeners.ShopProtectionListener.onBlockBreak(ShopProtectionListener.java:208) ~[TradeShop-514985 (PP).jar:?]
at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor113.execute(Unknown Source) ~[?:?]
at org.bukkit.plugin.EventExecutor$2.execute(EventExecutor.java:77) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:81) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:git-Paper-196]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.20.1.jar:git-Paper-196]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:126) ~[paper-1.20.1.jar:git-Paper-196]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:615) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.level.ServerPlayerGameMode.destroyBlock(ServerPlayerGameMode.java:378) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.destroyAndAck(ServerPlayerGameMode.java:337) ~[?:?]
at net.minecraft.server.level.ServerPlayerGameMode.handleBlockBreakAction(ServerPlayerGameMode.java:215) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handlePlayerAction(ServerGamePacketListenerImpl.java:1927) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.handle(ServerboundPlayerActionPacket.java:42) ~[?:?]
at net.minecraft.network.protocol.game.ServerboundPlayerActionPacket.a(ServerboundPlayerActionPacket.java:15) ~[?:?]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:51) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-196]
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:1338) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1315) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1308) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1424) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1170) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
at java.lang.Thread.run(Unknown Source) ~[?:?]

Plugin list

  • Chunky
  • CoreProtect
  • Essentials
  • EssentialsChat
  • EssentialsProtect
  • EssentialsSpawn
  • GriefPrevention
  • ImageFrame
  • LibertyBans
  • LuckPerms
  • Maintenance
  • PluginPortal
  • ProtocolLib
  • sleep-most
  • TradeShop
  • Vault
  • WarpSystem

Actions to reproduce (if known)

  1. Make any kind of trade with either TRADE or iTRADE
  2. Add any kind of Cost
  3. Create a custom banner with custom name (for example, through: GamerGeeks
  4. Add as product to the trade
  5. Trade will work as intented.
  6. Close the server and let the trade save
  7. After a restart, the trade will crash with the exception mentioned.

If I would guess, the plugin has a problem with the specific name, being not italic. But that is just a guess on my side.

TradeShop version and Minecraft version (CraftBukkit/Spigot/Paper/...)

This server is running Paper version git-Paper-196 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 773dd72)
You are running the latest version
Previous version: git-Paper-137 (MC: 1.20.1)

TradeShop 2.6.1-STABLE by Lori00 & KillerOfPie
/tradeshop Display help message
/ts help Display help message
/ts setup Display shop setup tutorial
/ts bugs Report bugs to the developers
/ts metrics Displays the plugins counted metrics.
/ts reload Reload configuration files

Agreements

  • I have searched for and ensured there isn't already an open issue regarding this.
  • My version of Minecraft and TradeShop are supported by the TradeShop Dev Team (when in doubt, first ask on the Discord).

Other

While I have searched the already open issues, it was claimed to be fixed here:
#153
Since it seems to be not or the error just seems to be similar, I want to give more feedback here.

I have experience in programming and java programming, so if more information is needed, feel free to ask.

@SparklingComet
Copy link
Member

Hi there, thanks for your report. We are aware of this issue, but haven't fixed it yet (we are stretched thin at the moment). You can try to fix the newlines manually in the display-name fields and see if that works. If not, let us know.

If you manage to identify the issue and fix it feel free to open a PR, that would be extremely appreciated.

@ChristopherPS96
Copy link
Author

Hey, I don't think I'll have the time to read myself into a new code base.

But I think I narrowed down the problem. As long as the item doesn't have a display name of any kind, the saving of the trades work. Doesn't matter if it's a banner, book or anything really.

And fixing the display-name doesn't work really consistent, since it can delete the content after that.

@SparklingComet
Copy link
Member

We are aware the issue is related to the serialization of the item display name. We are currently stretched thin though, which is why it is taking time.

@lassebomh
Copy link

lassebomh commented Nov 12, 2023

I believe the trade works if a banner with the base color is set as the product, and then the custom banners are added to the chest. Not suggesting this as a solution to the error of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants