When player joins server, kick player HELP

Discussion in 'Plugin Development' started by Hawkeye111, Mar 19, 2015.

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

    Hawkeye111

    Hello, I'm making a plugin and I want to do that when a player joins my server, he gets kicked with a message that I can change. How can I do this? Any Help?
    Thanks :)
     
  2. Offline

    teej107

  3. Offline

    Hawkeye111

    I tried
    1. @EventHandler
    2. public void onPlayerJoinEvent(PlayerJoinEvent event) {
    3. event.getPlayer().
    And then I stopped because I didn't know what to do
     
  4. Offline

    Faith

    Code:
    @EventHandler
        public void onPlayerJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            p.kickPlayer(getConfig().getString("kickmessage"));
        }
     
    Hawkeye111 likes this.
  5. Offline

    Hawkeye111

    Thanks! :)
    Also, I don't know if its ok to post it here but I made a client using MCP and I don't want people to be able to join my server while using it.

    So, when I join my server with the client I created, get kicked or get an error.
    Thanks for your time :)
     
  6. Offline

    Faith

    @Hawkeye111 No problem glad I could help. You may want to add a permission or a !(p.isOp) into the plugin so you can get into the server if you need to for any reason.

    Just a thought :)
     
    Hawkeye111 likes this.
  7. Offline

    WingedMLGPro

    plz make this solved!
     
  8. That isn't the right way to kick a player on join

    Code:
    @EventHandler
    public void onLogin(PlayerLoginEvent event) {
        Player player = event.getPlayer();
        if(!player.isOp()) { //Your fancy check
            event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You're too ugly for us");
        }
    }
     
    Last edited: Apr 4, 2015
  9. Offline

    BrickBoy55

    @MaTaMoR_

    You forgot a parenthesis after the op check. ;)
     
  10. Offline

    nverdier

    @MaTaMoR_ That isn't the right way to help people.
     
  11. I wrote it at 4 am...
    BEST SPOONFEED EUW HAHAHAHA get out .
     
  12. Offline

    BrickBoy55

    @nverdier

    It will be the best if someone copies and pastes the code. All their players would be kicked for ugliness.
     
  13. Offline

    nverdier

    Well the problem is that he is doing this too often.
     
Thread Status:
Not open for further replies.

Share This Page