Kick on join

Discussion in 'BungeeCord Plugin Development' started by Arjan, Jul 15, 2017.

  1. Hello, I know the title is slightly misleading as the problem is slightly more complicated than the title makes it look. But I'm trying to kick a player whilst in the pre-login state. This is, however, harder than it might seem as I can just about grab the username but not kick him as the player is technically not yet in the server.

    The situation is that I am loading commands from a configuration file which may look like the following:
    command: kick notch I don't like you
    I'm using the dispatchCommand function for this which looks like this:
    getServer().dispatchCommand(Bukkit.getConsoleSender(), cmd);

    Anyone has an idea on how to tackle this issue? I don't want to wait until the loginevent because I want it all done as soon as possible, hence the prelogin choice.
  2. You should check if there is a kick command in the config

    If so remove the kick and name, the rest will be the reason.
    Then do
    Event#disallow(PlayerPreLoginEvent.Result.KICK_OTHER, reason);
    • Useful Useful x 2
  3. That does serve its purpose and it seems like the best way to go about it.
    • Agree Agree x 1
    • Friendly Friendly x 1