ok, I know there's a few way's to get a config, but I need to do it so you can edit the config to your extent. Someone told me to do something like this, but I didn't understand it much, and he said he didn't have time, and had to go, and to ask you guys, well here's the code he told me Code:java @Override public void onEnable() { something = this; config = YamlConfiguration.loadConfiguration(new File("something", "config.yml")); And, what I'm mainly asking is, would this work, if not, what would where server owner's can edit the config.yml to their extent.
iiHeroo You can use Bukkit's native config system: Code: config = getConfig(); But the way you are doing it for a separate config: Code: config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "file.yml"));
okay thanks, xD, I just wanted to make sure, I didn't want to find out in the end and not it being able to work. uh, I know it's solved and all, but uh, I return with an error, should it be a variable, the error is the "config" http://gyazo.com/563c5ed7037674d12307d89caac9e6b0 Code: @Override public void onEnable(){ config = getConfig(); saveDefaultConfig(); EDIT by Moderator: merged posts, please use the edit button instead of double posting.
iiHeroo Er, well, you need to define the variable. Code:java Configuration config; @Override public void onEnable(){ config = getConfig(); saveDefaultConfig();
Yeah, I know, I got that. Thanks for all of you're help, Bukkit has a great community okay, uh, just percussion, I have a warning for "config" on line 12, the warning is: - Write occurrence of 'config' - The value of serverinfoplus.config is not used CODE: Code:java package org.horrgs.me; import java.util.logging.Logger; import org.bukkit.ChatColor;import org.bukkit.configuration.file.FileConfiguration;import org.bukkit.plugin.java.JavaPlugin; public class serverinfoplus extends JavaPlugin{ public final Logger logger = Logger.getLogger("Minecraft");private FileConfiguration config;public static serverinfoplus plugin;public static String colorize(String str) {return ChatColor.translateAlternateColorCodes('&', str);} @Overridepublic void onEnable(){config = getConfig();saveDefaultConfig(); }} EDIT by Moderator: merged posts, please use the edit button instead of double posting.
iiHeroo The warning is self-explanatory; The value of serverinfoplus.config is not used You're not using it anywhere.
I know, but like, how do I get it to get the config.yml ? Obviously I put config = getConfig(); but, it returns with that error.
iiHeroo Warning, not an error. To get rid of it, just use the variable somewhere. If you're not using it, then why do you even have it in the first place? Listen to the warnings, man! They know what's up.
xD, WARNING, but like, they said above, use Config = getConfig(); to get the config.yml, then I imported using YamlConfiguration, then it returned with a warning, and I don't know how to fix it xD. Assist
iiHeroo You don't need it, it's just to speed things up by 3 letters and 2 symbols. If you want to keep it, then keep it, it's only a warning telling you that it hasn't been used yet.