Skip to content

Commit

Permalink
v0.8.0 : Bug fixed about issue #22.
Browse files Browse the repository at this point in the history
  • Loading branch information
ucchyocean committed Oct 4, 2015
1 parent ee53015 commit a02862e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/main/java/org/bitbucket/ucchy/fnafim/FNAFIMCommand.java
Expand Up @@ -613,8 +613,13 @@ public void switchCommand(
// 引数randomが指定された場合は、ランダムに選択して設定する。

ArrayList<String> temp = manager.getReadyArenaNames();
int index = (int)(Math.random() * temp.size());
arena = temp.get(index);
temp.remove(manager.getArenaName());
if ( temp.size() == 0 ) {
arena = manager.getArenaName();
} else {
int index = (int)(Math.random() * temp.size());
arena = temp.get(index);
}

} else {
// そのほかの場合は、指定されたアリーナ名に切り替える。
Expand Down
Expand Up @@ -17,6 +17,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;

/**
* Five Nights at Freddy's プラグイン
Expand Down Expand Up @@ -146,10 +147,16 @@ public void removeGameSession() {

// 自動開始設定なら、そのまま新しいセッションを生成する
if ( config.isAutoStartTimer() && pre == GameSessionPhase.END ) {
if ( config.isAutoStartTimerRandomArenaSwitch() ) {
command.switchCommand(Bukkit.getConsoleSender(), null, null, new String[]{"switch", "random"});
}
command.openCommand(Bukkit.getConsoleSender(), null, null, new String[]{"open", "silent"});

// 前回のセッションで全員がロビーにテレポートするのを待つため、5秒待つ。
new BukkitRunnable() {
public void run() {
if ( config.isAutoStartTimerRandomArenaSwitch() ) {
command.switchCommand(Bukkit.getConsoleSender(), null, null, new String[]{"switch", "random"});
}
command.openCommand(Bukkit.getConsoleSender(), null, null, new String[]{"open", "silent"});
}
}.runTaskLater(this, 5 * 20);
}
}

Expand Down
Expand Up @@ -429,7 +429,6 @@ public void cancelGame() {
*/
private void onEnd() {

phase = GameSessionPhase.END;
FiveNightsAtFreddysInMinecraft.getInstance().getJoinsignManager().updateAll();

// タイマーの停止
Expand Down Expand Up @@ -618,6 +617,7 @@ public void run() {
*/
protected void onGameover() {

phase = GameSessionPhase.END;
sendInGameTitle(Messages.get("Announce_GameOver1"));
sendInGameAnnounce(Messages.get("Announce_GameOver2"));
onEnd();
Expand Down Expand Up @@ -717,6 +717,7 @@ public void run() {
sendInGameAnnounce(Messages.get("Announce_GameClear2", "%players", winners.toString()));

// onEnd() を呼んで終了処理をしておく。
phase = GameSessionPhase.END;
onEnd();
}
}
Expand Down

0 comments on commit a02862e

Please sign in to comment.