check what text is on a sign

Discussion in 'Plugin Development' started by blackshade, Jan 6, 2011.

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



    does anyone know how to get a text from a sign in bukkit? in hmod it just was sign.getText(); But I can't find the class / function to do so in bukkit.

  2. Offline


    Maybe it isnt implemented yet. At least i cant find it in the docs ;)
  3. Offline


    yeah the sign stuff appears to be lacking, its the main thing stopping the porting of my plugin as well.
  4. Offline


    Okey, well at least I know I didn't missed something :p
  5. Offline


    Can any of the administrators say when they are going to add sign fuatures, I need it to transfer my plugin from Hmod to bukkit..
  6. Offline


    Signs appear to be working already. Sign.getLine(x) will return the text from a sign.
  7. Offline


  8. Offline


    thanks! that whas what i needed.. but how do I nget from my Block type object an Sign type object.
    I tried Sign sign = block.getState(); but I don't think that is right...
  9. Offline

    Dinnerbone Bukkit Team Member

    BlockState state = block.getState();
    if (state instanceof Sign) {
        Sign sign = (Sign)state;
    The reason for the extra step is that block can be modified by anything other than your plugin, in a different thread. You grab a state with is guaranteed to be only modified by yourself, but it may become old and won't reflect the values of the block if someone changes it after. We'll be adding different casts to the state, such as Door (isOpen()), Crops (getSize()) etc
  10. Offline


    thanks, so I wasn't that far of with my code.
    last question, i tried a listener for rightclick
     private final MyBlockListener blockListener = new MyBlockListener(this);
    PluginManager pm = getServer().getPluginManager();
    pm.registerEvent(Event.Type.BLOCK_RIGHTCLICKED , blockListener, Priority.Normal, this);
    and in an other class file where I difined MyBlockListener
    public class MyBlockListener extends BlockListener {
        private final RepairSign plugin;
        public MyBlockListener(final RepairSign plugin) {
            this.plugin = plugin;
        public void BlockRightClickedEvent(Event evt,Block block, BlockFace direction, ItemStack itemInHand, Player thePlayer ) {
    But it won't work... I also tried onBlockRightClicked, but that doesn't work...
    can someone help me with this?


    Edit I already found it
    it is just onBlockRightClicked(BlockRightClickedEvent event)
    thanks anyway

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jan 8, 2016
Thread Status:
Not open for further replies.

Share This Page