本文整理匯總了Java中net.minecraft.command.CommandBase.doesStringStartWith方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandBase.doesStringStartWith方法的具體用法?Java CommandBase.doesStringStartWith怎麽用?Java CommandBase.doesStringStartWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.command.CommandBase
的用法示例。
在下文中一共展示了CommandBase.doesStringStartWith方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTabCompletionOptions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
/**
* @author jamierocks - 15th May 2015
* @reason Add Canary tab-completion results
*/
@Overwrite
public List<String> getTabCompletionOptions(ICommandSender sender, String input, BlockPos pos) {
final String[] commandSplit = input.split(" ", -1);
final String commandName = commandSplit[0];
if (commandSplit.length == 1) {
final List<String> matches = Lists.newArrayList();
// Neptune - Add Canary command matches
matches.addAll(Canary.commands().matchCommandNames((MessageReceiver) sender, commandName, false));
// Neptune - end
for (final Map.Entry<String, ICommand> alias : this.commandMap.entrySet()) {
if (CommandBase.doesStringStartWith(commandName, alias.getKey()) && alias.getValue().canCommandSenderUseCommand(sender)) {
matches.add(alias.getKey());
}
}
return matches;
} else {
if (commandSplit.length > 1) {
// Neptune - Tab complete through Canary if possible
final List<String> options = Canary.commands().tabComplete((MessageReceiver) sender, commandName, CommandHandler.dropFirstString(commandSplit));
if (options != null) {
return options;
}
// Neptune - end
final ICommand command = this.commandMap.get(commandName);
if (command != null && command.canCommandSenderUseCommand(sender)) {
return command.addTabCompletionOptions(sender, CommandHandler.dropFirstString(commandSplit), pos);
}
}
return null;
}
}
示例2: getListTabOptions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
protected List<String> getListTabOptions(String name, Collection<String> possibilities){
List<String> options = new ArrayList<String>();
for(String item : possibilities){
if(CommandBase.doesStringStartWith(name, item)){
options.add(item);
}
}
return options;
}
示例3: getTabCompletions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
public List<String> getTabCompletions(ICommandSender sender, String input, BlockPos pos)
{
List<String> list = Lists.<String>newArrayList();
if (input.startsWith("/"))
{
input = input.substring(1);
boolean flag = !input.contains(" ");
List<String> list1 = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (list1 != null)
{
for (String s2 : list1)
{
if (flag)
{
list.add("/" + s2);
}
else
{
list.add(s2);
}
}
}
return list;
}
else
{
String[] astring = input.split(" ", -1);
String s = astring[astring.length - 1];
for (String s1 : this.serverConfigManager.getAllUsernames())
{
if (CommandBase.doesStringStartWith(s, s1))
{
list.add(s1);
}
}
return list;
}
}
示例4: getTabCompletions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
public List<String> getTabCompletions(ICommandSender sender, String input, @Nullable BlockPos pos, boolean hasTargetBlock)
{
List<String> list = Lists.<String>newArrayList();
boolean flag = input.startsWith("/");
if (flag)
{
input = input.substring(1);
}
if (!flag && !hasTargetBlock)
{
String[] astring = input.split(" ", -1);
String s2 = astring[astring.length - 1];
for (String s1 : this.playerList.getAllUsernames())
{
if (CommandBase.doesStringStartWith(s2, s1))
{
list.add(s1);
}
}
return list;
}
else
{
boolean flag1 = !input.contains(" ");
List<String> list1 = this.commandManager.getTabCompletionOptions(sender, input, pos);
if (!list1.isEmpty())
{
for (String s : list1)
{
if (flag1)
{
list.add("/" + s);
}
else
{
list.add(s);
}
}
}
return list;
}
}
示例5: getPossibleCompletions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
/**
* If par2Str begins with /, then it searches for commands, otherwise it returns players.
*/
public List getPossibleCompletions(ICommandSender par1ICommandSender, String par2Str)
{
ArrayList var3 = new ArrayList();
if (par2Str.startsWith("/"))
{
par2Str = par2Str.substring(1);
boolean var10 = !par2Str.contains(" ");
List var11 = this.commandManager.getPossibleCommands(par1ICommandSender, par2Str);
if (var11 != null)
{
Iterator var12 = var11.iterator();
while (var12.hasNext())
{
String var13 = (String)var12.next();
if (var10)
{
var3.add("/" + var13);
}
else
{
var3.add(var13);
}
}
}
return var3;
}
else
{
String[] var4 = par2Str.split(" ", -1);
String var5 = var4[var4.length - 1];
String[] var6 = this.serverConfigManager.getAllUsernames();
int var7 = var6.length;
for (int var8 = 0; var8 < var7; ++var8)
{
String var9 = var6[var8];
if (CommandBase.doesStringStartWith(var5, var9))
{
var3.add(var9);
}
}
return var3;
}
}
示例6: getPossibleCompletions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
public List getPossibleCompletions(ICommandSender p_71248_1_, String p_71248_2_)
{
ArrayList arraylist = new ArrayList();
if (p_71248_2_.startsWith("/"))
{
p_71248_2_ = p_71248_2_.substring(1);
boolean flag = !p_71248_2_.contains(" ");
List list = this.commandManager.getPossibleCommands(p_71248_1_, p_71248_2_);
if (list != null)
{
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
String s3 = (String)iterator.next();
if (flag)
{
arraylist.add("/" + s3);
}
else
{
arraylist.add(s3);
}
}
}
return arraylist;
}
else
{
String[] astring = p_71248_2_.split(" ", -1);
String s1 = astring[astring.length - 1];
String[] astring1 = this.serverConfigManager.getAllUsernames();
int i = astring1.length;
for (int j = 0; j < i; ++j)
{
String s2 = astring1[j];
if (CommandBase.doesStringStartWith(s1, s2))
{
arraylist.add(s2);
}
}
return arraylist;
}
}
示例7: getPossibleCompletions
import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
/**
* If par2Str begins with /, then it searches for commands, otherwise it returns players.
*/
public List getPossibleCompletions(ICommandSender par1ICommandSender, String par2Str)
{
ArrayList arraylist = new ArrayList();
if (par2Str.startsWith("/"))
{
par2Str = par2Str.substring(1);
boolean flag = !par2Str.contains(" ");
List list = this.commandManager.getPossibleCommands(par1ICommandSender, par2Str);
if (list != null)
{
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
String s1 = (String)iterator.next();
if (flag)
{
arraylist.add("/" + s1);
}
else
{
arraylist.add(s1);
}
}
}
return arraylist;
}
else
{
String[] astring = par2Str.split(" ", -1);
String s2 = astring[astring.length - 1];
String[] astring1 = this.serverConfigManager.getAllUsernames();
int i = astring1.length;
for (int j = 0; j < i; ++j)
{
String s3 = astring1[j];
if (CommandBase.doesStringStartWith(s2, s3))
{
arraylist.add(s3);
}
}
return arraylist;
}
}