Search in sources :

Example 1 with SubjectMenu

use of com.gmail.stefvanschiedev.buildinggame.utils.guis.SubjectMenu in project buildinggame by stefvanschie.

the class Arena method nextMatch.

/**
 * Moves on to the next match or stops the game if all matches have been played. This won't cancel any timers, and
 * if called incorrectly this will mess with the arena resulting in incorrect behaviour.
 *
 * @since 4.0.6
 */
public void nextMatch() {
    YamlConfiguration arenas = SettingsManager.getInstance().getArenas();
    setState(GameState.WAITING);
    this.lobbyTimer = new LobbyTimer(arenas.getInt(name + ".lobby-timer"), this);
    this.buildTimer = new BuildTimer(arenas.getInt(name + ".timer"), this);
    this.voteTimer = new VoteTimer(arenas.getInt(name + ".vote-timer"), this);
    this.winTimer = new WinTimer(arenas.getInt(name + ".win-timer"), this);
    voteScoreboards.replaceAll((plot, voteScoreboard) -> new VoteScoreboard(this));
    subject = null;
    setFirstPlot(null);
    setSecondPlot(null);
    setThirdPlot(null);
    getVotedPlots().clear();
    getUsedPlots().forEach(plot -> {
        plot.getTimesVoted().clear();
        plot.getVotes().clear();
        plot.getAllGamePlayers().forEach(gamePlayer -> {
            var player = gamePlayer.getPlayer();
            player.setPlayerTime(player.getWorld().getFullTime(), true);
            player.resetPlayerWeather();
        });
    });
    getPlots().forEach(plot -> {
        plot.restore();
        var entities = plot.getEntities();
        entities.keySet().forEach(Entity::remove);
        entities.clear();
    });
    subjectMenu = new SubjectMenu();
    SignManager.getInstance().updateJoinSigns(this);
    if (matches == maxMatches)
        stop();
    else
        postStart();
}
Also used : Entity(org.bukkit.entity.Entity) WinTimer(com.gmail.stefvanschiedev.buildinggame.timers.WinTimer) LobbyTimer(com.gmail.stefvanschiedev.buildinggame.timers.LobbyTimer) VoteTimer(com.gmail.stefvanschiedev.buildinggame.timers.VoteTimer) SubjectMenu(com.gmail.stefvanschiedev.buildinggame.utils.guis.SubjectMenu) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) BuildTimer(com.gmail.stefvanschiedev.buildinggame.timers.BuildTimer)

Aggregations

BuildTimer (com.gmail.stefvanschiedev.buildinggame.timers.BuildTimer)1 LobbyTimer (com.gmail.stefvanschiedev.buildinggame.timers.LobbyTimer)1 VoteTimer (com.gmail.stefvanschiedev.buildinggame.timers.VoteTimer)1 WinTimer (com.gmail.stefvanschiedev.buildinggame.timers.WinTimer)1 SubjectMenu (com.gmail.stefvanschiedev.buildinggame.utils.guis.SubjectMenu)1 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)1 Entity (org.bukkit.entity.Entity)1