Hi. When im using this:
public class ButtonEvent implements Listener
{
@EventHandler
public void onButton(PlayerInteractEvent e)
{
if (e.getClickedBlock().getType() == Material.STONE_BUTTON)
{
Button button = ((Button) e.getClickedBlock().getState().getData());
Block block = e.getClickedBlock().getRelative(button.getAttachedFace());
if (block.getType().equals(Material.SPONGE))
{
RandomTeleportUtil.randomTeleport(e.getPlayer());
}
}
}
}
It works with no problem, but, it gives a null error: https://www.toptal.com/developers/hastebin/erijojekaq.rb
It shows line 16, the first if, but event when i remove it, error doesn't goes away, and shows same line, 16