This lines Code:java if args = number { don't work. Firstly, because you never specified what the variable number should be, and secondly because the if-syntax is wrong. If you want to check the amount of arguments given, do it like you did two or three lines before: Code:java if (args.length == number) { But remember you must initialize number first! I guess you want to get the number of the first argument, but for that you have to change some things: Firstly, args is an array, so if you want to get the first value of that array you have to do it with args[0]. Secondly args is a String array, so if you want to get an integer or double out of that String you have do do that with Code:java // For Integer:Integer.parseInt(args[0])// For Double:Double.parseDouble(args[0]) So for example the part at the end could looks like this: Code:java if (args.length >= 1) {EconomyResponse r = econ.withdrawPlayer(p.getName(), args);pi.addItem(new ItemStack(Material.GOLD_NUGGET, Double.parseDouble(args[0])));}
You can use this: Code: double amount = 0.0; try { amount = Double.parseDouble(args[1]); } catch (NumberFormatException ex) { // not a valid double. So tell the player. } It will try to parse the given argument to a double. And if the given value is not a valid double, it throws an exception.