Test CommandManager

This commit is contained in:
Hugo Manrique
2021-06-07 14:36:41 +02:00
parent d429d8383d
commit ea716c15c6
5 changed files with 188 additions and 20 deletions

View File

@@ -46,6 +46,7 @@ import net.kyori.adventure.identity.Identity;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.checkerframework.checker.lock.qual.GuardedBy;
import org.jetbrains.annotations.VisibleForTesting;
public class VelocityCommandManager implements CommandManager {
@@ -238,9 +239,9 @@ public class VelocityCommandManager implements CommandManager {
return dispatcher.getRoot().getChild(alias.toLowerCase(Locale.ENGLISH)) != null;
}
public CommandDispatcher<CommandSource> getDispatcher() {
// TODO Can we remove this? This is only used by tests, and constitutes unsafe publication.
return dispatcher;
@VisibleForTesting // this constitutes unsafe publication
RootCommandNode<CommandSource> getRoot() {
return dispatcher.getRoot();
}
public CommandGraphInjector<CommandSource> getInjector() {