Fake Event

Discussion in 'Spigot Plugin Development' started by Boybuscus, Jun 17, 2018.

  1. Hello spigot, i really dont know anything about this situation and ive been trying to do a fake event.
    Here is my code for "fake event"
    Code (Text):
     new PlayerAnimationEvent(player);
    i only read spigot's events so, i really have no idea how to force an event but the thing is my code at least doesnt work.
    Any idea to get it work? Thanks!
  2. a bump message.
  3. To call an event for a player you use the callEvent method if the event is registered through Spigots event system. Post a snippet of your code so I can take a look.
  4. You misunderstand what events are. An event fires when something happens to inform other things it happened. Calling an event yourself does not make that thing happen.

    Example: Wolf comes into town. Boy cries "wolf!" People react.

    If you just cry out "wolf!" that doesn't force the wolf into town. It just makes people react.

    Just because you call the player animation event, doesn't make the player animate. It just makes any plugin listening to that event react.

    • Funny Funny x 1
    • Winner Winner x 1
    • Friendly Friendly x 1
  5. To fake such an event for other players, send the right packets to the other players (which packets depends on what you want to do, of course, looking at the MC/Spigot source will tell you).
  6. Thanks a lot, those examples really helped me, cheers!