title: How can I make my code return a "Invalid number" message to a player if they type /launch <notaninteger> or /launch String
body: <pre><code>
  import org.bukkit.ChatColor;
  import org.bukkit.command.Command;
  import org.bukkit.command.CommandExecutor;
  import org.bukkit.command.CommandSender;
  import org.bukkit.entity.Player;
  
  
  public class launch implements CommandExecutor {
      @Override
      public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
          if (label.equalsIgnoreCase(&quot;launch&quot;) || label.equalsIgnoreCase(&quot;l&quot;)) {
              if (!(sender instanceof Player)) {
                  sender.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;4Invalid Entity&quot;));
                  return true;
              }
              Player player = (Player) sender;
              //Does /launch or /launch &lt;amplifier&gt;
              if (args.length == 0) {
                  player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;a3&quot;));
                  try {
                      Thread.sleep(1000);
                      player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;62&quot;));
                  } catch (InterruptedException e) {
                      System.err.println(e.getMessage());
                  }
                  try {
                      Thread.sleep(1000);
                      player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;c1&quot;));
                  } catch (InterruptedException e) {
                      System.err.println(e.getMessage());
                  }
                  player.setVelocity(player.getLocation().getDirection().multiply(2).setY(1.5));
                  return true;
              }
  
  
              //Launch but with args
              player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;a3&quot;));
              try {
                  Thread.sleep(1000);
                  player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;62&quot;));
              } catch (InterruptedException e) {
                  System.err.println(e.getMessage());
              }
              try {
                  Thread.sleep(1000);
                  player.sendMessage(ChatColor.translateAlternateColorCodes('&amp;', &quot;&amp;7[&amp;dHi&amp;bMessage&amp;7]  &amp;2Launching in &amp;c1&quot;));
              } catch (InterruptedException e) {
                  System.err.println(e.getMessage());
              }
              player.setVelocity(player.getLocation().getDirection().multiply(Integer.parseInt(args[0])).setY(1.5));
              player.setHealth(20.0);
  
              return true;
          }
      return false;
      }}
  </code></pre>
  <p>Maybe I could add like a if statement or a catch with a NonIntegerException?
  And please do be patient, as I am a new young developer and I have seen how people get upset/angry if someone does not know how to format a question correctly.
  Once again, as in the title, my question is:
  How can I make my code return a &quot;Invalid number&quot; message to a player if they type /launch  or /launch String</p>