I'm working on configurable messages.. But I'm not sure how to get variables such as (%AMOUNT = acount taken) or something... I've already got the stuff all setup, but I'm just not sure how to make the variables. Code:java public static void buyKit(Player p, int i) {Main.config.set(p.getName() + ".Coins", Main.config.getInt(p.getName() + ".Coins", 0) - i);Main.saveFile();p.sendMessage("§b§l► " + ChatColor.translateAlternateColorCodes("&".charAt(0), Main.messageConf.getString("butKit").replaceAll("%AMOUNT", i)));} I want "i" to be the variable for the amount. Any help..? If you need more info, just ask and I'll post it.
Ok, so I have a set of things like giveCoins(), takeCoins(), buyKit().... and I'd like to make the messages configurable. But I'm not sure how to make the variables.. like %AMOUNT will equal to the amount typed in the command. Example Code: Config: buyKit: 'You bought Mage for %AMOUNT coins!' Message sent to player: You bought Mage for 25 coins!
Epicballzy So you want to set %AMOUNT to a specific int? I will do some research (try) and try get you a link to a thread of Bukkit API Epicballzy I cannot find a thing but I would take a guess and say: Check if the config message contains %AMOUNT If it does set %AMOUNT to __ Done! Put this in the onCommand EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Hmmm... It's going to be tough cause I'm not the neatest coder. Lol, but I'll do my best Thanks for the help though. Very much appreciated!
Epicballzy No problem! If it does not work then just put CraftCreeper6 in your message and ill be there as soon as I can get here!
just do Main.getConfig().set("buyKit", "You bought a kit for " + args[0] + " dollars!"); where args[0] is an int. obviously, you would want to check if args[0] is an int firstXD