SpoutDev/Spout — Issue #1641: Bukkit Plugins completely misreading block types
Author: AgentME
Created: 2012-02-22 07:02:20+00:00
State: open

This is weird. I'm not sure if this is caused by Spout, but I'm suspicious as an exception I saw had Spout in the stacktrace and some stuff about reflection, which I'm pretty sure is heavily used by Spout. This could also just be Craftbukkit.

It started a few days ago when I noticed that LWC was logging about "corrupted protections" it was removing. LWC stores the locations of blocks that are protected and the blocks' types among other things. Apparently it occasionally checks the locations of protected blocks and verifies that the world has the same type of block at that location as it remembers. If it has a protected chest recorded at a location, and then it checks that spot and sees air instead, it logs that it's removing a corrupted protection and logs the location and the expected block type.

Except when I checked the locations it was removing protections from, I was finding the block LWC was expecting. LWC was mistakenly killing its own protections it seemed like. A few minutes ago, I got a message about a corrupted protection being removed, and I immediately teleported my player to the coordinates. I found the chest in question, which was no longer protected. I typed "/cinfo" and punched the chest, and then LWC told me "That Thin_glass was not registered!". LWC thought the chest was a block of thin glass? Interacting with another chest in the area caused LWC to inform me that it thought the chest was made of Air blocks. Running /cinfo and punching floor blocks around got wildly wrong results in an area at least a dozen blocks wide around the chests. [Some relevant screenshots](https://imgur.com/a/XN69T)

I figured it was some ridiculous LWC bug, except that when I tunnelled through a wall nearby, I found random ore blocks faked by [Orebfuscator](http://dev.bukkit.org/server-mods/orebfuscator/), which didn't disappear as they were supposed to. I think Orebfuscator may have thought the tunnel I just carved out was still filled in. And then during all of this I got an exception from PhysicalShop, which appears to have been caused by it thinking a sign was placed above a chest, and then it failed to read the lines off of the possibly non-existent sign:

06:16:01 [SEVERE] Could not pass event org.bukkit.event.block.BlockPhysicsEvent to PhysicalShop
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1026)
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:61)
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460)
at net.minecraft.server.World.k(World.java:522)
at net.minecraft.server.World.applyPhysics(World.java:506)
at net.minecraft.server.World.update(World.java:471)
at net.minecraft.server.World.setTypeId(World.java:443)
at net.minecraft.server.BlockStem.a(SourceFile:52)
at org.getspout.spout.block.mcblock.CustomStem.a(CustomStem.java:170)
at net.minecraft.server.World.k(World.java:2002)
at net.minecraft.server.World.doTick(World.java:1752)
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:524)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:435)
at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.bukkit.plugin.java.JavaPluginLoader$103.execute(JavaPluginLoader.java:1024)
... 13 more
Caused by: java.lang.NullPointerException
at org.bukkit.craftbukkit.block.CraftSign.getLines(CraftSign.java:20)
at com.wolvereness.physicalshop.ShopHelpers.getShop(ShopHelpers.java:118)
at com.wolvereness.physicalshop.ShopHelpers.getShops(ShopHelpers.java:140)
at com.wolvereness.physicalshop.ShopHelpers.isBlockDestroyable(ShopHelpers.java:158)
at com.wolvereness.physicalshop.PhysicalShopListener.onBlockDestroyed(PhysicalShopListener.java:67)
at com.wolvereness.physicalshop.PhysicalShopListener.onPhysics(PhysicalShopListener.java:144)
... 17 more

I restarted the server and everything seemed to be working fine. LWC was seeing the blocks right and Orebfuscator wasn't acting up, etc. I imagine this will probably happen again sometime randomly.

I'm running Craftbukkit 1.1-R4, and SpoutPlugin compiled from git commit 21afb1dc3ef113820f9d18c5ede300c2e94cf404.