Solved [Spigot / Bungee] Cancel player connection

Discussion in 'Spigot Plugin Development' started by TheAslera, May 30, 2016.

  1. Hi, for my plugin I need to cancel player connection.
    I found this for Spigot:
    Code (Text):
    public void onAsyncPreLogin(AsyncPlayerPreLoginEvent event) {
    event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, ("Kick msg"));
    and this for Bungee:
    Code (Text):
    public void onPreLogin(PreLoginEvent event) {
    event.setCancelReason("Kick msg");
    But none of them work.
    Any idea :) ?
    • Winner Winner x 1
  2. Code (Text):
    public void onKick(PlayerKickEvent e) {
  3. Or add e.setCancellead(true)?
    • Agree Agree x 1
    • Winner Winner x 1
  4. It still doesn't work :/
  5. yeah I agree with this one, just play around with setCancelled. :)
  6. Put the EventHandler annotation above the method, and register your events
  7. Are you sure you registered your events?
    Ninjaed by megam
  8. I already did that
  9. @TheAslera
    • Winner Winner x 1
  10. It solved my problem!
    It's one of my first plugins, thanks for helping :)
    • Like Like x 1