Stopping signs breaking

Discussion in 'Plugin Development' started by Nogtail, Aug 13, 2014.

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

    Nogtail

    I have a plugin that uses signs (think I need an originality award...) and I plan to have some basic protection on them. I need an event that is called when a sign "decays" so I can cancel it. The only alternative I can see is to listen to every event that could remove a block and check if a sign depends on it then cancel the event.
     
  2. Offline

    RenditionsRule

    Nogtail I would say to call a "BlockBreakEvent" and check if "event.getBlock().getState()" is the instance of a Sign. From there you can cancel the event of the sign breaking. I am sure there is other events that involve block breaking but this is what I would use.
     
  3. Offline

    Gater12

    Nogtail
    Could also check blocks relative to the block broken to see if there's a sign that is supported by it.
     
  4. Offline

    Nogtail

    RenditionsRule Gater12 I am checking relative blocks but currently that means every time a block breaks I have to check adjacent blocks and perform a heap of lookups just to see it it is a protected sign. Block break event is only when players break blocks, if it an explosion or a leaf decaying or a block burning then it is not called, and if I was to check every event that could destroy a block then I would have to listen to 8 or 9 events and run expensive checks on all of them.
     
  5. Offline

    thijs_a

    I think thats the best thing
     
Thread Status:
Not open for further replies.

Share This Page