Dispatcher extends CommandDispatcher<CommandSender> implements Listener { public void update() { walker.prune(dispatcher.getRoot(), getRoot().getChildren()); for (var player : server.server.getOnlinePlayers()) { player.updateCommands(); } } protected  Dispatcher(Server server, Root root); static Dispatcher of(Plugin plugin); void register(Map<String, CommandNode<CommandSender>> commands); Literal<CommandSender> register(Literal.Builder<CommandSender> command); void update(); @Override Root getRoot();  }
@Test void update() { var player = mock(CraftPlayer.class); when(craftserver.getOnlinePlayers()).thenReturn(List.of(player)); dispatcher.getRoot().addChild(Literal.of("a").build()); dispatcher.update(); assertNotNull(dispatcher.dispatcher.getRoot().getChild("a")); verify(player).updateCommands(); }