This commit is contained in:
loki5512344 2026-06-10 23:00:12 +02:00
parent 89dc9eb00d
commit 957ab4a5a2
149 changed files with 5379 additions and 3263 deletions

View file

@ -31,12 +31,14 @@ public class LobbyPhase implements Phase {
@Override
public void enter(GameSession session) {
Bukkit.broadcast(Component.text("[DBD] Лобби открыто! Используйте /dbd join", NamedTextColor.GREEN));
// Телепортируем тех кто уже в сессии (если есть)
var lobbyManager = session.getPlugin().getLobbyManager();
for (var player : session.getPlayers().values()) {
var bukkitPlayer = player.getPlayer();
if (bukkitPlayer != null && bukkitPlayer.isOnline()) {
lobbyManager.teleportToLobby(bukkitPlayer);
var p = player.getPlayer();
if (p != null && p.isOnline()) {
p.setGameMode(org.bukkit.GameMode.ADVENTURE);
lobbyManager.teleportToLobby(p);
p.sendMessage(Component.text("[DBD] Лобби открыто! Ожидание игроков...", NamedTextColor.GREEN));
}
}
}
@ -95,16 +97,11 @@ public class LobbyPhase implements Phase {
}
}
// ActionBar всем
int total = (playerCount >= maxPlayers)
? config.getCountdown5Players()
: config.getCountdown4Players();
String bar = buildCountdownBar(secondsLeft, total);
// ActionBar всем (на русском, без прогресс-бара)
NamedTextColor barColor = (playerCount >= maxPlayers)
? NamedTextColor.GREEN : NamedTextColor.YELLOW;
sendActionBarToAll(session,
Component.text("▶ Старт через: " + secondsLeft + "с " + bar +
" (" + playerCount + "/" + minPlayers + ")", barColor));
Component.text(">>> Начало через: " + secondsLeft + "с (" + playerCount + "/" + minPlayers + ")", barColor));
if (secondsLeft <= 0) {
started = true;
@ -123,7 +120,7 @@ public class LobbyPhase implements Phase {
private String buildCountdownBar(int current, int total) {
int filled = total > 0 ? (int) (10.0 * current / total) : 0;
int empty = 10 - filled;
return "§a" + "█".repeat(Math.max(0, filled)) + "§7" + "░".repeat(Math.max(0, empty));
return "§a" + "#".repeat(Math.max(0, filled)) + "§7" + "-".repeat(Math.max(0, empty));
}
@Override
@ -137,13 +134,18 @@ public class LobbyPhase implements Phase {
@Override
public void onPlayerJoined(GameSession session, Player player) {
player.setGameMode(org.bukkit.GameMode.ADVENTURE);
session.getPlugin().getLobbyManager().teleportToLobby(player);
int playerCount = session.getPlayerCount();
int minPlayers = config.getMinPlayers();
Bukkit.broadcast(Component.text(
"[DBD] " + player.getName() + " присоединился к очереди! (" +
playerCount + "/" + minPlayers + ")",
NamedTextColor.YELLOW));
// Сообщаем только участникам этой сессии, не всему серверу
Component msg = Component.text(
"[DBD] " + player.getName() + " присоединился! (" + playerCount + "/" + minPlayers + ")",
NamedTextColor.YELLOW);
for (BasePlayer bp : session.getPlayers().values()) {
Player p = bp.getPlayer();
if (p != null && p.isOnline()) p.sendMessage(msg);
}
}
@Override