类org.bukkit.command.TabCompleter源码实例Demo

下面列出了怎么用org.bukkit.command.TabCompleter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: CombatLogX   文件: CombatLogX.java
@Override
public void registerCommand(String commandName, CommandExecutor executor, String description, String usage, String... aliases) {
    PluginCommand command = getCommand(commandName);
    if(command == null) {
        forceRegisterCommand(commandName, executor, description, usage, aliases);
        return;
    }
    command.setExecutor(executor);

    if(executor instanceof TabCompleter) {
        TabCompleter completer = (TabCompleter) executor;
        command.setTabCompleter(completer);
    }

    if(executor instanceof Listener) {
        Listener listener = (Listener) executor;
        PluginManager manager = Bukkit.getPluginManager();
        manager.registerEvents(listener, this);
    }
}
 
源代码2 项目: intake   文件: BukkitCommand.java
public BukkitCommand(
    Plugin plugin, CommandExecutor executor, TabCompleter completer, CommandMapping command) {
  super(
      command.getPrimaryAlias(),
      command.getDescription().getShortDescription(),
      "/" + command.getPrimaryAlias() + " " + command.getDescription().getUsage(),
      Lists.newArrayList(command.getAllAliases()));
  this.plugin = plugin;
  this.executor = executor;
  this.completer = completer;
  this.permissions = command.getDescription().getPermissions();
  super.setPermission(Joiner.on(';').join(permissions));
}
 
源代码3 项目: helper   文件: CommandMapUtil.java
/**
 * Registers a CommandExecutor with the server
 *
 * @param plugin the plugin instance
 * @param command the command instance
 * @param permission the command permission
 * @param permissionMessage the message sent when the sender doesn't the required permission
 * @param description the command description
 * @param aliases the command aliases
 * @param <T> the command executor class type
 * @return the command executor
 */
@Nonnull
public static <T extends CommandExecutor> T registerCommand(@Nonnull Plugin plugin, @Nonnull T command, String permission, String permissionMessage, String description, @Nonnull String... aliases) {
    Preconditions.checkArgument(aliases.length != 0, "No aliases");
    for (String alias : aliases) {
        try {
            PluginCommand cmd = COMMAND_CONSTRUCTOR.newInstance(alias, plugin);

            getCommandMap().register(plugin.getDescription().getName(), cmd);
            getKnownCommandMap().put(plugin.getDescription().getName().toLowerCase() + ":" + alias.toLowerCase(), cmd);
            getKnownCommandMap().put(alias.toLowerCase(), cmd);
            cmd.setLabel(alias.toLowerCase());
            if (permission != null) {
               cmd.setPermission(permission);
               if (permissionMessage != null) {
                   cmd.setPermissionMessage(permissionMessage);
               }
            }
            if (description != null) {
                cmd.setDescription(description);
            }

            cmd.setExecutor(command);
            if (command instanceof TabCompleter) {
                cmd.setTabCompleter((TabCompleter) command);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return command;
}
 
源代码4 项目: uSkyBlock   文件: ConfigCommand.java
@Override
public TabCompleter getTabCompleter() {
    return new AbstractTabCompleter() {
        @Override
        protected List<String> getTabList(CommandSender commandSender, String term) {
            return CONFIGS;
        }
    };
}
 
源代码5 项目: ShopChest   文件: ShopSubCommand.java
public ShopSubCommand(String name, boolean playerCommand, CommandExecutor executor, TabCompleter tabCompleter) {
    this.name = name;
    this.playerCommand = playerCommand;
    this.executor = executor;
    this.tabCompleter = tabCompleter;
}
 
源代码6 项目: NovaGuilds   文件: CommandWrapperImpl.java
@Override
public TabCompleter getTabCompleter() {
	return tabCompleter;
}
 
源代码7 项目: NovaGuilds   文件: CommandWrapperImpl.java
@Override
public void setTabCompleter(TabCompleter tabCompleter) {
	this.tabCompleter = tabCompleter;
}
 
源代码8 项目: NovaGuilds   文件: Command.java
@Override
public void setTabCompleter(TabCompleter tabCompleter) {
	throw new IllegalArgumentException("Not allowed for built in commands");
}
 
源代码9 项目: uSkyBlock   文件: GetIslandDataCommand.java
@Override
public TabCompleter getTabCompleter() {
    return tabCompleter;
}
 
源代码10 项目: uSkyBlock   文件: ImportCommand.java
@Override
public TabCompleter getTabCompleter() {
    return completer;
}
 
源代码11 项目: uSkyBlock   文件: SetIslandDataCommand.java
@Override
public TabCompleter getTabCompleter() {
    return tabCompleter;
}
 
源代码12 项目: uSkyBlock   文件: AdminCommand.java
public AdminCommand(final uSkyBlock plugin, ConfirmHandler confirmHandler, AnimationHandler animationHandler) {
    super("usb", null, marktr("Ultimate SkyBlock Admin"));
    OnlinePlayerTabCompleter playerCompleter = new OnlinePlayerTabCompleter();
    TabCompleter challengeCompleter = new ChallengeTabCompleter();
    TabCompleter allPlayerCompleter = new AllPlayerTabCompleter(playerCompleter);
    TabCompleter biomeCompleter = new BiomeTabCompleter();
    addTab("oplayer", playerCompleter);
    addTab("player", allPlayerCompleter);
    addTab("island", allPlayerCompleter);
    addTab("leader", allPlayerCompleter);
    addTab("challenge", challengeCompleter);
    addTab("biome", biomeCompleter);
    addTab("rank", new RankTabCompleter(plugin));
    add(new ReloadCommand());
    add(new ImportCommand());
    add(new GenTopTenCommand(plugin));
    //add(new RegisterIslandToPlayerCommand());
    add(new AdminChallengeCommand(plugin));
    add(new OrphanCommand(plugin));
    add(new AdminIslandCommand(plugin, confirmHandler));
    add(new PurgeCommand(plugin));
    add(new GotoIslandCommand(plugin));
    add(new AbstractPlayerInfoCommand("info", "usb.admin.info", marktr("show player-information")) {
        @Override
        protected void doExecute(CommandSender sender, PlayerInfo playerInfo) {
            sender.sendMessage(playerInfo.toString());
        }
    });
    add(new FlatlandFixCommand(plugin));
    add(new DebugCommand(plugin));
    add(new WGCommand(plugin));
    add(new VersionCommand(plugin));
    add(new CooldownCommand(plugin));
    add(new PerkCommand(plugin));
    add(new LanguageCommand(plugin));
    add(new FlushCommand(plugin));
    add(new JobsCommand(plugin));
    add(new ConfigCommand(plugin));
    add(new DocumentCommand(plugin, "doc", "usb.admin.doc"));
    add(new RegionCommand(plugin, animationHandler));
    add(new SetMaintenanceCommand(plugin));
    add(new NBTCommand());
    add(new ProtectAllCommand(plugin));
    add(new ChunkCommand(plugin));
}
 
源代码13 项目: NovaGuilds   文件: Command.java
/**
 * The constructor
 *
 * @param permission     the permission
 * @param genericCommand the generic command string
 * @param usageMessage   the usage message
 * @param tabCompleter   tab completer instance
 * @param flags          command flags
 */
private Command(Class<? extends CommandExecutor> commandExecutorClass, Permission permission, String genericCommand, MessageWrapper usageMessage, TabCompleter tabCompleter, Flag... flags) {
	this.permission = permission;
	this.usageMessage = usageMessage;
	this.genericCommand = genericCommand;
	this.tabCompleter = tabCompleter;
	this.clazz = commandExecutorClass;
	Collections.addAll(this.flags, flags);
}
 
源代码14 项目: NovaGuilds   文件: CommandWrapper.java
/**
 * Gets tab completer
 *
 * @return tab completer instance
 */
TabCompleter getTabCompleter();
 
源代码15 项目: NovaGuilds   文件: CommandWrapper.java
/**
 * Sets the tab completer
 *
 * @param tabCompleter tab completer
 */
void setTabCompleter(TabCompleter tabCompleter);
 
源代码16 项目: NovaGuilds   文件: Command.java
/**
 * The constructor
 *
 * @param permission     the permission
 * @param genericCommand the generic command string
 * @param tabCompleter   tab completer instance
 * @param flags          command flags
 */
private Command(Class<? extends CommandExecutor> commandExecutorClass, Permission permission, String genericCommand, TabCompleter tabCompleter, Flag... flags) {
	this(commandExecutorClass, permission, genericCommand, null, tabCompleter, flags);
}
 
 类所在包
 同包方法