Getting signs properly

Discussion in 'Plugin Development' started by TechGuard, Mar 6, 2011.

Thread Status:
Not open for further replies.
  1. Code:
    Sign sign = (Sign)block.getState();
    That is what I did before, but now I get the error:
    Code:
    java.lang.ClassCastException:
          org.bukkit.craftbukkit.block.CraftBlockState cannot be cast to
          org.bukkit.block.Sign
     
  2. Offline

    Afforess

    Check if block.getState() is an instanceof a sign, like this:

    if (block.getState() instanceof Sign) {
    Sign sign = (Sign)block.getState();
    }
     
  3. But what if I am sure it is a sign..
     
  4. Offline

    Afforess

    The exception above states to the contrary.
     
Thread Status:
Not open for further replies.

Share This Page