Archiviert
13
0

tower-generator #6

Zusammengeführt
YoyoNow hat 16 Commits von tower-generator nach master 2023-09-23 21:29:06 +02:00 zusammengeführt
4 geänderte Dateien mit 66 neuen und 0 gelöschten Zeilen
Nur Änderungen aus Commit b6a668b393 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -30,5 +30,6 @@ SERVER_RESET=
KEY_NAME=§eKey
KEY_FOUND=§a{0} §7found a key§8!
GAME_TIE=§aThe game ended in a tie§8!
GAME_TIME=§a{0}:{1}
COMMAND_START=§aThe game will start soon§8!

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.message.Message;
import de.steamwar.towerrun.commands.StartCommand;
import de.steamwar.towerrun.config.WorldConfig;
import de.steamwar.towerrun.countdowns.EndCountdown;
import de.steamwar.towerrun.countdowns.GameCountdown;
import de.steamwar.towerrun.countdowns.LobbyCountdown;
import de.steamwar.towerrun.game.TowerRunGame;
import de.steamwar.towerrun.generator.TowerGenerator;
@ -72,6 +73,7 @@ public class TowerRun extends JavaPlugin {
final LobbyCountdown lobbyCountdown = new LobbyCountdown();
new EndCountdown(lobbyCountdown);
new StartCommand(lobbyCountdown);
new GameCountdown();
TowerRunGame.reset();
}

Datei anzeigen

@ -36,6 +36,7 @@ public class Config {
public static final int MIN_PLAYERS;
public static final int LOBBY_TIMER;
public static final Set<Material> DESTROYABLE_BLOCKS;
public static final int GAME_TIMER;
static {
File configFile = new File(TowerRun.getInstance().getDataFolder(), "config.yml");
@ -48,6 +49,7 @@ public class Config {
MIN_PLAYERS = config.getInt("minPlayers");
LOBBY_TIMER = config.getInt("lobbyTimer");
GAME_TIMER = config.getInt("gameTimer", 20 * 60);
DESTROYABLE_BLOCKS = EnumSet.copyOf(config.getStringList("destroyable").stream().map(Material::valueOf).collect(Collectors.toSet()));
}

Datei anzeigen

@ -0,0 +1,61 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2023 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.towerrun.countdowns;
import de.steamwar.towerrun.TowerRun;
import de.steamwar.towerrun.config.Config;
import de.steamwar.towerrun.game.TowerRunGame;
import de.steamwar.towerrun.state.GameStates;
import java.util.EnumSet;
public class GameCountdown extends Countdown {
public GameCountdown() {
super(EnumSet.of(GameStates.INGAME));
}
@Override
int defaultTime() {
return Config.GAME_TIMER;
}
@Override
void timerEnd() {
if (TowerRunGame.PLAYERS_ESCAPED.isEmpty()) {
TowerRunGame.tie();
} else {
TowerRunGame.win(TowerRunGame.PLAYERS_ESCAPED.get(TowerRunGame.PLAYERS_ESCAPED.size() - 1));
}
}
@Override
boolean timerShouldCancel() {
return false;
}
@Override
void run() {
int timeMinutes = Math.floorDiv(time, 60);
int timeSeconds = time % 60;
TowerRun.getMessage().broadcastActionbar("GAME_TIME", timeMinutes, timeSeconds);
}
}