本文整理匯總了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();
}
示例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();
}
示例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();
}
示例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());
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}