Error when I cast a block

Discussion in 'Plugin Development' started by okami35, Oct 23, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    okami35

    Hello,
    In my plugin, i want to know if the player interact with a sign. So, this my code:

    Code:
    public void onPlayerInteract (PlayerInteractEvent event) {
            if(event.hasBlock()) {
                Block block = event.getClickedBlock();
                if(block.getTypeId() == 63) {
                    Sign signe = (Sign)block;
                    String[] txt = signe.getLines();
                    event.getPlayer().sendMessage(txt[0]);
                }
            }
        }
    But When in game, I interact with a sign, i have this error:

    ClassCastException: org.getspout.spout.block.spoutcraftblock cannot be cast to org.bukkit.block.sign.

    I have spout on my server but the plugin doesn't use spoutAPI, it's strange...

    Thank you for your answers.
     
  2. ... (Sign)block.getState(); ...
     
  3. Offline

    okami35

    Thank you very much, it works perfectly.
     
Thread Status:
Not open for further replies.

Share This Page