Chicken Dismount Event

Discussion in 'Plugin Development' started by The Fancy Whale, Jul 31, 2014.

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

    The Fancy Whale

    I have a plugin where you are riding an invisible chicken. I need to prevent people from getting off the chicken, How would I do this? (No, it is not VehicleExitEvent as a chicken is not a type of vehicle: http://jd.bukkit.org/dev/apidocs/org/bukkit/entity/Vehicle.html)
    Please don't spoonfeed just looking for events or ideas.
    Only possible way I could think of would have a timer running ever X number of ticks, and check if the player is riding something. If they aren't set the chickens passenger to them.
     
  2. Offline

    techboy291

    Yeah, I'm pretty sure you'd just have to use a scheduler.
     
  3. Offline

    ChipDev

    I thought there was a dismount event, am I wrong?
    Or sneakEvent
     
  4. Offline

    Konato_K

    No, the only "dismount" event is for vehicles only.
    No, the event when a player sneaks only happens after you're out of the chicken.

    As far I know you can't do this, you need to setup an scheduler.
     
  5. Offline

    ChipDev

    Well, this might be wrong.

    //On sneak
    //Cancel event
    //Mount player on chicken.
    Or use NMS
     
  6. Offline

    TheMcScavenger

    Like said before, it's called when a player sneaks, not when he presses shift to dismount.
     
  7. Offline

    ChipDev

    Never used 'Shift' in that post.
     
  8. Offline

    xize

    just use a 1 tick scheduler what iterates through a HashMap<String, Chicken> and in that scheduler check if the chicken has still a passenger if its not you can call a custom event and if cancelled mount the player on the chicken again ;-)

    the sneak event isn't 100% acurate because when a player toggles their sneak to fast in a short time that event will not always fire.
     
  9. Offline

    TheMcScavenger

    That's right, hence why I never said so. Your "on sneak" is only called when a player sneaks which he doesn't by dismounting. That's what I said.
     
    AoH_Ruthless likes this.
Thread Status:
Not open for further replies.

Share This Page