GeorgH93 / Minepacks

Free and reliable backpack plugin for Bukkit/Spigot/Paper
https://www.spigotmc.org/resources/19286/
GNU General Public License v3.0
170 stars 75 forks source link

Backup & Restore nbt bug #325

Closed yPedroDev closed 3 months ago

yPedroDev commented 3 months ago

Hello, would there be a way to fix this? When I enter the server, all my items and those of the players are simply reset. I end up getting this message when I try to restore:

[02:31:58 INFO]: yPedroDev issued server command: /bp restore yPedroDev_dab21994ec104c31ae4672124dd07a43_1718759564925 [02:31:58 ERROR]: [Minepacks] Failed to deserialize NBTItemStack net.minecraft.nbt.ReportedNbtException: Loading NBT data at net.minecraft.nbt.NbtIo.readTagSafe(NbtIo.java:416) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.NbtIo.readUnnamedTag(NbtIo.java:404) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.NbtIo.read(NbtIo.java:334) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.NbtIo.read(NbtIo.java:324) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks.Bukkit.ItemStackSerializer.NBTItemStackSerializer_1_20_R4_Paper.deserialize(NBTItemStackSerializer_1_20_R4_Paper.java:63) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Database.InventorySerializer.deserialize(InventorySerializer.java:81) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Database.Files.readFile(Files.java:168) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Database.Database.loadBackup(Database.java:157) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Command.RestoreCommand.restore(RestoreCommand.java:86) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Command.RestoreCommand.execute(RestoreCommand.java:74) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Command.RestoreCommand.execute(RestoreCommand.java:38) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.API.MinepacksCommand.doExecute(MinepacksCommand.java:129) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.API.MinepacksCommand.doExecute(MinepacksCommand.java:38) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks.Bukkit.Command.CommandExecutorWithSubCommandsGeneric.onCommand(CommandExecutorWithSubCommandsGeneric.java:39) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.Bukkit.Command.CommandManager.onCommand(CommandManager.java:118) ~[Minepacks.jar:?] at Minepacks.jar/at.pcgamingfreaks.MinepacksStandalone.libs.at.pcgamingfreaks.Bukkit.Command.RegisterablePluginCommand.execute(RegisterablePluginCommand.java:157) ~[Minepacks.jar:?] at io.papermc.paper.command.brigadier.bukkit.BukkitCommandNode$BukkitBrigCommand.run(BukkitCommandNode.java:91) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:30) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:13) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:456) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.Commands.performCommand(Commands.java:363) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.Commands.performCommand(Commands.java:350) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.commands.Commands.performCommand(Commands.java:345) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2282) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$18(ServerGamePacketListenerImpl.java:2256) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1546) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:195) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1523) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1446) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1412) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1273) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:326) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?] Caused by: java.io.IOException: Invalid tag id: 31 at net.minecraft.nbt.TagType$1.createException(TagType.java:38) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.TagType$1.load(TagType.java:43) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.TagType$1.load(TagType.java:36) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] at net.minecraft.nbt.NbtIo.readTagSafe(NbtIo.java:410) ~[purpur-1.20.6.jar:1.20.6-2233-0d6766e] ... 41 more

the same error happens when the player enters the server, my server has a lot of people, and I have to resolve this orgently.

GeorgH93 commented 3 months ago

Update to 2.4.31.1, then only the problematic item should be missing, and its JSON should be printed in the log.

yPedroDev commented 3 months ago

The error starts to appear when I start using version 2.4.31.1

yPedroDev commented 3 months ago

I can't use older versions, I've already tried but the plugin gives another error and ends up being disabled

GeorgH93 commented 3 months ago

Can you send me that backup file?

JustSimplyGaming commented 3 months ago

I have the same issue. Luckly only 4 of over 50 people joined since the automatic Update. I set my server under maintenance, so no backpack can be override. I tried to install an older Version of the last days, but still have the same error: [Minepacks] Failed to deserialize NBTItemStack No backup matching Cily30_dca098c7c98d4c0cbdfd3bdbb35385cf_1718785862724

But the file is in the Backup folder

GeorgH93 commented 3 months ago

I have the same issue. Luckly only 4 of over 50 people joined since the automatic Update. I set my server under maintenance, so no backpack can be override. I tried to install an older Version of the last days, but still have the same error: [Minepacks] Failed to deserialize NBTItemStack No backup matching Cily30_dca098c7c98d4c0cbdfd3bdbb35385cf_1718785862724

But the file is in the Backup folder

Can you please send me that file.

Also, what is the output of /version.

JustSimplyGaming commented 3 months ago

Cily30_dca098c7c98d4c0cbdfd3bdbb35385cf_1718785862724.zip Current Purpur Version: 1.20.6-2227-79d199c (MC: 1.20.6)*

Pluign Version is now 2.4.31.2

JustSimplyGaming commented 3 months ago

But this happens with every Backupfile.

GeorgH93 commented 3 months ago

Could you give this build a try. With it, I was able to restore your backup file.

JustSimplyGaming commented 3 months ago

On the frist look, it looks good. Players that didnt joined before the Update, have the backpacks as saved.

GeorgH93 commented 3 months ago

Sounds good. For the ones that have joined since the update, you should be able to restore their backpack with the /backpack restre command

JustSimplyGaming commented 3 months ago

I have multiple feedbacks now. Everything works fine now. Thanks for the Update :) BTW. this version works on 1.21 to :D

yPedroDev commented 3 months ago

Invalid tag id: 31 <= Is this any indication of the problem?

GeorgH93 commented 3 months ago

There is no tag id 31 The new version was just not handling compressed backpacks correctly. But that should be fixed with 2.4.31.3

yPedroDev commented 3 months ago

Ok, there's just one problem, when players who had items enter the server, they will lose their items, yesterday I recovered my items manually, today I updated to the version you showed to update, when I went to test with my secondary account and my original , the items ended up being reset, but now the backup system works normally and the error also stopped happening, but I don't have a backup for all the players, just some, would it be possible to load the items without this having to happen? I looked in the database, and saw that the old players' items are still there, but when they enter the server they end up being reset.

GeorgH93 commented 3 months ago

I would expect v2.4.31.3 to load everything correctly, if that is not the case, please send me the backup file that was created for that case.

yPedroDev commented 3 months ago

did you mean the .backpack files? or backpack.db?

yPedroDev commented 3 months ago

If you meant the .backpack files then, I will only be able to give one file because the others ended up being deleted because I thought they were corrupt, when I tried to restore the backups it said No "backup name here" matching.

GeorgH93 commented 3 months ago

Yes, please give me the backpack file. If you still have an issue opening old backpacks in 2.4.31.3, there should be newly created ones anyway.

yPedroDev commented 3 months ago

archive-2024-06-19T120515-0300.tar.gz

GeorgH93 commented 3 months ago

Loads fine for me. Can you please double-check that you are actually on v2.4.31.3 (/bp version)

yPedroDev commented 3 months ago

Ok, I realized that it seems to fix it, when I have problems I open another github issue. Thank you for your help

yPedroDev commented 3 months ago

I tried it with another player and it loaded without any problems.