Setting triggers for custom events

Discussion in 'Plugin Development' started by Mike111177, Jun 8, 2012.

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

    Mike111177

    I'm trying to make two custom events. One that fires when someone first puts their head under water and one when they exit the water. How do i do this?
     
  2. Do you really need an event for this?
     
  3. Offline

    caldabeast

    I would personally like having that event :3
     
  4. Offline

    Mike111177

    Yes
     
  5. Offline

    Darq

    Well I've never done a custom event before - so I decided I'd try this. The wiki made it seem simple enough. This is what I came up with:

    https://dl.dropbox.com/u/68028044/WaterEvents.zip
    That package contains both entering and leaving water events, and a listener to listen for them - as an example. The main class contains the player move event that actually calls both the custom event.

    Tested very briefly, you'll want to clean up the onPlayerMove event that I use to check when they're entering/leaving water. But this shows you how to create, call, and listen to a custom event.
     
  6. Darq : Extending the PlayerEvent would require a bit less code :p
     
Thread Status:
Not open for further replies.

Share This Page