/command arg0 arg1 - what the player says

Discussion in 'Plugin Development' started by JellyYods, Dec 22, 2014.

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

    JellyYods

    Hello everyone im making a small minigame and I need some help using multiple lobbies, but I want the players to have the choice of saving the name of the lobby that they want. So what I need help with is

    /qw setlobby

    then the third part is the what they want to name the lobby

    so /qw setlobby map1

    I just dont know how to get map1 or whatever the player types

    CODE

    Code:
    @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label,
                String[] args) {
            Player player = (Player) sender;
            if (player.isOp() == false) {
                player.sendMessage(ChatColor.RED
                        + "You must be an operator to use this command!");
            } else {
                if(player.isOp() == true) {
                    if(label.equalsIgnoreCase("qw")) {
                        if(args[0].equalsIgnoreCase("setlobby")) {
                            if(args[1].//Get what they type)))
                        }
                    }
                }
            }
            return false;
        }
    
     
  2. Offline

    ReadySetPawn

    First you want to make sure they added a second argument, then in your lobby creation method/class, use args[1].
    If your constructor is: public Lobby(String name){...}, then for the command, make it execute: new Lobby(args[1]);
     
  3. Offline

    JellyYods

    @ReadySetPawn I did not get what you said I am making this in my main class would you like to see the whole class?
     
  4. Offline

    ReadySetPawn

    Can you show me the Lobby Manager class?
     
Thread Status:
Not open for further replies.

Share This Page