fix: colors, /dbd join flow, world creation, role assign, action bar lobby, /dbdadmin world, tab complete
This commit is contained in:
parent
327ad9b906
commit
1adb8c84fd
19 changed files with 874 additions and 112 deletions
|
|
@ -1,10 +1,11 @@
|
|||
package dev.loki.phase;
|
||||
|
||||
import dev.loki.core.GameSession;
|
||||
import dev.loki.objective.Generator;
|
||||
import dev.loki.objective.GeneratorManager;
|
||||
import dev.loki.player.BasePlayer;
|
||||
import dev.loki.player.PlayerState;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
|
@ -24,14 +25,14 @@ public class GameplayPhase implements Phase {
|
|||
|
||||
@Override
|
||||
public void enter(GameSession session) {
|
||||
Bukkit.broadcastMessage("[DBD] Игра началась! Выжившие, чините генераторы!");
|
||||
Bukkit.broadcast(Component.text("[DBD] Игра началась! Выжившие, чините генераторы!", NamedTextColor.GREEN));
|
||||
tickCounter = 0;
|
||||
// Teleport is handled by RoleAssigner.assignRoles — no double-teleport needed here
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(GameSession session) {
|
||||
tickCounter++;
|
||||
|
||||
generatorManager.tick();
|
||||
|
||||
if (tickCounter % 20 == 0) {
|
||||
|
|
@ -45,7 +46,8 @@ public class GameplayPhase implements Phase {
|
|||
|
||||
if (generatorManager.areAllRequiredCompleted()) {
|
||||
allGensDone = true;
|
||||
Bukkit.broadcastMessage("[DBD] §a§lВсе генераторы починены! Открывайте ворота!");
|
||||
Bukkit.broadcast(Component.text(
|
||||
"[DBD] Все генераторы починены! Открывайте ворота!", NamedTextColor.GREEN));
|
||||
for (BasePlayer bp : session.getPlayers().values()) {
|
||||
Player p = bp.getPlayer();
|
||||
if (p != null) {
|
||||
|
|
@ -58,13 +60,11 @@ public class GameplayPhase implements Phase {
|
|||
private void checkWinConditions(GameSession session) {
|
||||
int aliveSurvivors = 0;
|
||||
int escapedSurvivors = 0;
|
||||
boolean killerDead = true;
|
||||
int totalSurvivors = 0;
|
||||
|
||||
for (BasePlayer bp : session.getPlayers().values()) {
|
||||
if (bp.isKiller()) {
|
||||
killerDead = false;
|
||||
continue;
|
||||
}
|
||||
if (bp.isKiller()) continue;
|
||||
totalSurvivors++;
|
||||
PlayerState state = bp.getState();
|
||||
if (state == PlayerState.ESCAPED) {
|
||||
escapedSurvivors++;
|
||||
|
|
@ -73,16 +73,17 @@ public class GameplayPhase implements Phase {
|
|||
}
|
||||
}
|
||||
|
||||
boolean allSurvivorsDead = (aliveSurvivors == 0 && escapedSurvivors == 0);
|
||||
boolean allSurvivorsDead = (aliveSurvivors == 0 && escapedSurvivors == 0 && totalSurvivors > 0);
|
||||
boolean allEscaped = (escapedSurvivors == totalSurvivors && totalSurvivors > 0);
|
||||
|
||||
if (allSurvivorsDead || escapedSurvivors == session.getPlayerCount() - 1) {
|
||||
if (allSurvivorsDead || allEscaped) {
|
||||
shouldEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit(GameSession session) {
|
||||
Bukkit.broadcastMessage("[DBD] §6Игровая фаза завершена!");
|
||||
Bukkit.broadcast(Component.text("[DBD] Игровая фаза завершена!", NamedTextColor.GOLD));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue