Solved SignChangeEvent: Get Block sign is placed on

Discussion in 'Spigot Plugin Development' started by LouiDev, Jul 19, 2021.

  1. Hey,
    I was wondering, if there is a way to get the block which the sign in a SignChangeEvent is placed on?
    Something like this:
    Code (Text):
    Sign s = event.getBlock();
    Block b = s.get //the block
  2. Should be able to use getRelative?
  3. Depreciated way but still works. I am unsure of the "appreciated" way to do it.

    Code (Java):
    org.bukkit.material.Sign signData = (org.bukkit.material.Sign) block.getState().getData();
    Block attachedBlock = block.getRelative(signData.getAttachedFace());
    • Agree Agree x 1
  4. Yes it did! Thanks!