Kick plugin [HELP]

Discussion in 'Plugin Development' started by NB5921, Mar 8, 2015.

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


    Hello everyone. So, I am really new to plugin development and don't have a clue what to do here: can someone help me please? I want it so when people do the command "/nbkick <player> <reason>" it broadcasts to all the Staff Members "<player> has been kicked by <player> for <reason>". I will appreciate anyones help!
  2. Hello, what you are doing wrong is that the BukkitAPI doesn't have a player meathod "kickPlayer()".

    There is "kickPlayer("Reason");

    I will not spoonfeed you code also. Try learning the Bukkit API from decompiling other plugins, or learning Java from oracles website, instead of learning Java FROM Bukkit.
    Last edited: Mar 8, 2015
  3. Offline


    You can use:
    Player p;
  4. Offline


    The reason you are getting that error is because the method 'kickPlayer' requires a string parameter for a message the player will receive when they are kicked.

    p.kickPlayer("You have been kicked for " + reason);
    There are also many things you are doing wrong there, at the moment you are trying to kick the player who executes the command. Try getting the arguments and kicking a target player. You may want to use a StringBuilder to build a reason too, a sample piece of code is shown below:

    StringBuilder sb = new StringBuilder();
    for(int i = 1; i < args.length; i++) {
    sb.append(args[i] + " ");
    String reasonToKick = sb.toString().trim();
    Last edited: Mar 8, 2015
    OfficerDeveloper likes this.
Thread Status:
Not open for further replies.

Share This Page