Fix writing headers and update to be more papery (#12459)
This commit is contained in:
@@ -432,7 +432,9 @@ public final class CraftServer implements Server {
|
||||
|
||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||
this.configuration.options().copyDefaults(true);
|
||||
this.configuration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), StandardCharsets.UTF_8)));
|
||||
YamlConfiguration configurationDefaults = YamlConfiguration.loadConfiguration(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml"), StandardCharsets.UTF_8));
|
||||
this.configuration.setDefaults(configurationDefaults);
|
||||
this.configuration.options().setHeader(configurationDefaults.options().getHeader());
|
||||
ConfigurationSection legacyAlias = null;
|
||||
if (!this.configuration.isString("aliases")) {
|
||||
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
||||
@@ -449,6 +451,7 @@ public final class CraftServer implements Server {
|
||||
if (this.commandsConfiguration.contains("aliases")) commandsDefaults.set("aliases", null);
|
||||
this.commandsConfiguration.setDefaults(commandsDefaults);
|
||||
// Paper end - don't enforce icanhasbukkit default if alias block exists
|
||||
this.commandsConfiguration.options().setHeader(commandsDefaults.options().getHeader());
|
||||
this.saveCommandsConfig();
|
||||
|
||||
// Migrate aliases from old file and add previously implicit $1- to pass all arguments
|
||||
|
||||
@@ -32,11 +32,10 @@ public class HelpYamlReader {
|
||||
this.helpYaml = YamlConfiguration.loadConfiguration(helpYamlFile);
|
||||
this.helpYaml.options().copyDefaults(true);
|
||||
this.helpYaml.setDefaults(defaultConfig);
|
||||
this.helpYaml.options().setHeader(defaultConfig.options().getHeader());
|
||||
|
||||
try {
|
||||
if (!helpYamlFile.exists()) {
|
||||
this.helpYaml.save(helpYamlFile);
|
||||
}
|
||||
this.helpYaml.save(helpYamlFile);
|
||||
} catch (IOException ex) {
|
||||
server.getLogger().log(Level.SEVERE, "Could not save " + helpYamlFile, ex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user