cleanup: remove md/txt files, add README, various fixes
This commit is contained in:
parent
bb293c5d03
commit
4482b3a0ea
13 changed files with 110 additions and 1459 deletions
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -80,10 +80,6 @@ public class LocationsConfig {
|
|||
return loadLocationList("chests");
|
||||
}
|
||||
|
||||
public List<Location> getTotems() {
|
||||
return loadLocationList("totems");
|
||||
}
|
||||
|
||||
// getExitGates() — определён в addLocation/setGate блоке
|
||||
|
||||
public List<Location> getKillerSpawns() {
|
||||
|
|
|
|||
|
|
@ -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). */
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue