Literal extends LiteralCommandNode<T> implements Aliasable<T>, Mutable<T> { public static <T> Literal<T> alias(LiteralCommandNode<T> command, String alias) { var literal = new Literal<>(alias, new ArrayList<>(0), true, command.getCommand(), command.getRequirement(), command.getRedirect(), command.getRedirectModifier(), command.isFork()); for (var child : command.getChildren()) { literal.addChild(child); } if (command instanceof Aliasable<?>) { ((Aliasable<T>) command).aliases().add(literal); } return literal; } Literal(String name, Command<T> command, Predicate<T> requirement);  Literal(String name, Execution<T> execution, Predicate<T> requirement);  Literal(String name, Command<T> command, Predicate<T> requirement, @Nullable CommandNode<T> destination, RedirectModifier<T> modifier, boolean fork);  Literal(String name, List<LiteralCommandNode<T>> aliases, boolean alias, Command<T> command, Predicate<T> requirement, @Nullable CommandNode<T> destination, RedirectModifier<T> modifier, boolean fork); static Literal<T> alias(LiteralCommandNode<T> command, String alias); static Builder<T> builder(String name); static Builder<CommandSender> of(String name); @Override void addChild(CommandNode<T> child); @Override CommandNode<T> removeChild(String child); @Override List<LiteralCommandNode<T>> aliases(); @Override boolean isAlias(); @Override void setCommand(Command<T> command); @Override @Nullable CommandNode<T> getRedirect(); @Override void setRedirect(CommandNode<T> destination);  }
@Test void alias() { literal.addChild(argument); var alias = Literal.alias(literal, "alias"); assertEquals("alias", alias.getName()); assertTrue(alias.isAlias()); assertEquals(literal.getCommand(), alias.getCommand()); assertEquals(1, alias.getChildren().size()); assertTrue(literal.aliases().contains(alias)); }