FurnaceCoolEvent

Discussion in 'Plugin Development' started by Ne0nx3r0, May 16, 2012.

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

    Ne0nx3r0

    Breaking off from this thread.

    I've been playing with the FurnaceBurnEvent, which is interesting, but I've noticed it only fires when the furnace is lit, but not when it becomes unlit. Is there an event I can use to get this information?

    I noticed there is a getBurnTime() method, which could be used with a delayed task to simulate a furnace unlit event (if the furnace has become unlit at that time fire the event, otherwise the task would disregard). This seems a little kludgey though, is there a simpler way to capture this imaginary "FurnaceCoolEvent"?

    *edit* Also just in a thought experiment in occurs to me that using a delayed task would fail if the user added more fuel, I don't think the furnace fires another event when more fuel is added if it's already lit.
     
  2. Just make your own. If its good, you might just get your own code in the bukkit API :D
     
  3. Offline

    Ne0nx3r0

    I'd be happy to if I knew what to latch on to. The furnace gets turned back into an off furnace at some point, I'm just trying to figure out where that happens and if there's an event attached to it.
     
  4. FurnaceBurnEvent triggers for every burnt fuel, so yeah, you could add a task with getBurnTime() + 1 (or more just to be safe) and then in the FurnaceBurnEvent just cancel the task... if there's no more fuel, it should trigger your furnace cool event :p

    Also, be sure to hook when the furnace is destroyed as well... but it'd be easier if you just referenced the furnace (by Location would be nice) and then re-check the furnace in your event, that way you'll be sure that the furnace is there and no other player or plugin removed the furnace.
     
    ne0nx3r0 likes this.
  5. Offline

    Ne0nx3r0

    I didn't realize that, I suppose I could just do it that way... It does complicate what I want to do somewhat, since that means it will be sending more ON signals than I intended, but I suppose that's not too bad.

    I think I could get away with just checking if there is a furnace there when the delayed task runs, rather than bothering with the BlockDestroyedEvent, for my purposes anyway.

    Digi Just to verify, getBurnTime() is in ticks, correct?

    The JavaDocs are blissfully ignorant on the subject:
    http://jd.bukkit.org/doxygen/db/d19...urnace.html#ae9c9686fcda5c5a3e74bd8f672a9150d

    "Get burn time." is the description.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  6. Yes it's in ticks.
     
Thread Status:
Not open for further replies.

Share This Page