Solved Why isn't the text showing up on the sign?

Discussion in 'Spigot Plugin Development' started by Azmidium, Dec 12, 2015.

  1. So I currently have the code below:

    Code (Text):

    BlockState bs = e.getBlock().getState();
    Sign sign = (Sign) bs;
    sign.setLine(0, ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("sign-settings.prefix")));
    e.getPlayer().closeInventory();
    bs.update();
    I have tried moving around the BlockState updater, but all I get is the text quickly flashing on the sign and vanishing. Why is that? If you need more code don't hesitate to ask.
     
  2. This happened to me aswell... whats happening is that befor ethe sign is placed your setting the text and then the sign is being updated to what it should have on it after it is placed, they should fix this but for a temporary fix i found creating a scheduled task that executes half a second after the sign is placed will fix this
     
  3. Thanks for helping me out man! :D
     
  4. Well 3 hours of me frustated with issue didnt go to waste i guess
     
    • Winner Winner x 1
  5. I didn't think delaying would work because I would think the BlockPlaceEvent would fire when the block is placed. You know?
     
  6. Nope, doesnt work that way with signs apparently... well when the BLOCK is placed the block place event is called, and in the order spigot or bukkit does things is the block is placed then the sign is updated, meaning if you change the sign on the placement of it it will ultimately be overriden by the sign updating the spigot/bbukkits stamdards if you would say
     
  7. What I ment was, you would think that if you place a Block, it would be placed by the time the event is fired. I am not saying that is what happens, I am just saying you would think.
     
  8. And I forgot to sum up my post, a sign is not a block, well the text on it isn't anyway that's why the text is updated on SignUpdateEvent ;)