In my config how would I do this: (for example): Code: #####Created by MetaSurvival##### ##Go to [website]## etc
MetaSurvival Create a config and put the comments inside of it, then in your onEnable method use saveDefaultConfig();. That should work.
kreashenz ##Do not touch nicknames!## Then when a player does /nickname &bHello.. It sets the values of: {PLAYER} = &bHello
MetaSurvival So it is printing out "## Do not touch nicknames! ##" when you're using saveDefaultConfig()?
kreashenz No, I just have ## Do not touch nicknames! ## in my config in Eclipse. But when I export it, it dosen't show in the config.
MetaSurvival getConfig().options().copyDefaults(true); saveConfig(); or saveResource("config.yml", false); Try using them..
kreashenz This is my onEnable: Code: @Override public void onEnable(){ saveDefaultConfig(); getConfig().options().copyDefaults(true); saveConfig(); this.getServer().getPluginManager().registerEvents((this), this); }
FurmigaHumana It's still not working.. ;s I think maybe my nicknames is overriding it something...? This is how I'm setting the nicknames in the config: this.getConfig().set(target.getName(), target.getDisplayName()); kreashenz Nope ;3 EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Before using the 'saveConfig', use the getConfig().options().header("the stuff here"); first, then the copyHeader(true). then saveConfig().. see if that works
MetaSurvival I'm using saveResource("config.yml", false); and it's working fine.. Even test for yourself. https://www.dropbox.com/s/6kl0byvjivunous/Test.jar source: Code:java package me.kreashenz.potato; import org.bukkit.plugin.java.JavaPlugin; public class Tsest extends JavaPlugin { public void onEnable(){saveResource("config.yml", false);} } [EDIT] Oh wait, all the posts popped up after I posted this.
FurmigaHumana What would I do to add more than 1 line with ## ? This is the on enable: Code: @Override public void onEnable(){ saveDefaultConfig(); getConfig().options().copyDefaults(true); getConfig().options().header("## Do not touch nicknames! ##").copyHeader(true); saveConfig(); this.getServer().getPluginManager().registerEvents((this), this); }
Use \n to set new lines. getConfig().options().header("## line 1 ## \n ## line 2 ## \n # lin3..... ").copyHeader(true);