SpigotMap implements PlatformMap { DispatcherCommand wrap(LiteralCommandNode<CommandSender> command) { var aliases = new ArrayList<String>(); if (command instanceof Aliasable<?>) { for (var alias : ((Aliasable<?>) command).aliases()) { aliases.add(alias.getName()); } } return new DispatcherCommand(command.getName(), plugin, dispatcher, command.getUsageText(), aliases); } SpigotMap(String prefix, Plugin plugin, CraftCommandMap map); @Override @Nullable DispatcherCommand register(LiteralCommandNode<CommandSender> command); @Override @Nullable DispatcherCommand unregister(String name);  }
@Test void wrap_aliasable() { var command = map.wrap(literal); assertEquals("literal", command.getName()); assertEquals("literal", command.getUsage()); assertEquals(plugin, command.getPlugin()); assertEquals(dispatcher, command.dispatcher); assertEquals(List.of("l"), command.getAliases()); }
@Test void wrap_non_aliasable() { var command = map.wrap(node); assertEquals(null, command.getName()); assertEquals("/null", command.getUsage()); assertEquals(plugin, command.getPlugin()); assertEquals(dispatcher, command.dispatcher); assertEquals(List.of(), command.getAliases()); }