令牌“<”上的语法错误,AssignmentOperator无效

时间:2015-07-20 02:57:58

标签: java

public void run() {       This line is fine
    OpenCrate.this.results.put(p, Integer.valueOf(((Integer)OpenCrate.this.results.get(p)).intValue() + 1)); This line is fine
    for (int i = 0; i < 27; i++) {   This line is fine
      ItemStack it = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)(new Random().nextInt(15) + 1));         This line is fine
      m = it.getItemMeta();          This line is fine
      m.setDisplayName(" ");         This line is fine
      it.setItemMeta(m);             This line is fine
      inv.setItem(i, it);            This line is fine
    }
    List longlist = new ArrayList(); This line is fine
    String s;                        This line is fine
    int i;                           This line is fine
    for (ItemMeta m = CrateResult.getResults().iterator(); m.hasNext(); This line is fine
      i < new CrateResult(s).getChance())  *The Error shows in this line*
    {
      s = (String)m.next();       This line is fine
      i = 0; continue;            This line is fine
      longlist.add(s);            This line is fine

      i++;                        This line is fine
    }

我在这个符号“&lt;”上得到了这个错误作为无效的分配,这是MC插件。 请帮忙。

3 个答案:

答案 0 :(得分:2)

您的for循环语法错误。它应该是for (initialization; condition; assignment),但您正在执行for (initialization; condition; condition);

如果您有多个条件,可以使用和&&运算符组合它们。

答案 1 :(得分:0)

您错过for循环末尾的&&以及for (ItemMeta m = CrateResult.getResults().iterator(); m.hasNext() && i < new CrateResult(s).getChance());) { //... } 运算符。 你必须做到:

{{1}}

答案 2 :(得分:0)

因为for循环的第三部分用于存储值(不测试条件)。我怀疑你想要&&喜欢

for (ItemMeta m = CrateResult.getResults().iterator(); m.hasNext() &&
        i < new CrateResult(s).getChance();) {