Solved Get which block a wall sign is at?

Discussion in 'Plugin Development' started by Bobfan, Dec 3, 2012.

  1. Offline

    Bobfan

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    What method is used to find the block a wall sign is located on? I've tried using Sign s; but I don't know how to initialize it.
  2. Offline

    Tirelessly

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    What's the context?
  3. Online

    evilmidget38 BukkitDev Staff BukkitDev Staff

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    First you need to do some sort of check to make sure your sign is a block. You can check the material, the id, whatever floats your boat. Then you can cast the Block's BlockState (Block.getState()) to a Sign.

    Example:
    Code:
    Block b = someBlockOfYourChoice;
    if (b.getState() instanceof Sign) {
        Sign s = (Sign) b.getState();
        //Do what you want with your sign.
    }
  4. Offline

    Bobfan

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thank you. If you don't check it and it isn't a sign, than it'll show an error

Share This Page