我有一个 void,当它被调用时,它会发送一个并发修改异常。我不明白为什么我一直得到它,即使我没有看到正在执行任何并发修改。
public static void destroyPlayingGame() {
for (CastleWarBarricade npc : playingGame.barricades) {
playingGame.removeBarricade(CastleWars.SARADOMIN, npc);
playingGame.removeBarricade(CastleWars.ZAMORAK, npc);
}
for (WorldObject object : playingGame.spawnedObjects)
World.destroySpawnedObject(object, false);
for (CastleWarBarricade npc : playingGame.barricades)
npc.finish();
playingGame.spawnedObjects.clear();
playingGame.barricades.clear();
playingGame.cancel();
playingGame = null;
refreshAllPlayersTime();
leavePlayersSafely();
}