fix: wand listener, killer/survivor spawn commands, double phase exit, generatorManager null check
This commit is contained in:
parent
1adb8c84fd
commit
b339f4c029
5 changed files with 125 additions and 21 deletions
|
|
@ -83,6 +83,13 @@ public class SetupCommand implements TabExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
/** Called by PlayerInteractListener when wand is used. */
|
||||
public void setWandPos(Player player, int num, Location loc) {
|
||||
String key = player.getUniqueId().toString();
|
||||
selectionCorners.put(key + "_pos" + num, loc);
|
||||
player.sendMessage(TextUtil.color("<#00FF00>[Wand] Точка " + num + ": " + formatLoc(loc)));
|
||||
}
|
||||
|
||||
private boolean saveTemplate(Player player, String[] args) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(TextUtil.color("<#FF0000>Использование: /dbdsetup save <name>"));
|
||||
|
|
@ -132,28 +139,65 @@ public class SetupCommand implements TabExecutor {
|
|||
|
||||
private boolean setObject(Player player, String[] args) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage(TextUtil.color("<#FF0000>Использование: /dbdsetup set <generator|hook|pallet|chest|totem|gate|lobby>"));
|
||||
player.sendMessage(TextUtil.color("<#FF0000>Использование: /dbdsetup set <тип>"));
|
||||
player.sendMessage(TextUtil.color("<#FFD700>Типы: generator, hook, pallet, gate, killer-spawn, survivor-spawn, lobby"));
|
||||
return true;
|
||||
}
|
||||
Location loc = player.getLocation().getBlock().getLocation();
|
||||
// For spawns and hooks use exact player location (with yaw/pitch)
|
||||
// For block-based objects (generator) use block location
|
||||
String type = args[1].toLowerCase();
|
||||
var locations = plugin.getConfigManager().getLocations();
|
||||
|
||||
switch (type) {
|
||||
case "generator" -> locations.addLocation("generators", loc);
|
||||
case "hook" -> locations.addLocation("hooks", loc);
|
||||
case "pallet" -> locations.addLocation("pallets", loc);
|
||||
case "chest" -> locations.addLocation("chests", loc);
|
||||
case "totem" -> locations.addLocation("totems", loc);
|
||||
case "gate" -> locations.addLocation("exitgates", loc);
|
||||
case "lobby" -> locations.setLobby(loc);
|
||||
case "generator" -> {
|
||||
Location loc = player.getLocation().getBlock().getLocation();
|
||||
loc.add(0.5, 0, 0.5); // center of block
|
||||
locations.addLocation("generators", loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Генератор установлен на " + formatLoc(loc)));
|
||||
}
|
||||
case "hook" -> {
|
||||
Location loc = player.getLocation();
|
||||
locations.addLocation("hooks", loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Крюк установлен на " + formatLoc(loc)));
|
||||
}
|
||||
case "pallet" -> {
|
||||
Location loc = player.getLocation().getBlock().getLocation();
|
||||
locations.addLocation("pallets", loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Паллет установлен на " + formatLoc(loc)));
|
||||
}
|
||||
case "gate" -> {
|
||||
Location loc = player.getLocation();
|
||||
locations.addLocation("exitgates", loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Ворота установлены на " + formatLoc(loc)));
|
||||
}
|
||||
case "killer-spawn", "killer_spawn" -> {
|
||||
Location loc = player.getLocation();
|
||||
locations.setKillerSpawn(loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#FF4444>Спавн киллера установлен на " + formatLoc(loc)));
|
||||
}
|
||||
case "survivor-spawn", "survivor_spawn" -> {
|
||||
Location loc = player.getLocation();
|
||||
locations.addLocation("survivor-spawns", loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
int count = locations.getSurvivorSpawns().size();
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Спавн выжившего #" + count + " установлен на " + formatLoc(loc)));
|
||||
}
|
||||
case "lobby" -> {
|
||||
Location loc = player.getLocation();
|
||||
locations.setLobby(loc);
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Лобби установлено на " + formatLoc(loc)));
|
||||
}
|
||||
default -> {
|
||||
player.sendMessage(TextUtil.color("<#FF0000>Неизвестный тип: " + type));
|
||||
return true;
|
||||
player.sendMessage(TextUtil.color("<#FFD700>Типы: generator, hook, pallet, gate, killer-spawn, survivor-spawn, lobby"));
|
||||
}
|
||||
}
|
||||
plugin.getConfigManager().saveConfig("locations.yml", locations.getConfig());
|
||||
player.sendMessage(TextUtil.color("<#00FF00>Установлен: " + type + " на " + formatLoc(loc)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +254,7 @@ public class SetupCommand implements TabExecutor {
|
|||
.toList();
|
||||
}
|
||||
if (args.length == 2 && args[0].equalsIgnoreCase("set")) {
|
||||
return Arrays.asList("generator", "hook", "pallet", "chest", "totem", "gate", "lobby")
|
||||
return Arrays.asList("generator", "hook", "pallet", "gate", "killer-spawn", "survivor-spawn", "lobby")
|
||||
.stream()
|
||||
.filter(s -> s.startsWith(args[1].toLowerCase()))
|
||||
.toList();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue