Make TowerRun Event System Capable

This commit is contained in:
2025-02-01 22:58:49 +01:00
parent 90666e2d20
commit 414bd20eb9
5 changed files with 65 additions and 7 deletions
@@ -20,7 +20,9 @@
package de.steamwar.towerrun.game;
import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.towerrun.TowerRun;
import de.steamwar.towerrun.config.Config;
import de.steamwar.towerrun.config.WorldConfig;
import de.steamwar.towerrun.state.GameState;
import de.steamwar.towerrun.state.GameStates;
@@ -64,7 +66,6 @@ public class TowerRunGame {
public static void start() {
if (GameState.getCurrentState() == GameStates.GENERATING_TOWER) {
PLAYERS_ALIVE.addAll(TowerRunPlayer.getAll());
PLAYERS_ALIVE.forEach(p -> {
p.reset();
p.player().setGameMode(GameMode.SURVIVAL);
@@ -108,6 +109,10 @@ public class TowerRunGame {
PLAYERS_ALIVE.clear();
Bukkit.getOnlinePlayers().forEach(player -> player.sendTitle(TowerRun.getMessage().parse("GAME_TIE", player), "", 10, 70, 20));
GameState.nextState();
if (Config.event()) {
Config.EVENT_FIGHT.setErgebnis(3);
}
}
public static void win(TowerRunPlayer tPlayer) {
@@ -120,6 +125,10 @@ public class TowerRunGame {
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_DEATH, 1, 1);
});
GameState.nextState();
if (Config.event()) {
Config.EVENT_FIGHT.setErgebnis(SteamwarUser.get(tPlayer.player().getUniqueId()).getTeam() == Config.EVENT_TEAM_BLUE_ID ? 1 : 2);
}
}
public static void reset() {