config shenanigans

This commit is contained in:
YouHaveTrouble
2021-07-03 22:21:20 +02:00
parent 20eb731b93
commit 88d51b29aa
13 changed files with 190 additions and 149 deletions
@@ -61,8 +61,10 @@ public class CommandWhitelistBukkit extends JavaPlugin {
private void reloadPluginConfig() {
File configFile = new File("plugins/CommandWhitelist/config.yml");
configCache = new ConfigCache(configFile, true);
if (configCache == null)
configCache = new ConfigCache(configFile, true, getSLF4JLogger());
else
configCache.reloadConfig();
}
public void reloadPluginConfig(CommandSender sender) {
@@ -91,8 +93,9 @@ public class CommandWhitelistBukkit extends JavaPlugin {
* @param player Bukkit Player
* @return commands available to the player
*/
public static HashSet<String> getCommands(org.bukkit.entity.Player player, HashMap<String, CWGroup> groups) {
public static HashSet<String> getCommands(org.bukkit.entity.Player player) {
HashSet<String> commandList = new HashSet<>();
HashMap<String, CWGroup> groups = configCache.getGroupList();
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
if (s.getKey().equalsIgnoreCase("default"))
commandList.addAll(s.getValue().getCommands());
@@ -106,13 +109,13 @@ public class CommandWhitelistBukkit extends JavaPlugin {
* @param player Bukkit Player
* @return subcommands unavailable for the player
*/
public static HashSet<String> getSuggestions(org.bukkit.entity.Player player, HashMap<String, CWGroup> groups) {
public static HashSet<String> getSuggestions(org.bukkit.entity.Player player) {
HashSet<String> suggestionList = new HashSet<>();
HashMap<String, CWGroup> groups = configCache.getGroupList();
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
if (s.getKey().equalsIgnoreCase("default"))
suggestionList.addAll(s.getValue().getSubCommands());
if (player.hasPermission("commandwhitelist.group." + s.getKey()))
continue;
if (player.hasPermission("commandwhitelist.group." + s.getKey())) continue;
suggestionList.addAll(s.getValue().getSubCommands());
}
return suggestionList;
@@ -28,16 +28,12 @@ public class PacketCommandPreProcessListener {
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
String string = packet.getStrings().read(0);
if (!string.startsWith("/"))
return;
if (!string.startsWith("/")) return;
Player player = event.getPlayer();
if (player.hasPermission("commandwhitelist.bypass"))
return;
ConfigCache configCache = CommandWhitelistBukkit.getConfigCache();
if (player.hasPermission("commandwhitelist.bypass")) return;
String label = CommandUtil.getCommandLabel(string.toLowerCase());
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player, configCache.getGroupList());
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player);
if (!commands.contains(label)) {
event.setCancelled(true);
ConfigCache config = CommandWhitelistBukkit.getConfigCache();
@@ -45,7 +41,7 @@ public class PacketCommandPreProcessListener {
return;
}
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player, configCache.getGroupList());
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player);
for (String bannedSubCommand : bannedSubCommands) {
if (string.toLowerCase().substring(1).startsWith(bannedSubCommand)) {
event.setCancelled(true);
@@ -15,14 +15,12 @@ public class PlayerCommandPreProcessListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandPreprocessEvent event) {
Player player = event.getPlayer();
if (player.hasPermission("commandwhitelist.bypass"))
return;
if (player.hasPermission("commandwhitelist.bypass")) return;
String label = CommandUtil.getCommandLabel(event.getMessage().toLowerCase());
ConfigCache configCache = CommandWhitelistBukkit.getConfigCache();
BukkitAudiences audiences = CommandWhitelistBukkit.getAudiences();
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player, configCache.getGroupList());
HashSet<String> commands = CommandWhitelistBukkit.getCommands(player);
if (!commands.contains(label)) {
event.setCancelled(true);
ConfigCache config = CommandWhitelistBukkit.getConfigCache();
@@ -30,7 +28,7 @@ public class PlayerCommandPreProcessListener implements Listener {
return;
}
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player, configCache.getGroupList());
HashSet<String> bannedSubCommands = CommandWhitelistBukkit.getSuggestions(player);
for (String bannedSubCommand : bannedSubCommands) {
if (event.getMessage().toLowerCase().substring(1).startsWith(bannedSubCommand)) {
event.setCancelled(true);
@@ -8,12 +8,11 @@ import org.bukkit.event.Listener;
import java.util.*;
public class PlayerCommandSendListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
@EventHandler(priority = EventPriority.NORMAL)
public void PlayerCommandSendEvent(org.bukkit.event.player.PlayerCommandSendEvent event) {
Player player = event.getPlayer();
if (player.hasPermission("commandwhitelist.bypass"))
return;
HashSet<String> commandList = CommandWhitelistBukkit.getCommands(player, CommandWhitelistBukkit.getConfigCache().getGroupList());
if (player.hasPermission("commandwhitelist.bypass")) return;
HashSet<String> commandList = CommandWhitelistBukkit.getCommands(player);
event.getCommands().removeIf((cmd) -> !commandList.contains(cmd));
}
}
@@ -8,16 +8,15 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
public class TabCompleteBlockerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
@EventHandler(priority = EventPriority.HIGHEST)
public void onCommandTabComplete(org.bukkit.event.server.TabCompleteEvent event) {
if (!(event.getSender() instanceof Player))
return;
if (!(event.getSender() instanceof Player)) return;
Player player = (Player) event.getSender();
event.setCompletions(
CommandUtil.filterSuggestions(
event.getBuffer(),
event.getCompletions(),
CommandWhitelistBukkit.getSuggestions(player, CommandWhitelistBukkit.getConfigCache().getGroupList())
CommandWhitelistBukkit.getSuggestions(player)
)
);
}
+32 -5
View File
@@ -47,15 +47,42 @@
</resources>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>velocitypowered-repo</id>
<url>https://repo.velocitypowered.com/releases/</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.28</version>
<groupId>com.github.Thatsmusic99</groupId>
<artifactId>ConfigurationMaster</artifactId>
<version>v2.0.0-ALPHA-2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.waterfallmc</groupId>
<artifactId>waterfall-api</artifactId>
<version>1.16-R0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -8,18 +8,22 @@ public class CommandUtil {
/**
* Filters blocked command suggestions from provided collection of strings
*
* @param buffer Command buffer
* @param suggestions Full suggestions list
* @param blockedSubCommands Subcommands to filter out
* @return Filtered list of suggestions
*/
public static List<String> filterSuggestions(String buffer, Collection<String> suggestions, Collection<String> blockedSubCommands) {
String cmd = buffer.replace(getLastArgument(buffer), "");
for (String s : blockedSubCommands) {
String slast = getLastArgument(s.toLowerCase());
String slast = getLastArgument(s);
String scommand = s.replace(slast, "");
cmd = cmd.replace(getLastArgument(cmd), "");
if (cmd.substring(1).startsWith("/" + scommand)) {
String[] cmdSplit = buffer.split(" ");
StringBuilder cmdBuilder = new StringBuilder();
for (int i = 0; i <= cmdSplit.length - 1; i++)
cmdBuilder.append(cmdSplit[i]).append(" ");
String cmd = cmdBuilder.toString();
if (cmd.startsWith("/" + scommand)) {
while (suggestions.contains(slast))
suggestions.remove(slast);
}
@@ -33,8 +37,7 @@ public class CommandUtil {
*/
public static String getLastArgument(String cmd) {
String[] parts = cmd.split(" ");
if (parts.length <= 1)
return "";
if (parts.length <= 1) return "";
String last = "";
for (String part : parts) {
last = part;
@@ -1,36 +1,62 @@
package eu.endermite.commandwhitelist.common;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import io.github.thatsmusic99.configurationmaster.api.ConfigFile;
import io.github.thatsmusic99.configurationmaster.api.ConfigSection;
import java.io.*;
import java.util.*;
public class ConfigCache {
private final File configFile;
private ConfigFile config;
private final Object logger;
private final boolean canDoProtocolLib;
private final HashMap<String, CWGroup> groupList = new LinkedHashMap<>();
public String prefix, command_denied, no_permission, no_such_subcommand, config_reloaded, added_to_whitelist,
removed_from_whitelist, group_doesnt_exist, subcommand_denied;
public boolean useProtocolLib = false;
public ConfigCache(File configFile, boolean canDoProtocolLib) {
public ConfigCache(File configFile, boolean canDoProtocolLib, Object logger){
this.configFile = configFile;
this.canDoProtocolLib = canDoProtocolLib;
if (!reloadConfig())
this.logger = logger;
reloadConfig();
}
public void saveDefaultConfig(Map<String, Object> data, File configFile, boolean canDoProtocolLib) {
public boolean reloadConfig() {
data.put("messages", processMessages());
boolean firstLoad = createFiles();
config = ConfigFile.loadConfig(configFile);
if (canDoProtocolLib) {
data.put("use_protocollib_to_detect_commands", useProtocolLib);
config.addDefault("messages.prefix", "CommandWhitelist > ");
config.addDefault("messages.command_denied", "No such command.");
config.addDefault("messages.subcommand_denied", "You cannot use this subcommand");
config.addDefault("messages.no_permission", "<red>You don't have permission to do this.");
config.addDefault("messages.no_such_subcommand", "<red>No subcommand by that name.");
config.addDefault("messages.config_reloaded", "<yellow>Configuration reloaded.");
config.addDefault("messages.added_to_whitelist", "<yellow>Whitelisted command <gold>%s <yellow>for permission <gold>%s");
config.addDefault("messages.removed_from_whitelist", "<yellow>Removed command <gold>%s <yellow>from permission <gold>%s");
config.addDefault("messages.group_doesnt_exist", "<red>Group doesn't exist or error occured");
config.addComment("messages", "Messages use MiniMessage formatting (https://docs.adventure.kyori.net/minimessage.html#format)");
if (canDoProtocolLib)
config.addDefault("use_protocollib", false, "Do not enable if you don't have issues with aliased commands.\nThis requires server restart to take effect.");
if (firstLoad) {
List<String> exampleCommands = new ArrayList<>();
exampleCommands.add("example");
List<String> exampleSubCommands = new ArrayList<>();
exampleSubCommands.add("example of");
config.addDefault("groups.example.commands", exampleCommands, "This is the WHITELIST of commands that players will be able to see/use in the group \"example\"");
config.addDefault("groups.example.subcommands", exampleSubCommands, "This is the BLACKLIST of subcommands that players will NOT be able to see/use in the group \"example\"");
config.addComment("groups.example", "All groups except from default require commandwhitelist.group.<group_name> permission\ncommandwhitelist.group.example in this case\n If you wish to leave the list empty, put \"commands: []\" or \"subcommands: []\"");
}
List<String> defaultCommands = new ArrayList<>();
List<String> defaultSubcommands = new ArrayList<>();
defaultCommands.add("help");
defaultCommands.add("spawn");
defaultCommands.add("bal");
@@ -44,73 +70,69 @@ public class ConfigCache {
defaultCommands.add("tpaccept");
defaultCommands.add("tpdeny");
defaultCommands.add("warp");
List<String> defaultSubcommands = new ArrayList<>();
defaultSubcommands.add("help about");
HashMap<String, Object> groups = new LinkedHashMap<>();
config.addDefault("groups.default", new CWGroup("default", defaultCommands, defaultSubcommands).serialize());
for (CWGroup group : groupList.values()) {
groups.put(group.getId(), group.serialize());
prefix = config.getString("messages.prefix");
command_denied = config.getString("messages.command_denied");
subcommand_denied = config.getString("messages.subcommand_denied");
no_permission = config.getString("messages.no_permission");
no_such_subcommand = config.getString("messages.no_such_subcommand");
config_reloaded = config.getString("messages.config_reloaded");
added_to_whitelist = config.getString("messages.added_to_whitelist");
removed_from_whitelist = config.getString("messages.removed_from_whitelist");
group_doesnt_exist = config.getString("messages.group_doesnt_exist");
ConfigSection groupSection = config.getConfigSection("groups");
for (String key : groupSection.getKeys(false)) {
groupList.put("key", loadCWGroup(key, groupSection));
}
groups.putIfAbsent("default", new CWGroup("default", defaultCommands, defaultSubcommands).serialize());
//TODO find a way to update groups
data.putIfAbsent("groups", groups);
return saveConfig();
}
DumperOptions dumperOptions = new DumperOptions();
dumperOptions.setPrettyFlow(true);
dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
dumperOptions.setAllowUnicode(true);
Yaml yaml = new Yaml(dumperOptions);
private boolean saveConfig() {
try {
FileWriter writer = new FileWriter(configFile.getPath());
yaml.dump(data, writer);
config.save();
return true;
} catch (IOException e) {
e.printStackTrace();
}
}
public boolean reloadConfig() {
HashMap<String, Object> config = new LinkedHashMap<>();
Yaml yaml = new Yaml();
try {
FileInputStream fileInputStream = new FileInputStream(configFile);
config = yaml.load(fileInputStream);
} catch (FileNotFoundException ignored) {
saveDefaultConfig(config, configFile, canDoProtocolLib);
return false;
}
HashMap<String, String> messages = (HashMap<String, String>) config.get("messages");
this.prefix = messages.get("prefix");
this.command_denied = messages.get("command_denied");
this.no_such_subcommand = messages.get("no_such_subcommand");
this.no_permission = messages.get("no_permission");
this.config_reloaded = messages.get("config_reloaded");
this.added_to_whitelist = messages.get("added_to_whitelist");
this.removed_from_whitelist = messages.get("removed_from_whitelist");
this.group_doesnt_exist = messages.get("group_doesnt_exist");
this.subcommand_denied = messages.get("subcommand_denied");
if (canDoProtocolLib)
this.useProtocolLib = (boolean) config.get("use_protocollib_to_detect_commands");
HashMap<String, HashMap<String, Object>> groups = (HashMap<String, HashMap<String, Object>>) config.get("groups");
for (Map.Entry<String, HashMap<String, Object>> entry : groups.entrySet()) {
groupList.put(entry.getKey(), loadCWGroup(entry.getKey(), entry.getValue()));
}
saveDefaultConfig(config, configFile, canDoProtocolLib);
return true;
private boolean createFiles() {
boolean creatingFiles = false;
try {
File parent = new File(configFile.getParent());
if (!parent.exists())
parent.mkdir();
if (!configFile.exists()) {
configFile.createNewFile();
creatingFiles = true;
}
return creatingFiles;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
public CWGroup loadCWGroup(String id, HashMap<String, Object> map) {
List<String> subCommands = new ArrayList<>((Collection<? extends String>) map.get("subcommands"));
List<String> commands = new ArrayList<>((Collection<? extends String>) map.get("commands"));
public CWGroup loadCWGroup(String id, ConfigSection section) {
HashSet<String> commands = new HashSet<>();
for (String cmd : section.getStringList(id+".commands")) {
if (cmd.contains(" ")) {
String[] cmdSplit = cmd.split(" ");
warn("CommandWhitelist - \""+cmd+"\" is not a command. Loading it as \""+cmdSplit[0]+"\".");
cmd = cmdSplit[0];
}
if (commands.contains(cmd)) continue;
commands.add(cmd);
}
List<String> subCommands = section.getStringList(id+".subcommands");
return new CWGroup(id, commands, subCommands);
}
@@ -118,25 +140,15 @@ public class ConfigCache {
return groupList;
}
public HashMap<String, String> processMessages() {
HashMap<String, String> messages = new LinkedHashMap<>();
messages.put("prefix", stringOrDefault(prefix, "CommandWhitelist > "));
messages.put("command_denied", stringOrDefault(command_denied, "No such command."));
messages.put("subcommand_denied", stringOrDefault(subcommand_denied, "You cannot use this subcommand"));
messages.put("no_permission", stringOrDefault(no_permission, "<red>You don't have permission to do this."));
messages.put("no_such_subcommand", stringOrDefault(no_such_subcommand, "<red>No subcommand by that name."));
messages.put("config_reloaded", stringOrDefault(config_reloaded, "<yellow>Configuration reloaded."));
messages.put("added_to_whitelist", stringOrDefault(added_to_whitelist, "<yellow>Whitelisted command <gold>%s <yellow>for permission <gold>%s"));
messages.put("removed_from_whitelist", stringOrDefault(removed_from_whitelist, "<yellow>Removed command <gold>%s <yellow>from permission <gold>%s"));
messages.put("group_doesnt_exist", stringOrDefault(group_doesnt_exist, "<red>Group doesn't exist or error occured"));
return messages;
private void warn(String log) {
if (logger instanceof org.slf4j.Logger) {
((org.slf4j.Logger) logger).warn(log);
return;
}
if (logger instanceof java.util.logging.Logger) {
((java.util.logging.Logger) logger).warning(log);
return;
}
public String stringOrDefault(String value, String def) {
if (value != null)
return value;
else
return def;
}
}
@@ -15,6 +15,7 @@ import eu.endermite.commandwhitelist.velocity.command.VelocityMainCommand;
import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import org.slf4j.Logger;
import javax.inject.Inject;
import java.io.File;
import java.nio.file.Path;
@@ -28,16 +29,23 @@ public class CommandWhitelistVelocity {
private static ProxyServer server;
private static ConfigCache configCache;
private static Path folder;
private static Logger logger;
@Inject
public CommandWhitelistVelocity(ProxyServer server, Logger logger, @DataDirectory final Path folder) {
CommandWhitelistVelocity.server = server;
CommandWhitelistVelocity.folder = folder;
CommandWhitelistVelocity.plugin = this;
CommandWhitelistVelocity.logger = logger;
}
private static void reloadConfig() {
configCache = new ConfigCache(new File(String.valueOf(folder), "config.yml"), false);
if (configCache == null)
configCache = new ConfigCache(new File(String.valueOf(folder), "config.yml"), false, logger);
else
configCache.reloadConfig();
}
public static void reloadConfig(CommandSource source) {
@@ -56,9 +64,9 @@ public class CommandWhitelistVelocity {
@Subscribe
public void onUserCommandSendEvent(PlayerAvailableCommandsEvent event) {
if (event.getPlayer().hasPermission("commandwhitelist.bypass"))
return;
HashSet<String> allowedCommands = CommandWhitelistVelocity.getCommands(event.getPlayer(), configCache.getGroupList());
Player player = event.getPlayer();
if (player.hasPermission("commandwhitelist.bypass")) return;
HashSet<String> allowedCommands = CommandWhitelistVelocity.getCommands(player);
event.getRootNode().getChildren().removeIf((commandNode) ->
server.getCommandManager().hasCommand(commandNode.getName())
&& !allowedCommands.contains(commandNode.getName())
@@ -67,14 +75,12 @@ public class CommandWhitelistVelocity {
@Subscribe
public void onUserCommandExecuteEvent(com.velocitypowered.api.event.command.CommandExecuteEvent event) {
if (!(event.getCommandSource() instanceof Player))
return;
if (!(event.getCommandSource() instanceof Player)) return;
Player player = (Player) event.getCommandSource();
if (player.hasPermission("commandwhitelist.bypass"))
return;
if (player.hasPermission("commandwhitelist.bypass")) return;
HashSet<String> allowedCommands = CommandWhitelistVelocity.getCommands(player, configCache.getGroupList());
HashSet<String> allowedCommands = CommandWhitelistVelocity.getCommands(player);
String command = event.getCommand().split(" ")[0];
if (server.getCommandManager().hasCommand(command)
&& !allowedCommands.contains(command))
@@ -89,7 +95,8 @@ public class CommandWhitelistVelocity {
* @param player Velocity Player
* @return commands available to the player
*/
public static HashSet<String> getCommands(Player player, HashMap<String, CWGroup> groups) {
public static HashSet<String> getCommands(Player player) {
HashMap<String, CWGroup> groups = configCache.getGroupList();
HashSet<String> commandList = new HashSet<>();
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
if (s.getKey().equalsIgnoreCase("default"))
@@ -55,15 +55,10 @@ public final class CommandWhitelistWaterfall extends Plugin {
}
public void loadConfig() {
try {
if (!getDataFolder().exists()) {
getDataFolder().mkdir();
}
configCache = new ConfigCache(new File(getDataFolder(), "config.yml"), false);
} catch (Exception e) {
e.printStackTrace();
}
if (configCache == null)
configCache = new ConfigCache(new File(getDataFolder(), "config.yml"), false, getLogger());
else
configCache.reloadConfig();
}
public void loadConfigAsync(CommandSender sender) {
@@ -77,8 +72,9 @@ public final class CommandWhitelistWaterfall extends Plugin {
* @param player Bungee Player
* @return commands available to the player
*/
public static HashSet<String> getCommands(ProxiedPlayer player, HashMap<String, CWGroup> groups) {
public static HashSet<String> getCommands(ProxiedPlayer player) {
HashSet<String> commandList = new HashSet<>();
HashMap<String, CWGroup> groups = configCache.getGroupList();
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
if (s.getKey().equalsIgnoreCase("default"))
commandList.addAll(s.getValue().getCommands());
@@ -92,7 +88,8 @@ public final class CommandWhitelistWaterfall extends Plugin {
* @param player Bungee Player
* @return subcommands unavailable for the player
*/
public static HashSet<String> getSuggestions(ProxiedPlayer player, HashMap<String, CWGroup> groups) {
public static HashSet<String> getSuggestions(ProxiedPlayer player) {
HashMap<String, CWGroup> groups = configCache.getGroupList();
HashSet<String> suggestionList = new HashSet<>();
for (Map.Entry<String, CWGroup> s : groups.entrySet()) {
if (s.getKey().equalsIgnoreCase("default"))
@@ -29,14 +29,14 @@ public class BungeeChatEventListener implements Listener {
BungeeAudiences audiences = CommandWhitelistWaterfall.getAudiences();
String label = CommandUtil.getCommandLabel(command);
HashSet<String> commands = CommandWhitelistWaterfall.getCommands(player, configCache.getGroupList());
HashSet<String> commands = CommandWhitelistWaterfall.getCommands(player);
if (!commands.contains(label)) {
event.setCancelled(true);
CommandWhitelistWaterfall.getAudiences().player(player).sendMessage(MiniMessage.markdown().parse(configCache.prefix + configCache.command_denied));
return;
}
HashSet<String> bannedSubCommands = CommandWhitelistWaterfall.getSuggestions(player, configCache.getGroupList());
HashSet<String> bannedSubCommands = CommandWhitelistWaterfall.getSuggestions(player);
for (String bannedSubCommand : bannedSubCommands) {
if (command.toLowerCase().substring(1).startsWith(bannedSubCommand)) {
event.setCancelled(true);
@@ -17,7 +17,7 @@ public class WaterfallDefineCommandsListener implements Listener {
if (player.hasPermission("commandwhitelist.bypass"))
return;
HashMap<String, Command> commandHashMap = new HashMap<>();
CommandWhitelistWaterfall.getCommands(player, CommandWhitelistWaterfall.getConfigCache().getGroupList()).forEach(cmdName ->
CommandWhitelistWaterfall.getCommands(player).forEach(cmdName ->
CommandWhitelistWaterfall.getPlugin().getProxy().getPluginManager().getCommands()
.stream()
.filter(commandEntry -> cmdName.equalsIgnoreCase(commandEntry.getValue().getName()))
+1 -1
View File
@@ -74,7 +74,7 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.7.0</version>
<version>4.8.0</version>
<scope>compile</scope>
</dependency>
<dependency>