Custom event for locked chest disappearing?

Discussion in 'Plugin Development' started by oxguy3, Jul 6, 2011.

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

    oxguy3

    I am new to Bukkit modding, but I wanted to create a plugin that prevents the locked chest block from despawning, allowing it to be used in building. However, locked chests don't fire any BlockEvent (as far as I can tell anyway), so I would have to write a custom event for them. When I tried to do this, I realized I didn't even know where I would look to figure out how to create a custom event.

    Does anyone have any advice on how I might go about creating this custom event? Thanks!
     
  2. Offline

    darklust

    Code:
    void onBlockFade(BlockFadeEvent event)
    It's a method of BlockListener that may trigger when you punch a locked chest. Then you can cancel the event.
     
  3. Offline

    oxguy3

    I already tried BlockFade, and it doesn't fire for locked chests

    Anyone else know how I might do this? I've spent a few hours just scanning through all the classes in the CraftBukkit jar (since I couldn't find anything in the Bukkit Javadocs) and am still drawing a blank. Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  4. Offline

    bleachisback

    I do believe that it fires off LeavesDecayEvent. Just check that the block that is decaying is a locked chest and setCancelled
     
  5. Offline

    oxguy3

    Seriously, a locked chest is a decaying leaf block? I probably should have tested that, but it didn't make any sense. If this works, you win a diamond, bleachisback.
     
  6. Offline

    oxguy3

    Shoot, it didn't work; no LeavesDecayEvents went off when locked chests were disappearing. Any other ideas on how I can do this?
     
  7. Offline

    Hretsam

    I think its onBlockPhysics
     
  8. Offline

    Regicidal

    I would realy like this plugin if you made it possible, because then I could use locked chests for many reasons. I am supporting this idea, but I don't know anything about coding lol.
     
  9. Offline

    Windwaker

    Locked chests were removed from the game to my knowledge, they were an april fools joke.
     
  10. Offline

    iffa

    Removed? They're there, they just disappear.
     
  11. Offline

    Windwaker

    I'm confused now...
     
  12. Offline

    iffa

     
  13. Offline

    oxguy3

    I don't think it's going to be all that possible, unless there have been some relevant code changes in Bukkit since I last tried to. You could have something that constantly checked that locked chests were still there, but that would be kinda lag-enducing, especially if you had a lot of locked chests. Also, because of this, this mod wouldn't be quite so useful.

    We're not talking about locking chests so that other people can't open them. We're talking about block ID 95, which was used for an April Fools Joke by Mojang. You can read about it here: http://www.minecraftwiki.net/wiki/Locked_Chest

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  14. Offline

    Regicidal

    Hm, mabey try comparing the coding from the april fools update locked chests and the current minecraft version locked chests.
     
Thread Status:
Not open for further replies.

Share This Page