Argument contain numbers only

Discussion in 'Plugin Development' started by Gmack9872, Aug 29, 2013.

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

    Gmack9872

    Hey,
    In my plugin, I am trying to make a command that only accepts numbers as an input. For example, it would be like /bdropparty 12 or /bdropparty 125

    Here is my current code.
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("bdropparty"))
    2. if(args.length == 0){
    3. player.sendMessage("§8[§9StradLand§8] §6Usage: §c /bdropparty <numberofplayers>");
    4. }else if(args.length >= 1){
    5. String message = "";
    6. for (String part : args) {
    7. if (message != "") message += " ";
    8. message += part;
     
  2. Offline

    Ghilliedrone

  3. Offline

    The_Doctor_123

    Code:
    try
    {
    Integer.parseInt(String);
    }
    catch (Exception e)
    {
    // If not an integer
    }
     
Thread Status:
Not open for further replies.

Share This Page