How to disconnect someone with a reason

Discussion in 'Plugin Development' started by william9518, Jan 19, 2013.

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

    william9518

    I want to be able to kick people with a 'reason'(The screen that shows up when ur kicked.) how do i modify the text there? This is possible, ive seen in lot of plugins
     
  2. Offline

    vYN

    Here: (This is from my kick command) But I guess you can just modify it to your needs.
    Code:
    Player player = (Player) sender;
                        Player target = player.getServer().getPlayer(args[0]);
                        StringBuilder sb = new StringBuilder();
                        for(int i = 1; i < args.length; i++)
                        {
                            sb.append(args[i]).append(" ");
                        }
                        String msg = sb.toString().trim();
                        if(!(target == null)){
                            target.kickPlayer("Reason: " + msg);
                            return true;
                        }else{
                            player.sendMessage("Player is not online!");
                            return true;
                        }
     
Thread Status:
Not open for further replies.

Share This Page