public static void updatePlayers() {
Iterator iterator = waitingRoom.keySet().iterator();
System.out.println("Test 1");
while (iterator.hasNext()) {
Player player = (Player) iterator.next();
System.out.println("Test 2");
if (player != null) {
System.out.println("Test 3");
player.getPA().sendString("@yel@Start:" + ((gameStartTimer * 3) + (timeRemaining * 3)) + "", 199);
player.getPA().walkableInterface(197);
}
}
所以我一直在研究这个小游戏,我不确定我的迭代器发生了什么,但由于某些原因它不起作用。
问题是这个
while (iterator.hasNext()) {
Player player = (Player) iterator.next();
实际上它没有加载测试2,因此由于某种原因这不起作用。
支持检查加载我的迷你游戏计时器的大厅。
public static void startGame() {
if (getSaraPlayers() < 1 || getZammyPlayers() < 1) {
gameStartTimer = GAME_START_TIMER;
return;
}
gameStartTimer = -1;
System.out.println("Starting minigame.");
gameStarted = true;
timeRemaining = GAME_TIMER / 2;
Iterator iterator = waitingRoom.keySet().iterator();
while (iterator.hasNext()) {
Player player = (Player) iterator.next();
int team = waitingRoom.get(player);
if (player == null) {
continue;
}
player.getPA().walkableInterface(-1);
player.getPA().movePlayer(GAME_ROOM[team - 1][0] + Misc.random(3), GAME_ROOM[team - 1][1] - Misc.random(3), 1);
player.getPA().movePlayer(GAME_ROOM[team - 1][0] + Misc.random(3), GAME_ROOM[team - 1][1] - Misc.random(3), 1);
gameRoom.put(player, team);
}
waitingRoom.clear();
}