Could not pass Event to SignChangeEvent

Discussion in 'Spigot Plugin Development' started by GnRDevelopment, Jul 27, 2018.

  1. You need to get the state of the block and then check if that state is an instance of Sign (org.bukkit.block.Sign), then you can create the sign object and modify/read the sign to your needs.
     
    • Useful Useful x 1
  2. "java.lang.ClassCastException: org.bukkit.material.Sign cannot be cast to org.bukkit.block.Sign"
    You are castign an instance of material.Sign to block.Sign... Make sure you are casting/using the right class
     
  3. I've managed to fix the previous error, but now I get this:

    Error: https://hastebin.com/ruqinosuto.cs

    Code: https://hastebin.com/newisasolo.cs

    The line of code given in the error corresponds with what direction I place the sign
     
  4. Can you give line 28
    You're using a block as a location, that's all it says. You should really be able to read stack traces and fix it yourself.
     
  5. Code (Java):
    behind = (Block) sign.getLocation().add(0, 0, -1);
     
  6. Exactly.. sign.getLocation().add(0, 0, -1); returns a location
     
    • Agree Agree x 1
  7. so you should know how to fix it