geforkt von Mirrors/Paper
Match old alias behavior when migrating.
Previously the alias system would pass all arguments from the alias to its command(s) implicitly. The new system requires arguments to be explicitly passed so server owners can have more control over where and how they are passed. To ensure this isn't a breaking change during the migration from bukkit.yml to commands.yml we now add the $1- argument to the alias commands to match the previous behavior.
Dieser Commit ist enthalten in:
Ursprung
553acdf0cd
Commit
219f4e2c25
@ -270,12 +270,25 @@ public final class CraftServer implements Server {
|
|||||||
commandsConfiguration.options().copyDefaults(true);
|
commandsConfiguration.options().copyDefaults(true);
|
||||||
commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml")));
|
commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/commands.yml")));
|
||||||
saveCommandsConfig();
|
saveCommandsConfig();
|
||||||
|
|
||||||
|
// Migrate aliases from old file and add previously implicit $1- to pass all arguments
|
||||||
if (legacyAlias != null) {
|
if (legacyAlias != null) {
|
||||||
ConfigurationSection aliases = commandsConfiguration.createSection("aliases");
|
ConfigurationSection aliases = commandsConfiguration.createSection("aliases");
|
||||||
for (Entry<String, Object> entry : legacyAlias.getValues(true).entrySet()) {
|
for (String key : legacyAlias.getKeys(false)) {
|
||||||
aliases.set(entry.getKey(), entry.getValue());
|
ArrayList<String> commands = new ArrayList<String>();
|
||||||
|
|
||||||
|
if (legacyAlias.isList(key)) {
|
||||||
|
for (String command : legacyAlias.getStringList(key)) {
|
||||||
|
commands.add(command + " $1-");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
commands.add(legacyAlias.getString(key) + " $1-");
|
||||||
|
}
|
||||||
|
|
||||||
|
aliases.set(key, commands);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCommandsConfig();
|
saveCommandsConfig();
|
||||||
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling"));
|
((SimplePluginManager) pluginManager).useTimings(configuration.getBoolean("settings.plugin-profiling"));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren