Spigot-6c9b0a1-de5c261 (MC: 1.8.8)
Trapped Chests cannot be cast to directional or directional containers.
(This code will only throw an error for Trapped Chests but will work for normal chests and ender chests)
Block block = event.getBlock();
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.ENDER_CHEST)
DirectionalContainer chest = (DirectionalContainer) block.getState().getData(); //error thrown here on trapped chests