cleanup: remove md/txt files, add README, various fixes

This commit is contained in:
loki5512344 2026-06-15 14:00:38 +02:00
parent bb293c5d03
commit 4482b3a0ea
13 changed files with 110 additions and 1459 deletions

View file

@ -1,5 +1,6 @@
package dev.loki.command;
import dev.loki.gate.ExitGate;
import dev.loki.mdbd;
import dev.loki.util.SpawnUtil;
import dev.loki.util.TextUtil;
@ -206,6 +207,11 @@ public class SetupCommand implements TabExecutor {
locations.setGateZone(gateId, p1, p2);
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
ExitGate gate = new ExitGate(center);
gate.setZone(p1, p2);
gate.spawnGateStructure();
gate.spawnGateBlock();
player.sendMessage(messages().get("setup.gate-placed", gateId, formatLoc(center)));
return true;
}
@ -402,20 +408,14 @@ public class SetupCommand implements TabExecutor {
}
String type = args[1].toLowerCase();
int index;
try {
index = Integer.parseInt(args[2]);
} catch (NumberFormatException e) {
player.sendMessage(messages().get("setup.invalid-number", args[2]));
return true;
}
var locations = plugin.getConfigManager().getLocations();
switch (type) {
case "generator" -> {
int index = parseInt(args[2], player);
if (index < 0) return true;
var gens = locations.getGenerators();
if (index < 0 || index >= gens.size()) {
if (index >= gens.size()) {
player.sendMessage(messages().get("setup.out-of-range", index));
return true;
}
@ -424,8 +424,10 @@ public class SetupCommand implements TabExecutor {
player.sendMessage(messages().get("setup.deleted", "generator #" + index));
}
case "hook" -> {
int index = parseInt(args[2], player);
if (index < 0) return true;
var hooks = locations.getHooks();
if (index < 0 || index >= hooks.size()) {
if (index >= hooks.size()) {
player.sendMessage(messages().get("setup.out-of-range", index));
return true;
}
@ -433,8 +435,10 @@ public class SetupCommand implements TabExecutor {
player.sendMessage(messages().get("setup.deleted", "hook #" + index));
}
case "chest" -> {
int index = parseInt(args[2], player);
if (index < 0) return true;
var chests = locations.getChests();
if (index < 0 || index >= chests.size()) {
if (index >= chests.size()) {
player.sendMessage(messages().get("setup.out-of-range", index));
return true;
}
@ -446,6 +450,8 @@ public class SetupCommand implements TabExecutor {
player.sendMessage(messages().get("setup.deleted", "killer-spawn"));
}
case "survivor-spawn" -> {
int index = parseInt(args[2], player);
if (index < 0) return true;
if (index < 1 || index > 4) {
player.sendMessage(messages().get("setup.out-of-range", index));
return true;
@ -454,9 +460,10 @@ public class SetupCommand implements TabExecutor {
player.sendMessage(messages().get("setup.deleted", "survivor-spawn #" + index));
}
case "gate" -> {
String id = index == 1 ? "a" : index == 2 ? "b" : null;
if (id == null) {
player.sendMessage(messages().get("setup.out-of-range", index));
String raw = args[2].toLowerCase();
String id = switch (raw) { case "a", "1" -> "a"; case "b", "2" -> "b"; default -> null; };
if (id == null || locations.getGate(id) == null) {
player.sendMessage(messages().get("setup.out-of-range", raw));
return true;
}
locations.getConfig().set("gate-" + id, null);
@ -474,6 +481,15 @@ public class SetupCommand implements TabExecutor {
return true;
}
private int parseInt(String s, Player player) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
player.sendMessage(messages().get("setup.invalid-number", s));
return -1;
}
}
private boolean clearSpawns(Player player) {
var locations = plugin.getConfigManager().getLocations();
locations.clearLocationList("killer-spawn");

View file

@ -80,10 +80,6 @@ public class LocationsConfig {
return loadLocationList("chests");
}
public List<Location> getTotems() {
return loadLocationList("totems");
}
// getExitGates() — определён в addLocation/setGate блоке
public List<Location> getKillerSpawns() {

View file

@ -52,7 +52,7 @@ public class ExitGate {
/** Place a HOPPER block at this gate's location for player interaction. */
public void spawnGateBlock() {
if (location.getWorld() == null) return;
location.getBlock().setType(org.bukkit.Material.HOPPER, false);
location.getBlock().setType(org.bukkit.Material.HOPPER, true);
}
/** Build the gate structure fills the entire designated zone. */
@ -60,16 +60,14 @@ public class ExitGate {
World world = location.getWorld();
if (world == null) return;
// Place all iron bars first (no physics) then force update for connections
if (hasZone) {
for (int x = zoneMinX; x <= zoneMaxX; x++) {
for (int y = zoneMinY; y <= zoneMaxY; y++) {
for (int z = zoneMinZ; z <= zoneMaxZ; z++) {
world.getBlockAt(x, y, z).setType(org.bukkit.Material.IRON_BARS, false);
world.getBlockAt(x, y, z).setType(org.bukkit.Material.IRON_BARS, true);
}
}
}
// Force update all iron bars so they connect to neighbors
for (int x = zoneMinX; x <= zoneMaxX; x++) {
for (int y = zoneMinY; y <= zoneMaxY; y++) {
for (int z = zoneMinZ; z <= zoneMaxZ; z++) {
@ -78,12 +76,11 @@ public class ExitGate {
}
}
} else {
// Fallback: 3x3x3 zone around gate location
int cx = location.getBlockX(), cy = location.getBlockY(), cz = location.getBlockZ();
for (int x = cx - 1; x <= cx + 1; x++) {
for (int y = cy; y <= cy + 2; y++) {
for (int z = cz - 1; z <= cz + 1; z++) {
world.getBlockAt(x, y, z).setType(org.bukkit.Material.IRON_BARS, false);
world.getBlockAt(x, y, z).setType(org.bukkit.Material.IRON_BARS, true);
}
}
}
@ -96,8 +93,7 @@ public class ExitGate {
}
}
// Button at gate center + (1, 1, 1)
world.getBlockAt(location.clone().add(1, 1, 1)).setType(org.bukkit.Material.STONE_BUTTON, false);
world.getBlockAt(location.clone().add(1, 1, 1)).setType(org.bukkit.Material.STONE_BUTTON, true);
}
/** Remove the interaction block (e.g. when gate opens or on cleanup). */

View file

@ -22,28 +22,24 @@ public class SkillCheckListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
String title = event.getView().getTitle();
if (!title.contains("Skill Check")) return;
if (!(event.getWhoClicked() instanceof Player player)) return;
if (!minigame.isActive(player.getUniqueId())) return;
event.setCancelled(true);
if (!(event.getWhoClicked() instanceof Player player)) return;
minigame.handleClick(player.getUniqueId(), event.getRawSlot());
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent event) {
String title = event.getView().getTitle();
if (!title.contains("Skill Check")) return;
if (!(event.getWhoClicked() instanceof Player player)) return;
if (!minigame.isActive(player.getUniqueId())) return;
event.setCancelled(true);
}
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
String title = event.getView().getTitle();
if (!title.contains("Skill Check")) return;
if (!minigame.isActive(event.getPlayer().getUniqueId())) return;
minigame.handleClose(event.getPlayer().getUniqueId());
}

View file

@ -113,10 +113,6 @@ public class MapBuilder {
return true;
}
public void placeTotem(Location location) {
// Totems removed - no-op
}
public void placeHook(Location location) {
if (templateManager.hasTemplate("hook")) {
templateManager.placeObject("hook", location);

View file

@ -64,7 +64,7 @@ public class GuiRouletteMinigame implements GeneratorMinigame {
RouletteSession session = new RouletteSession(player, callback);
activeSessions.put(playerId, session);
String titleStr = plugin.getConfigManager().getMessages().getString("minigames.generator-roulette.title", "⚡ Skill Check!");
String titleStr = plugin.getConfigManager().getMessages().getString("minigames.generator-roulette.title", "⚡ Проверка реакции!");
Inventory inv = Bukkit.createInventory(null, 9, Component.text(titleStr).color(NamedTextColor.YELLOW));
fillInventory(inv, session.successSlot);
player.openInventory(inv);

View file

@ -19,12 +19,6 @@ lobby:
# Задержка перед назначением ролей (секунд)
role-assign-delay: 5
# Количество серверных лобби (0 = только пользовательские)
server-lobby-count: 3
# Сохранять лобби между перезапусками
persist-lobbies: true
# Размеры игроков (1.0 = стандарт)
players:
survivor-scale: 1.0

View file

@ -23,9 +23,6 @@ hooks: []
# Сундуки с лутом (3-4)
chests: []
# Тотемы (5)
totems: []
# Ворота выхода (2)
exitgates: []
@ -43,7 +40,6 @@ survivor-spawns: []
# /dbdadmin clear - Очистить все генераторы
# /dbdsetup set hook - Установить крюк
# /dbdsetup set chest - Установить сундук
# /dbdsetup set totem - Установить тотем
# /dbdsetup set gate - Установить ворота
# /dbdsetup set lobby - Установить лобби
# ============================================

View file

@ -166,9 +166,10 @@ generator:
cannot: "&cГенератор не может быть починен!"
busy: "&cКто-то уже чинит этот генератор!"
actionbar: "&7Починка: %s"
skillcheck-title: "&eSkill Check! %s"
skillcheck-success: "&a✓ Отлично! +%d%%"
skillcheck-fail: "&c✗ Ошибка! -%d%%. Продолжай чинить."
skillcheck-title: "&eПроверка реакции! %s"
skillcheck-success: "&a✓ Успех! +%d%%"
skillcheck-fail: "&c✗ Промах! -%d%%. Чини дальше."
all-done: "%prefix%&aВсе генераторы починены! Открывайте ворота!"
kicked:
begin: "%prefix%&cДержите Shift для разрушения генератора..."
cooldown: "%prefix%&cКулдаун удара: %d сек"
@ -176,7 +177,6 @@ generator:
actionbar: "&c⚡ Разрушение: %d%%"
success: "%prefix%&cГенератор поврежден! -%d%% прогресса"
broadcast: "%prefix%&4⚡ Маньяк разрушил генератор! -%d%%"
all-done: "%prefix%&aВсе генераторы починены! Открывайте ворота!"
notification: "&4[DBD] ⚡ Выживший допустил ошибку! Компас укажет на генератор!"
# ── Маньяк ─────────────────────────────────────
@ -266,7 +266,7 @@ quit:
minigames:
generator-roulette:
title: "⚡ Skill Check!"
title: "⚡ Проверка реакции!"
success-label: "✓ Нажми!"
text-skillcheck:
subtitle: "&eНажми ПКМ или отпусти шифт в зоне!"