Add a ManagerSetting to override existing commands

This commit is contained in:
jmp 2020-12-03 21:06:09 -08:00 committed by Alexander Söderberg
parent 1ff5a2c4ce
commit ded94567c6
3 changed files with 15 additions and 1 deletions

View file

@ -24,6 +24,7 @@
package cloud.commandframework.bukkit;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import cloud.commandframework.arguments.CommandArgument;
import cloud.commandframework.arguments.StaticArgument;
import cloud.commandframework.internal.CommandRegistrationHandler;
@ -89,6 +90,11 @@ public class BukkitPluginRegistrationHandler<C> implements CommandRegistrationHa
this.bukkitCommandManager
);
if (this.bukkitCommandManager.getSetting(CommandManager.ManagerSettings.OVERRIDE_EXISTING_COMMANDS)) {
this.bukkitCommands.remove(label);
aliases.forEach(alias -> this.bukkitCommands.remove(alias));
}
for (final String alias : aliases) {
final String namespacedAlias = this.getNamespacedLabel(alias);