當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.copyPartialMatches方法代碼示例

本文整理匯總了Java中org.bukkit.util.StringUtil.copyPartialMatches方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.copyPartialMatches方法的具體用法?Java StringUtil.copyPartialMatches怎麽用?Java StringUtil.copyPartialMatches使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.bukkit.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.copyPartialMatches方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
{
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1)
    {
        return StringUtil.copyPartialMatches(args[0], COMMANDS, new ArrayList<String>(COMMANDS.size()));
    }
    if (((args.length == 2) && "get".equalsIgnoreCase(args[0])) || "set".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], MinecraftServer.getServer().tileEntityConfig.getSettings().keySet(), new ArrayList<String>(MinecraftServer.getServer().tileEntityConfig.getSettings().size()));
    }

    return ImmutableList.of();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:19,代碼來源:TileEntityCommand.java

示例2: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender,String alias,String[] args){
    Validate.notNull(sender,"Sender cannot be null");
    Validate.notNull(args,"Arguments cannot be null");
    Validate.notNull(alias,"Alias cannot be null");

    if(args.length==1){
        return StringUtil.copyPartialMatches(args[0],COMMANDS,new ArrayList<String>(COMMANDS.size()));
    }
    if(((args.length==2)&&"get".equalsIgnoreCase(args[0]))||"set".equalsIgnoreCase(args[0])){
        MinecraftServer.getServer();
        MinecraftServer.getServer();
        return StringUtil.copyPartialMatches(args[1],MinecraftServer.entityConfig.getSettings().keySet(),new ArrayList<String>(MinecraftServer.tileEntityConfig.getSettings().size()));
    }

    return ImmutableList.of();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:18,代碼來源:EntityCommand.java

示例3: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
{
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1)
    {
        return StringUtil.copyPartialMatches(args[0], COMMANDS, new ArrayList<String>(COMMANDS.size()));
    }
    if (((args.length == 2) && "get".equalsIgnoreCase(args[0])) || "set".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], MinecraftServer.getServer().cauldronConfig.getSettings().keySet(), new ArrayList<String>(MinecraftServer.getServer().cauldronConfig.getSettings().size()));
    }
    else if ((args.length == 2) && "chunks".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], CHUNK_COMMANDS, new ArrayList<String>(CHUNK_COMMANDS.size()));
    }

    return ImmutableList.of();
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:23,代碼來源:CauldronCommand.java

示例4: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
    List<String> list = Lists.newArrayList();

    if (args.length != 1) {
        return Lists.newArrayList();
    }

    list.add("info");

    if (sender.hasPermission(PERMISSION)) {
        list.add("enable");
        list.add("disable");
    }

    return StringUtil.copyPartialMatches(args[args.length - 1], list, Lists.newArrayList());
}
 
開發者ID:LeonTG,項目名稱:NineSlots,代碼行數:18,代碼來源:NineSlotsCommand.java

示例5: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
	List<String> list;
	if (args.length <= 1) {
		list = new ArrayList<>(subCommandMap.keySet());
	} else {
		AbstractSubCommand subCommand = subCommandMap.get(args[0].toLowerCase());
		if (subCommand == null) {
			return null;
		}
		list = subCommand.onTabComplete(sender, Arrays.copyOfRange(args, 1, args.length));
	}

	if (list == null || list.isEmpty()) {
		return null;
	}
	List<String> result = new ArrayList<>();
	StringUtil.copyPartialMatches(args[args.length - 1], list, result);
	return result;
}
 
開發者ID:jiongjionger,項目名稱:NeverLag,代碼行數:21,代碼來源:CommandDispatcher.java

示例6: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1) {
        return StringUtil.copyPartialMatches(args[0], Arrays.asList(getGameWorld(sender).getGameRules()), new ArrayList<String>());
    }

    if (args.length == 2) {
        return StringUtil.copyPartialMatches(args[1], GAMERULE_STATES, new ArrayList<String>(GAMERULE_STATES.size()));
    }

    return ImmutableList.of();
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:17,代碼來源:GameRuleCommand.java

示例7: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1) {
        return super.tabComplete(sender, alias, args);
    }

    if (args.length == 2) {
        return StringUtil.copyPartialMatches(args[1], ENCHANTMENT_NAMES, new ArrayList<String>(ENCHANTMENT_NAMES.size()));
    }

    if (args.length == 3 || args.length == 4) {
        if (!args[args.length - 2].equalsIgnoreCase("force")) {
            return ImmutableList.of("force");
        }
    }

    return ImmutableList.of();
 }
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:23,代碼來源:EnchantCommand.java

示例8: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {

    if (!sender.hasPermission(permission)) {
        return null;
    }

    List<String> list = new ArrayList<>();

    if (args.length == 1) {
        List<String> tabs = new ArrayList<>();
        for (ToggleSettings t : ToggleSettings.getList()) {
            if (t.isHide()) {
                continue;
            }
            if (!sender.hasPermission(t.getPermission())) {
                continue;
            }
            for (String key : t.getToggles().keySet()) {
                tabs.add(key);
            }
        }
        StringUtil.copyPartialMatches(args[0], tabs, list);
    }
    return list;
}
 
開發者ID:niwaniwa,項目名稱:WhiteEggCore,代碼行數:27,代碼來源:WhiteEggToggleCommand.java

示例9: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
    if (!sender.hasPermission(permission)) {
        return null;
    }
    List<String> list = new ArrayList<>();

    if (args.length == 1) {
        List<String> tabs = new ArrayList<>();
        tabs.add("reload");
        tabs.add("lock");
        tabs.add("alt");
        tabs.add("settings");
        tabs.add("system");
        StringUtil.copyPartialMatches(args[0], tabs, list);
    } else if (args.length >= 2) {
        List<String> players = new ArrayList<>();
        if (args[1].startsWith("$")) {
            Bukkit.getOnlinePlayers().forEach(p -> players.add("$" + p.getUniqueId().toString()));
        } else {
            Bukkit.getOnlinePlayers().forEach(p -> players.add(p.getName()));
        }
        StringUtil.copyPartialMatches(args[1], players, list);
    }
    return list;
}
 
開發者ID:niwaniwa,項目名稱:WhiteEggCore,代碼行數:27,代碼來源:WhiteEggCoreCommand.java

示例10: tabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
{
    Validate.notNull(sender, "Sender cannot be null");
    Validate.notNull(args, "Arguments cannot be null");
    Validate.notNull(alias, "Alias cannot be null");

    if (args.length == 1)
    {
        return StringUtil.copyPartialMatches(args[0], COMMANDS, new ArrayList<String>(COMMANDS.size()));
    }
    if (((args.length == 2) && "get".equalsIgnoreCase(args[0])) || "set".equalsIgnoreCase(args[0]))
    {
        return StringUtil.copyPartialMatches(args[1], MinecraftServer.getServer().sushchestvoConfig.getSettings().keySet(), new ArrayList<String>(MinecraftServer.getServer().sushchestvoConfig.getSettings().size()));
    }

    return ImmutableList.of();
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos,代碼行數:19,代碼來源:SushchestvoCommand.java

示例11: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
    List<String> completions = new ArrayList<>();
    if (args.length == 1) {
        List<String> commands = new ArrayList<>();
        if (sender.hasPermission("internetsearch.help")) commands.add("help");
        if (sender.hasPermission("internetsearch.reload")) commands.add("reload");

        StringUtil.copyPartialMatches(args[0], commands, completions);
    }
    Collections.sort(completions);
    return completions;
}
 
開發者ID:Pixelhash,項目名稱:InternetSearch,代碼行數:14,代碼來源:IntsTabCompletion.java

示例12: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String s, String[] args) {
	// The possible completions
	List<String> completions = new ArrayList<>();
	// Gets the matches
	StringUtil.copyPartialMatches(args[0], SUB_COMMANDS, completions);
	// Sort the completions
	Collections.sort(completions);
	return completions;
}
 
開發者ID:RadBuilder,項目名稱:EmojiChat,代碼行數:11,代碼來源:EmojiChatTabComplete.java

示例13: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
	if (sender.hasPermission("lsfight.admin")) {
		if (args.length == 1) {
			return StringUtil.copyPartialMatches(args[0], completationsComPerm, new ArrayList<String>(completationsComPerm.size()));
		}
	} else {
		if (args.length == 1) {
			return StringUtil.copyPartialMatches(args[0], completationsSemPerm, new ArrayList<String>(completationsSemPerm.size()));
		}
	}
	return ImmutableList.of();
}
 
開發者ID:leonardosnt,項目名稱:OldBukkit,代碼行數:14,代碼來源:FightTabCompleter.java

示例14: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
	if (args.length == 1) {
		if (sender.hasPermission("lsmvp.admin")) {
			return StringUtil.copyPartialMatches(args[0], Arrays.asList(completations), new ArrayList<String>(completations.length));
		} else {
			return StringUtil.copyPartialMatches(args[0], Arrays.asList(completations[0], completations[1]), new ArrayList<String>(completations.length));
		}
	}
	return ImmutableList.of();
	
}
 
開發者ID:leonardosnt,項目名稱:OldBukkit,代碼行數:13,代碼來源:MvpTabCompleter.java

示例15: onTabComplete

import org.bukkit.util.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
	if (Utils.isAuthorized(sender)) {
		if (args.length == 1) {
			return StringUtil.copyPartialMatches(args[0], c2, new ArrayList<String>(c2.size()));
		}
	} else {
		if (args.length == 1) {
			return StringUtil.copyPartialMatches(args[0], c1, new ArrayList<String>(c1.size()));
		}
	}

	return null;
}
 
開發者ID:leonardosnt,項目名稱:OldBukkit,代碼行數:15,代碼來源:PinTabCompleter.java


注:本文中的org.bukkit.util.StringUtil.copyPartialMatches方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。