所以我有这些代码,我的for循环有问题.
@EventHandler
public void onPistonExtend(BlockPistonExtendEvent event)
{
if (TownStones.blockPistons)
{
List<Block> pushedBlocks = event.getBlocks();
Material theMaterial = null;
int end = TownStones.blocks;
boolean done = false;
if (pushedBlocks != null) {
for (Iterator localIterator = pushedBlocks.iterator(); localIterator.hasNext(); !done)
{
Block theBlock = (Block)localIterator.next();
theMaterial = theBlock.getType();
done = false;
int i = 0; continue;
if (theMaterial == Material.getMaterial(TownStones.blockType[i]))
{
event.setCancelled(true);
done = true;
}
else if (i > end)
{
done = true;
}
i++;
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
Intellij …