Fix writing headers and update to be more papery (#12459)

This commit is contained in:
Isaac - The456 2025-04-21 19:38:07 +01:00 committed by GitHub
parent 04b91129a5
commit def0532ffc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 43 additions and 33 deletions

View File

@ -101,6 +101,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
The world configuration options have been moved inside
their respective world folder. The files are named %s
File Reference: https://docs.papermc.io/paper/reference/global-configuration/
Docs: https://docs.papermc.io/
Discord: https://discord.gg/papermc
Website: https://papermc.io/""", WORLD_CONFIG_FILE_NAME);
@ -116,6 +117,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
Configuration options here apply to all worlds, unless you specify overrides inside
the world-specific config file inside each world folder.
File Reference: https://docs.papermc.io/paper/reference/world-configuration/
Docs: https://docs.papermc.io/
Discord: https://discord.gg/papermc
Website: https://papermc.io/""";
@ -124,6 +126,8 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
This is a world configuration file for Paper.
This file may start empty but can be filled with settings to override ones in the %s/%s
For more information, see https://docs.papermc.io/paper/reference/configuration/#per-world-configuration
World: %s (%s)""",
PaperConfigurations.CONFIG_DIR,
PaperConfigurations.WORLD_DEFAULTS_CONFIG_FILE_NAME,

View File

@ -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

View File

@ -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);
}

View File

@ -33,17 +33,17 @@ public class SpigotConfig {
private static File CONFIG_FILE;
private static final String HEADER = """
This is the main configuration file for Spigot.
This is the Spigot configuration file for Paper.
As you can see, there's tons to configure. Some options may impact gameplay, so use
with caution, and make sure you know what each option does before configuring.
For a reference for any variable inside this file, check out the Spigot wiki at
http://www.spigotmc.org/wiki/spigot-configuration/
If you need help with the configuration or have any questions related to Spigot,
join us at the Discord or drop by our forums and leave a post.
If you need help with the configuration or have any questions related to Paper,
join us in our Discord or check the docs page.
Discord: https://www.spigotmc.org/go/discord
Forums: http://www.spigotmc.org/
File Reference: https://docs.papermc.io/paper/reference/spigot-configuration/
Docs: https://docs.papermc.io/
Discord: https://discord.gg/papermc
Website: https://papermc.io/
""";
/*========================================================================*/
public static YamlConfiguration config;

View File

@ -1,15 +1,13 @@
# This is the main configuration file for Bukkit.
# This is the Bukkit configuration file in Paper.
# As you can see, there's actually not that much to configure without any plugins.
# For a reference for any variable inside this file, check out the Bukkit Wiki at
# https://www.spigotmc.org/go/bukkit-yml
#
# If you need help on this file, feel free to join us on Discord or leave a message
# on the forums asking for advice.
# If you need help with the configuration or have any questions related to Paper,
# join us in our Discord or check the docs page.
#
# Discord: https://www.spigotmc.org/go/discord
# Forums: https://www.spigotmc.org/
# Bug tracker: https://www.spigotmc.org/go/bugs
# File Reference: https://docs.papermc.io/paper/reference/bukkit-configuration/
# Docs: https://docs.papermc.io/
# Discord: https://discord.gg/papermc
# Website: https://papermc.io/
settings:
allow-end: true

View File

@ -1,13 +1,12 @@
# This is the commands configuration file for Bukkit.
# For documentation on how to make use of this file, check out the Bukkit Wiki at
# https://www.spigotmc.org/go/commands-yml
# This is the Bukkit commands configuration file for Paper.
#
# If you need help on this file, feel free to join us on Discord or leave a message
# on the forums asking for advice.
# If you need help with the configuration or have any questions related to Paper,
# join us in our Discord or check the docs page.
#
# Discord: https://www.spigotmc.org/go/discord
# Forums: https://www.spigotmc.org/
# Bug tracker: https://www.spigotmc.org/go/bugs
# File Reference: https://docs.papermc.io/paper/reference/bukkit-commands-configuration/
# Docs: https://docs.papermc.io/
# Discord: https://discord.gg/papermc
# Website: https://papermc.io/
command-block-overrides: []
ignore-vanilla-permissions: false

View File

@ -1,4 +1,4 @@
# This is the help configuration file for Bukkit.
# This is the Bukkit help configuration file for Paper.
#
# By default you do not need to modify this file. Help topics for all plugin commands are automatically provided by
# or extracted from your installed plugins. You only need to modify this file if you wish to add new help pages to
@ -53,3 +53,10 @@
# - PluginNameOne
# - PluginNameTwo
# - PluginNameThree
#
# If you need help with the configuration or have any questions related to Paper,
# join us in our Discord or check the docs page.
#
# Docs: https://docs.papermc.io/
# Discord: https://discord.gg/papermc
# Website: https://papermc.io/