rutgerkok / BetterEnderChest

Spigot plugin that adds functionality for both players and admins to the Ender Chest.
http://www.spigotmc.org/resources/betterenderchest.2073/
Other
14 stars 10 forks source link

Better Barrels Internal Server Error #6

Closed devryb closed 9 years ago

devryb commented 9 years ago

Found another issue, if we store a barrel thats been picked up by a dolly into the chest (From the better barrels/JABBA mod). When you try to remove it from the echest and place it after you get an internal server error.

This is what spams my client log from it: http://pastebin.com/EpTdSqek

This is what shows in the database. {"Inventory":[{"id":5366,"Damage":0,"Count":1,"tag":{"Container":{"TEClass":"mcp.mobius.betterbarrels.common.blocks.TileEntityBarrel","Meta":0,"NBT":{"orientation":2,"sideUpgrades":[0,0,1,0,0,0],"creative":0,"nStorageUpg":0,"void":0,"sideMeta":[0,0,0,0,0,0],"structural":0,"coreUpgrades":[],"bspaceid":507,"hopper":0,"version":5,"id":"TileEntityBarrel","rotation":2,"redstone":0,"nticks":0,"ticking":0,"linked":0,"z":202,"ender":0,"y":96,"storage":{"amount":64,"upgCapacity":0,"current_item":{"id":3388,"Damage":2,"Count":0},"maxstacks":64},"x":2},"isSpawner":0,"Block":"JABBA:barrel"}},"Slot":0}],"DisabledSlots":0,"Rows":3,"OwnerName":"devryb"}

devryb commented 9 years ago

This also happens with chests being moved with a dolly so seems to be something with how that item stores the data I guess

rutgerkok commented 9 years ago

Ouch, this one is difficult to fix. After cleaning up the error it looks like this:


javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (<Unknown Source>#1) in <Unknown Source> at line number 1
 at com.sun.script.javascript.RhinoScriptEngine.eval (Unknown Source)
 at com.sun.script.javascript.RhinoScriptEngine.eval (Unknown Source)
 at javax.script.AbstractScriptEngine.eval (Unknown Source)
 at me.exz.wailanbt.configuration.config.loadConfig (config.java:64)
 at me.exz.wailanbt.configuration.config.init (config.java:47)
 at me.exz.wailanbt.configuration.ConfigEvent.onPlayerJoinWorld (ConfigEvent.java:15)
 at cpw.mods.fml.common.eventhandler.ASMEventHandler_546_ConfigEvent_onPlayerJoinWorld_EntityJoinWorldEvent.invoke (.dynamic)
 at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke (ASMEventHandler.java:54)
 at cpw.mods.fml.common.eventhandler.EventBus.post (EventBus.java:138)
 at net.minecraft.world.World.func_72838_d (World.java:1334)
 at net.minecraft.client.multiplayer.WorldClient.func_72838_d (WorldClient.java:159)
 at net.minecraft.client.Minecraft.func_71353_a (Minecraft.java:2220)
 at net.minecraft.client.Minecraft.func_71403_a (Minecraft.java:2135)
 at net.minecraft.client.network.NetHandlerPlayClient.func_147280_a (NetHandlerPlayClient.java:868)
 at net.minecraft.network.play.server.S07PacketRespawn.func_148833_a (SourceFile:32)
 at net.minecraft.network.play.server.S07PacketRespawn.func_148833_a (SourceFile:13)
 at net.minecraft.network.NetworkManager.func_74428_b (NetworkManager.java:212)
 at net.minecraft.client.multiplayer.PlayerControllerMP.func_78765_e (PlayerControllerMP.java:273)
 at net.minecraft.client.Minecraft.func_71407_l (Minecraft.java:1591)
 at net.minecraft.client.Minecraft.func_71411_J (Minecraft.java:962)
 at net.minecraft.client.Minecraft.func_99999_d (Minecraft.java:887)
 at net.minecraft.client.main.Main.main (SourceFile:148)
 at sun.reflect.Nat iveMethodAccessorImpl.invoke0 (Native Method)
 at sun.reflect.Nat iveMethodAccessorImpl.invoke (Unknown Source)
 at sun.reflect.Delegat ingMethodAccessorImpl.invoke (Unknown Source)
 at java.lang.reflect.Method.invoke (Unknown Source)
 at net.minecraft.launchwrapper.Launch.launch (Launch.java:135)
 at net.minecraft.launchwrapper.Launch.main (Launch.java:28)
Caused by: sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (<Unknown Source>#1)
 at sun.org.mozilla.javascript.internal.DefaultErrorReporter.runtimeError (Unknown Source)
 at sun.org.mozilla.javascript.internal.DefaultErrorReporter.error (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.addError (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.addError (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.reportError (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.reportError (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.reportError (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.autoInsertSemicolon (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.statementHelper (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.statement (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.parse (Unknown Source)
 at sun.org.mozilla.javascript.internal.Parser.parse (Unknown Source)
 at sun.org.mozilla.javascript.internal.Context.compileImpl (Unknown Source)
 at sun.org.mozilla.javascript.internal.Context.compileReader (Unknown Source)
 at sun.org.mozilla.javascript.internal.Context.compileReader (Unknown Source)
 at sun.org.mozilla.javascript.internal.Context.evaluateReader (Unknown Source)
... 28 more

The error has no information in it that may help to fix the error. It could be anything in BetterEnderChest that causes this. It seems the mod me.exz.wailanbt is executing a script the server sent on the computer of the player. I suspect that the server sent an invalid script due to an NBT tag that was corrupted by BetterEnderChest.

Sending a script based on an item NBT tag is a bad idea. This gives anyone who is in creative mode the ability to execute arbitrary programs on the client...

devryb commented 9 years ago

The client log might not have been the best thing to give, the server actually puts this in the log as well which I guess I missed before. Not sure if this helps

net.minecraft.util.ReportedException: Reading NBT data at net.minecraft.nbt.NBTTagCompound.func_74759_k(SourceFile:204) ~[dh.class:?] at mcp.mobius.betterbarrels.common.blocks.BarrelCoreUpgrades.readFromNBT(BarrelCoreUpgrades.java:383) ~[BarrelCoreUpgrades.class:?] at mcp.mobius.betterbarrels.common.blocks.TileEntityBarrel.func_145839_a(TileEntityBarrel.java:499) ~[TileEntityBarrel.class:?] at mcp.mobius.betterbarrels.common.items.dolly.ItemBarrelMover.placeContainer(ItemBarrelMover.java:365) ~[ItemBarrelMover.class:?] at mcp.mobius.betterbarrels.common.items.dolly.ItemBarrelMover.onItemUseFirst(ItemBarrelMover.java:151) ~[ItemBarrelMover.class:?] at net.minecraft.server.management.ItemInWorldManager.func_73078_a(ItemInWorldManager.java:436) ~[mx.class:?] at net.minecraft.network.NetHandlerPlayServer.func_147346_a(NetHandlerPlayServer.java:875) ~[nh.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:60) ~[jo.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.func_148833_a(SourceFile:9) ~[jo.class:?] at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:244) ~[ej.class:?] at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:173) [nc.class:?] at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:980) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423) [lt.class:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.7.0_71] Caused by: java.lang.ClassCastException: net.minecraft.nbt.NBTTagList cannot be cast to net.minecraft.nbt.NBTTagIntArray at net.minecraft.nbt.NBTTagCompound.func_74759_k(SourceFile:202) ~[dh.class:?] ... 15 more [08:15:27] [Server thread/INFO]: devryb lost connection: Internal server error [08:15:27] [Server thread/INFO]: devryb left the game.

rutgerkok commented 9 years ago

The server side error is much more useful indeed. Seems like the mod BetterBarrels expects an int array, but gets a list. Both are represented as [] in the JSON format. I have made the JSON reader to skip empty lists, which has the nice effect of the NBTTagCompound code automatically returning the correct list for the mod.

Download for 1.7.10 Changed code

Please let me know whether this fixes the issue.

devryb commented 9 years ago

Thanks! This fixed the issue nicely.