Execute Command

Discussion in 'Plugin Development' started by edocsyl, Aug 5, 2012.

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

    edocsyl

    Hi

    I wanna execute a command with an other command/action or something else.

    An example:
    I execute the command "/20dirt" then ist should execute "/give edocsyl 2 20"
     
  2. Offline

    aciid

    Code:
    if(command.getName().equalsIgnoreCase("20dirt")) {
                  Bukkit.getServer().dispatchCommand(player, "give " + player.getName() + " 2 20");
    }
    
    Or better:
    Code:
    if(command.getName().equalsIgnoreCase("dirt")) {
                    if(args.length > 0) {
                        Bukkit.getServer().dispatchCommand(player, "give " + player.getName() + " 2 " + args[0]);
                    } else { player.sendMessage("Ā§cUsage: /dirt <amount>"); }
                }
    
     
  3. Offline

    edocsyl

    very nice, thanks
     
Thread Status:
Not open for further replies.

Share This Page