Peter200lx/yadp — Issue #2: Torch scroll attempt causing severe error
Author: Peter200lx
Created: 2012-02-16 08:25:55+00:00
State: open

The issue arises when attempting to scroll a torch (redstone or normal) that is facing up.

When in debug is enabled, the clicked.getState().getData() is causing the null pointer:
Caused by: java.lang.NullPointerException
at org.bukkit.material.SimpleAttachableMaterialData.getFacing(SimpleAttachableMaterialData.java:38)
at org.bukkit.material.SimpleAttachableMaterialData.toString(SimpleAttachableMaterialData.java:43)
at org.bukkit.material.RedstoneTorch.toString(RedstoneTorch.java:41)
at java.lang.String.valueOf(String.java:2838)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at com.github.peter200lx.yadp.ToolListener.scrollTool(ToolListener.java:108)

If debug is disabled, then data2str will cause the issue:
Caused by: java.lang.NullPointerException
at org.bukkit.material.SimpleAttachableMaterialData.getFacing(SimpleAttachableMaterialData.java:38)
at org.bukkit.material.SimpleAttachableMaterialData.toString(SimpleAttachableMaterialData.java:43)
at org.bukkit.material.RedstoneTorch.toString(RedstoneTorch.java:41)
at com.github.peter200lx.yadp.ToolListener.data2Str(ToolListener.java:175)
at com.github.peter200lx.yadp.ToolListener.scrollTool(ToolListener.java:149)

According to http://www.minecraftwiki.net/wiki/Data_values#Torches_and_Redstone_Torches ,torches of all types do not have a 0x0 data value. This needs to be investigated further, and likely a special case needs to be made for the scroll tool. However, this does not seem like it will solve the issue from when debugging is enabled.