本文整理汇总了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;
}
}
}