本文整理匯總了Java中net.minecraft.command.CommandException.getErrorObjects方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandException.getErrorObjects方法的具體用法?Java CommandException.getErrorObjects怎麽用?Java CommandException.getErrorObjects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.command.CommandException
的用法示例。
在下文中一共展示了CommandException.getErrorObjects方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: func_175780_b
import net.minecraft.command.CommandException; //導入方法依賴的package包/類
private boolean func_175780_b(ICommandSender p_175780_1_, String[] p_175780_2_) throws CommandException
{
int i = -1;
for (int j = 0; j < p_175780_2_.length; ++j)
{
if (this.isUsernameIndex(p_175780_2_, j) && "*".equals(p_175780_2_[j]))
{
if (i >= 0)
{
throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
}
i = j;
}
}
if (i < 0)
{
return false;
}
else
{
List<String> list1 = Lists.newArrayList(this.getScoreboard().getObjectiveNames());
String s = p_175780_2_[i];
List<String> list = Lists.<String>newArrayList();
for (String s1 : list1)
{
p_175780_2_[i] = s1;
try
{
this.processCommand(p_175780_1_, p_175780_2_);
list.add(s1);
}
catch (CommandException commandexception)
{
ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
chatcomponenttranslation.getChatStyle().setColor(EnumChatFormatting.RED);
p_175780_1_.addChatMessage(chatcomponenttranslation);
}
}
p_175780_2_[i] = s;
p_175780_1_.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());
if (list.size() == 0)
{
throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
}
else
{
return true;
}
}
}
示例2: handleUserWildcards
import net.minecraft.command.CommandException; //導入方法依賴的package包/類
private boolean handleUserWildcards(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
int i = -1;
for (int j = 0; j < args.length; ++j)
{
if (this.isUsernameIndex(args, j) && "*".equals(args[j]))
{
if (i >= 0)
{
throw new CommandException("commands.scoreboard.noMultiWildcard", new Object[0]);
}
i = j;
}
}
if (i < 0)
{
return false;
}
else
{
List<String> list1 = Lists.newArrayList(this.getScoreboard(server).getObjectiveNames());
String s = args[i];
List<String> list = Lists.<String>newArrayList();
for (String s1 : list1)
{
args[i] = s1;
try
{
this.execute(server, sender, args);
list.add(s1);
}
catch (CommandException commandexception)
{
TextComponentTranslation textcomponenttranslation = new TextComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
sender.addChatMessage(textcomponenttranslation);
}
}
args[i] = s;
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ENTITIES, list.size());
if (list.isEmpty())
{
throw new WrongUsageException("commands.scoreboard.allMatchesFailed", new Object[0]);
}
else
{
return true;
}
}
}