The class Games.java is the central object for a game. However, some methods and fields can be outsourced to manager classes to keep the Games class a bit more manageable. The following is a suggestion for outsourcing:
Games.java
NEW: method TaskManager()
Moving from Game.java to TaskManager.java
field Timer timer (+ Getter)
field BukkitTask bt (+ Getter)
With this investigation, a runtime issue was also found and fixed that did not correctly reset the player datas after the GameState.END phase, because the EventListeners were already disabled. In addition, the game duration (currently for the scoreboard) was cached for the GameState.END phase.
The class
Games.java
is the central object for a game. However, some methods and fields can be outsourced to manager classes to keep the Games class a bit more manageable. The following is a suggestion for outsourcing:Games.java
Moving from
Game.java
toTaskManager.java
With this investigation, a runtime issue was also found and fixed that did not correctly reset the player datas after the
GameState.END
phase, because the EventListeners were already disabled. In addition, the game duration (currently for the scoreboard) was cached for theGameState.END
phase.