diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
index 7e61221c1..934f0d67c 100644
--- a/.idea/checkstyle-idea.xml
+++ b/.idea/checkstyle-idea.xml
@@ -10,10 +10,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/Essentials/src/main/java/com/earth2me/essentials/AlternativeCommandsHandler.java b/Essentials/src/main/java/com/earth2me/essentials/AlternativeCommandsHandler.java
index 16e8aff53..455c7ae5e 100644
--- a/Essentials/src/main/java/com/earth2me/essentials/AlternativeCommandsHandler.java
+++ b/Essentials/src/main/java/com/earth2me/essentials/AlternativeCommandsHandler.java
@@ -32,36 +32,30 @@ public class AlternativeCommandsHandler {
if (plugin.getDescription().getMain().contains("com.earth2me.essentials")) {
return;
}
- final List commands = getPluginCommands(plugin);
- final String pluginName = plugin.getDescription().getName().toLowerCase(Locale.ENGLISH);
+ for (final Map.Entry entry : getPluginCommands(plugin).entrySet()) {
+ final String commandName = entry.getKey().contains(":") ? entry.getKey().split(":")[1] : entry.getKey();
+ final Command command = entry.getValue();
- for (final Command command : commands) {
- final List labels = new ArrayList<>(command.getAliases());
- labels.add(command.getName());
-
- for (final String label : labels) {
- final List plugincommands = altcommands.computeIfAbsent(label.toLowerCase(Locale.ENGLISH), k -> new ArrayList<>());
- boolean found = false;
- for (final Command pc2 : plugincommands) {
- if (pc2 instanceof PluginIdentifiableCommand) {
- if (((PluginIdentifiableCommand) pc2).getPlugin().equals(plugin)) {
- found = true;
- break;
- }
- }
- }
- if (!found) {
- plugincommands.add(command);
+ final List pluginCommands = altcommands.computeIfAbsent(commandName.toLowerCase(Locale.ENGLISH), k -> new ArrayList<>());
+ boolean found = false;
+ for (final Command pc2 : pluginCommands) {
+ // Safe cast, everything that's added comes from getPluginCommands which already performs the cast check.
+ if (((PluginIdentifiableCommand) pc2).getPlugin().equals(plugin)) {
+ found = true;
+ break;
}
}
+ if (!found) {
+ pluginCommands.add(command);
+ }
}
}
- private List getPluginCommands(Plugin plugin) {
- final List commands = new ArrayList<>();
- for (Command cmd : ess.getKnownCommandsProvider().getKnownCommands().values()) {
- if (cmd instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) cmd).getPlugin().getName().equals(plugin.getName())) {
- commands.add(cmd);
+ private Map getPluginCommands(Plugin plugin) {
+ final Map commands = new HashMap<>();
+ for (final Map.Entry entry : ess.getKnownCommandsProvider().getKnownCommands().entrySet()) {
+ if (entry.getValue() instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) entry.getValue()).getPlugin().equals(plugin)) {
+ commands.put(entry.getKey(), entry.getValue());
}
}
return commands;
diff --git a/Essentials/src/main/java/com/earth2me/essentials/Essentials.java b/Essentials/src/main/java/com/earth2me/essentials/Essentials.java
index 69ec3eaac..537599abc 100644
--- a/Essentials/src/main/java/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/main/java/com/earth2me/essentials/Essentials.java
@@ -574,6 +574,9 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
public boolean onCommandEssentials(final CommandSender cSender, final Command command, final String commandLabel, final String[] args, final ClassLoader classLoader, final String commandPath, final String permissionPrefix, final IEssentialsModule module) {
// Allow plugins to override the command via onCommand
if (!getSettings().isCommandOverridden(command.getName()) && (!commandLabel.startsWith("e") || commandLabel.equalsIgnoreCase(command.getName()))) {
+ if (getSettings().isDebug()) {
+ LOGGER.log(Level.INFO, "Searching for alternative to: " + commandLabel);
+ }
final Command pc = alternativeCommandsHandler.getAlternative(commandLabel);
if (pc != null) {
alternativeCommandsHandler.executed(commandLabel, pc);
diff --git a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java
index 89e8b1430..7cbc3791d 100644
--- a/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/main/java/com/earth2me/essentials/commands/Commandessentials.java
@@ -134,18 +134,14 @@ public class Commandessentials extends EssentialsCommand {
// Lists commands that are being handed over to other plugins.
private void runCommands(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
- final StringBuilder disabledCommands = new StringBuilder();
- for (final Map.Entry entry : ess.getAlternativeCommandsHandler().disabledCommands().entrySet()) {
- if (disabledCommands.length() > 0) {
- disabledCommands.append("\n");
- }
- disabledCommands.append(entry.getKey()).append(" => ").append(entry.getValue());
- }
- if (disabledCommands.length() > 0) {
- sender.sendMessage(tl("blockList"));
- sender.sendMessage(disabledCommands.toString());
- } else {
+ if (ess.getAlternativeCommandsHandler().disabledCommands().size() == 0) {
sender.sendMessage(tl("blockListEmpty"));
+ return;
+ }
+
+ sender.sendMessage(tl("blockList"));
+ for (final Map.Entry entry : ess.getAlternativeCommandsHandler().disabledCommands().entrySet()) {
+ sender.sendMessage(entry.getKey() + " => " + entry.getValue());
}
}
diff --git a/gradle.properties b/gradle.properties
index aa4e563ab..a23d78a2a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,4 @@
org.gradle.cache=true
+org.gradle.caching=true
org.gradle.parallel=true
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
diff --git a/providers/PaperProvider/build.gradle b/providers/PaperProvider/build.gradle
index 32937ff09..464a04d2b 100644
--- a/providers/PaperProvider/build.gradle
+++ b/providers/PaperProvider/build.gradle
@@ -1,4 +1,4 @@
dependencies {
implementation project(':providers:BaseProviders')
- compileOnly 'com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT'
+ compileOnly 'com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT'
}