Hi, i would like to get out a double from a arg. this is the command i would like to work, "/money remove ''double" 'player'. Here is my code. Code: if(args.length == 3){ if(args[1].equalsIgnoreCase("remove")){ Double removemoney = Double.parseDouble(args[2].replace(",", ".")); Listeners.removemoney(player, removemoney); } } Here is the Listeners class: Code: public static void removemoney(Player player, double removemoney){ UUID uuid = player.getUniqueId(); double money = Main.plugin.getConfig().getDouble("Money." + uuid); money = money-removemoney; Main.plugin.getConfig().set("Money." + uuid, money); Main.plugin.saveConfig(); String message = getMessage("Messages.RemoveMoney", player); String money2 = Double.toString(money); message = message.replace("@m", money2);
Use Double.parseDouble(String param), That will throw a NumberFormatException if the provided string contains non numeric values. I cant understand what the problem with your code is ?
if I´m running the command /money remove 60 name nothing will show up in the game. And im sending the message 'message' from the removemoney.
@stamline Let me get this out ofthe way: Arg[1] is the SECOND arg. Arg[0] is the first arg. This is what the command line looks like /Command arg[0] arg[1] arg[2] So yes, because arg[1] would be the "double", it would never be equal to "remove"