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插件。 请帮忙。
答案 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();) {