Refactor an Instance model out of the GameRunner

This commit is contained in:
2022-09-11 17:34:16 +02:00
parent 83e6139acc
commit 9b0bdfddc8
11 changed files with 66 additions and 33 deletions

View File

@@ -4,6 +4,7 @@ import gg.malloc.defense.model.Arena;
import gg.malloc.defense.model.Game;
import gg.malloc.defense.model.Spawner;
import gg.malloc.defense.model.Waypoint;
import gg.malloc.defense.model.Instance;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
@@ -20,6 +21,7 @@ import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Collection;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.GameRule;
@@ -37,7 +39,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.inventory.ItemStack;
public class GameRunner {
public class GameRunner implements Instance {
GameState m_state;
Arena m_arena;
@@ -53,14 +55,6 @@ public class GameRunner {
Logger m_log;
public enum Stage {
Idle,
Warmup,
Countdown,
Playing,
GameOver
}
TickTask m_fuseTask;
TickTask m_countdownTask;
TickTask m_lobbyReturnTask;
@@ -262,6 +256,12 @@ public class GameRunner {
return true;
}
UUID m_id = UUID.randomUUID();
public UUID getId() {
return m_id;
}
public Collection<Player> getPlayers() {
return m_players.getPlayers();
}