Get event caller?

Discussion in 'Spigot Plugin Development' started by UnlimitedNinjas, Jun 12, 2018.

  1. How do i get the event caller?
    For an example:
    public void onKick(PlayerKickEvent e) {
    e.setCancelled(true);
    // here i need the name of the person who kicked the guy
    }

    Also is there a PlayerBanEvent?
     
  2. You can't get the kicker from that event. All of the fields available in the event are listed in the javadocs. Keep in mind it may not even be a player, could have been kicked from a plugin or console command. If you really need to know, I suggest you make your own kick command and track the kicker that way.

    There is no ban event, but I think you can use the PlayerQuitEvent (or maybe KickEvent?) and check isBanned- they should be banned before leaving the server.
     
  3. Ok so i check if they are banned but how do i unban them?
    And im trying Bukkit.getBanList# and stuff for a ban command but it doesnt work
     
  4. JanTuck

    Supporter

    • Informative Informative x 1