mirror of
https://github.com/YouHaveTrouble/CommandWhitelist.git
synced 2026-05-12 06:26:57 +00:00
fix errors with spigot specifically.
use paper folks.
This commit is contained in:
+12
-5
@@ -69,8 +69,13 @@ public class CommandWhitelistBukkit extends JavaPlugin {
|
|||||||
|
|
||||||
private void reloadPluginConfig() {
|
private void reloadPluginConfig() {
|
||||||
File configFile = new File("plugins/CommandWhitelist/config.yml");
|
File configFile = new File("plugins/CommandWhitelist/config.yml");
|
||||||
if (configCache == null)
|
if (configCache == null) {
|
||||||
configCache = new ConfigCache(configFile, true, getSLF4JLogger());
|
try {
|
||||||
|
configCache = new ConfigCache(configFile, true, getSLF4JLogger());
|
||||||
|
} catch (NoSuchMethodError e) {
|
||||||
|
configCache = new ConfigCache(configFile, true, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
configCache.reloadConfig();
|
configCache.reloadConfig();
|
||||||
}
|
}
|
||||||
@@ -78,9 +83,11 @@ public class CommandWhitelistBukkit extends JavaPlugin {
|
|||||||
public void reloadPluginConfig(CommandSender sender) {
|
public void reloadPluginConfig(CommandSender sender) {
|
||||||
getServer().getScheduler().runTaskAsynchronously(this, () -> {
|
getServer().getScheduler().runTaskAsynchronously(this, () -> {
|
||||||
reloadPluginConfig();
|
reloadPluginConfig();
|
||||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
try {
|
||||||
p.updateCommands();
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
}
|
p.updateCommands();
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {}
|
||||||
audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.config_reloaded));
|
audiences.sender(sender).sendMessage(CWCommand.miniMessage.parse(configCache.prefix + configCache.config_reloaded));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-2
@@ -132,8 +132,10 @@ public class ConfigCache {
|
|||||||
if (commands.contains(cmd)) continue;
|
if (commands.contains(cmd)) continue;
|
||||||
commands.add(cmd);
|
commands.add(cmd);
|
||||||
}
|
}
|
||||||
|
List<String> subCommands = new ArrayList<>();
|
||||||
List<String> subCommands = section.getStringList(id + ".subcommands");
|
for (String subCmd : section.getStringList(id + ".subcommands")) {
|
||||||
|
subCommands.add(String.valueOf(subCmd));
|
||||||
|
}
|
||||||
String customCommandDeniedMessage = section.getString(id + ".custom_command_denied_message");
|
String customCommandDeniedMessage = section.getString(id + ".custom_command_denied_message");
|
||||||
return new CWGroup(id, commands, subCommands, customCommandDeniedMessage);
|
return new CWGroup(id, commands, subCommands, customCommandDeniedMessage);
|
||||||
}
|
}
|
||||||
@@ -148,6 +150,10 @@ public class ConfigCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void warn(String log) {
|
private void warn(String log) {
|
||||||
|
if (logger == null) {
|
||||||
|
System.out.println("WARNING: "+log);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (logger instanceof org.slf4j.Logger) {
|
if (logger instanceof org.slf4j.Logger) {
|
||||||
((org.slf4j.Logger) logger).warn(log);
|
((org.slf4j.Logger) logger).warn(log);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user