Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
[Bleeding] Added option to completely disable all automatic help topic generation by adding "All" to the ignore-plugins list in help.yml. Addresses BUKKIT-1264
Dieser Commit ist enthalten in:
Ursprung
31b1bc02ca
Commit
eb3c092ef8
@ -17,15 +17,18 @@ import java.util.logging.Level;
|
|||||||
*/
|
*/
|
||||||
public class HelpYamlReader {
|
public class HelpYamlReader {
|
||||||
|
|
||||||
private final YamlConfiguration helpYaml;
|
private YamlConfiguration helpYaml;
|
||||||
private final char ALT_COLOR_CODE = '&';
|
private final char ALT_COLOR_CODE = '&';
|
||||||
|
|
||||||
public HelpYamlReader(Server server) {
|
public HelpYamlReader(Server server) {
|
||||||
File helpYamlFile = new File("help.yml");
|
File helpYamlFile = new File("help.yml");
|
||||||
|
YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/help.yml"));
|
||||||
|
|
||||||
|
try {
|
||||||
helpYaml = YamlConfiguration.loadConfiguration(helpYamlFile);
|
helpYaml = YamlConfiguration.loadConfiguration(helpYamlFile);
|
||||||
helpYaml.options().copyDefaults(true);
|
helpYaml.options().copyDefaults(true);
|
||||||
helpYaml.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/help.yml")));
|
helpYaml.setDefaults(defaultConfig);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!helpYamlFile.exists()) {
|
if (!helpYamlFile.exists()) {
|
||||||
helpYaml.save(helpYamlFile);
|
helpYaml.save(helpYamlFile);
|
||||||
@ -33,6 +36,10 @@ public class HelpYamlReader {
|
|||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
server.getLogger().log(Level.SEVERE, "Could not save " + helpYamlFile, ex);
|
server.getLogger().log(Level.SEVERE, "Could not save " + helpYamlFile, ex);
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
server.getLogger().severe("Failed to load help.yml. Verify the yaml indentation is correct. Reverting to default help.yml.");
|
||||||
|
helpYaml = defaultConfig;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,6 +91,11 @@ public class SimpleHelpMap implements HelpMap {
|
|||||||
// ** Load topics from highest to lowest priority order **
|
// ** Load topics from highest to lowest priority order **
|
||||||
Set<String> ignoredPlugins = new HashSet<String>(yaml.getIgnoredPlugins());
|
Set<String> ignoredPlugins = new HashSet<String>(yaml.getIgnoredPlugins());
|
||||||
|
|
||||||
|
// Don't load any automatic help topics if All is ignored
|
||||||
|
if (ignoredPlugins.contains("All")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize help topics from the server's command map
|
// Initialize help topics from the server's command map
|
||||||
outer: for (Command command : server.getCommandMap().getCommands()) {
|
outer: for (Command command : server.getCommandMap().getCommands()) {
|
||||||
if (commandInIgnoredPlugin(command, ignoredPlugins)) {
|
if (commandInIgnoredPlugin(command, ignoredPlugins)) {
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
# permission: you.dont.have
|
# permission: you.dont.have
|
||||||
#
|
#
|
||||||
# Any plugin in the ignored plugins list will be excluded from help. The name must match the name displayed by
|
# Any plugin in the ignored plugins list will be excluded from help. The name must match the name displayed by
|
||||||
# the /plugins command. Ignore "Bukkit" to remove the standard bukkit commands from the index.
|
# the /plugins command. Ignore "Bukkit" to remove the standard bukkit commands from the index. Ignore "All"
|
||||||
|
# to completely disable automatic help topic generation.
|
||||||
# ignore-plugins:
|
# ignore-plugins:
|
||||||
# - PluginNameOne
|
# - PluginNameOne
|
||||||
# - PluginNameTwo
|
# - PluginNameTwo
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren