Hi, I have generated a config.yml file with the following code Code:java File config = new File(getDataFolder(), "config.yml"); if(!config.exists()){ getLogger().info("[KitPvp] No config.yml found, generating a new one!"); this.saveDefaultConfig(); } And it generates the config file fine. Here is my default config Code: #Title of the scoreboard title: TemplarKitPvP I'm using this value in a scoreboard, in which I'm setting it on the join event here Code:java @EventHandler public void login(PlayerJoinEvent event){ Player p = (Player) event.getPlayer(); Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard(); Objective o = board.registerNewObjective("prison", "dummy"); o.setDisplaySlot(DisplaySlot.SIDEBAR); o.setDisplayName(plugin.getConfig().getString("title").replaceAll("&", "\u00A7"));} This works fine, however once I edit the config file via the server it doesn't work. This is how the config looks after I edit it Code: #Title of the scoreboard title: &a&lKit&b&lPvP After a restart and relog, it is still displating "TemplarKitPvP" as the title. Am I doing something wrong? Thanks.
I'm not sure what could be going wrong since you haven't provided any code for how you're setting the value in the config. On the side, there is a better way to set the objective display name, which is to use ChatColor.translateAlternateColorCodes(): Code:java String title = plugin.getConfig().getString("title");o.setDisplayName(ChatColor.translateAlternateColorCodes('&', title));
I'll try that method. And I never programmatically set the config. I set it manually in the default config in the jar.
There might be an issue with how the default config is being copied over. This is over my head as I have not used a default config in a long time.
Edit: Solved, turned out I needed double quotation marks. Don't know why, since other strings in the config work fine when written like above. But it works