Ban reason?

Discussion in 'Plugin Development' started by Zachary_Peculier, Jul 28, 2014.

Thread Status:
Not open for further replies.
  1. This should probably be alot easier but I can't seem to figure it out. I'm not sure how to get a reason into my ban message. I'm at the point where if I do /ban <player> reason, it bans the kid and the message says: You were banned from the server for... But I'm not sure how to put that <reason> into it.
     
  2. Offline

    xTigerRebornx

  3. Offline

    Starfire1337

    Zachary_Peculier
    Are you making a plugin or requesting help with one?

    If your making one, you could string them together by something like
    Code:
    String reason = "";
    for (String a : args) {
        reason = reason + a + " ";
    }
    
     
  4. Could you maybe help me by looking at my code and show me what needs to be done.
    Code:
            if(commandLabel.equalsIgnoreCase("ban"))
            {
                if(player.hasPermission("xenonmain.ban"))
                {
                    if(args.length == 0)
                    {
                        player.sendMessage(ChatColor.DARK_RED + "WHAT, SOMEONE DID SOMETHING BANNABLE, WHO WAS IT? WHO NEEDS TO FEEL THE SHAME?!?!?!?!?!?!!?");
                    }
                    else
                    {}
                    if(args.length == 1)
                    {
                       
                        player.sendMessage(ChatColor.DARK_RED + tplayer.getName() + "HAS BEEN SHAMED, but he can't be banhammered for nothing. Why should he feel shame?");
                    }
                    else
                    {}
                    if(args.length >= 2)
                        tplayer.setBanned(true);
                        player.sendMessage(ChatColor.DARK_PURPLE + "You banned " + tplayer.getName());
                        tplayer.kickPlayer(ChatColor.RED + "You were banned from the server for " );
                        Bukkit.broadcastMessage(ChatColor.GRAY + tplayer.getName() + " was banned from the server");   
                    }
                }
    Bump?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  5. Offline

    myminecrafter01

    Zachary_Peculier Can you post the entire class? There are a few variables which may have been declared before the snippet of code you posted, but I can't be sure unless you post the entire class.
     
  6. UPDATE: I have figured all of this out except I can't ban offline players, nor will the ban reason stay there when they try rec-connecting. It will go back to the default message.
     
  7. Offline

    Starfire1337

    Zachary_Peculier
    Your not actually setting a ban reason, your just kicking a player with the ban reason.
     
Thread Status:
Not open for further replies.

Share This Page