Update from Git Manager GUI
This commit is contained in:
@@ -69,6 +69,7 @@ public class NexusLobby extends JavaPlugin implements Listener {
|
|||||||
private BorderModule borderModule;
|
private BorderModule borderModule;
|
||||||
private ParkourManager parkourManager;
|
private ParkourManager parkourManager;
|
||||||
private SoccerModule soccerModule;
|
private SoccerModule soccerModule;
|
||||||
|
private ArmorStandLookAtModule armorStandLookAtModule;
|
||||||
|
|
||||||
private ConversationManager conversationManager;
|
private ConversationManager conversationManager;
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ public class NexusLobby extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
ServerChecker.startGlobalChecker();
|
ServerChecker.startGlobalChecker();
|
||||||
|
|
||||||
new ArmorStandLookAtModule();
|
armorStandLookAtModule = new ArmorStandLookAtModule();
|
||||||
|
|
||||||
startAutoConversationTimer();
|
startAutoConversationTimer();
|
||||||
|
|
||||||
@@ -192,7 +193,10 @@ public class NexusLobby extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ServerChecker.startGlobalChecker();
|
ServerChecker.startGlobalChecker();
|
||||||
new ArmorStandLookAtModule();
|
// FIX: ArmorStandLookAtModule als Feld tracken. Bukkit.getScheduler().cancelTasks()
|
||||||
|
// am Anfang von reloadPlugin() cancelt den alten Task bereits – hier nur
|
||||||
|
// neu starten und Referenz aktualisieren, damit kein doppelter Task läuft.
|
||||||
|
armorStandLookAtModule = new ArmorStandLookAtModule();
|
||||||
startAutoConversationTimer();
|
startAutoConversationTimer();
|
||||||
|
|
||||||
getLogger().info("Plugin Reload abgeschlossen. Änderungen wurden übernommen.");
|
getLogger().info("Plugin Reload abgeschlossen. Änderungen wurden übernommen.");
|
||||||
|
|||||||
@@ -28,65 +28,111 @@ public class LobbyTabCompleter implements TabCompleter {
|
|||||||
List<String> suggestions = new ArrayList<>();
|
List<String> suggestions = new ArrayList<>();
|
||||||
String cmdName = command.getName().toLowerCase();
|
String cmdName = command.getName().toLowerCase();
|
||||||
|
|
||||||
// --- NexusLobby Hauptbefehl (/nexus) ---
|
// ── NexusLobby Hauptbefehl (/nexus oder /nexuslobby) ─────────────────
|
||||||
if (cmdName.equals("nexuslobby") || cmdName.equals("nexus")) {
|
if (cmdName.equals("nexuslobby") || cmdName.equals("nexus")) {
|
||||||
|
|
||||||
|
// /nexuslobby <?>
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (sender.hasPermission("nexuslobby.admin")) {
|
if (sender.hasPermission("nexuslobby.admin")) {
|
||||||
suggestions.addAll(Arrays.asList("reload", "setspawn", "silentjoin", "parkour", "ball")); // NEU: ball
|
suggestions.addAll(Arrays.asList(
|
||||||
|
"reload", "setspawn", "silentjoin", "parkour", "ball"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
suggestions.add("sb");
|
suggestions.add("sb");
|
||||||
|
|
||||||
|
// /nexuslobby <sub> <?>
|
||||||
} else if (args.length == 2) {
|
} else if (args.length == 2) {
|
||||||
if (args[0].equalsIgnoreCase("sb")) {
|
switch (args[0].toLowerCase()) {
|
||||||
suggestions.addAll(Arrays.asList("on", "off"));
|
case "sb" -> {
|
||||||
if (sender.hasPermission("nexuslobby.scoreboard.admin")) {
|
suggestions.addAll(Arrays.asList("on", "off"));
|
||||||
suggestions.addAll(Arrays.asList("admin", "spieler"));
|
if (sender.hasPermission("nexuslobby.scoreboard.admin"))
|
||||||
|
suggestions.addAll(Arrays.asList("admin", "spieler"));
|
||||||
}
|
}
|
||||||
} else if (args[0].equalsIgnoreCase("silentjoin")) {
|
case "silentjoin" -> suggestions.addAll(Arrays.asList("on", "off"));
|
||||||
suggestions.addAll(Arrays.asList("on", "off"));
|
case "parkour" -> suggestions.addAll(Arrays.asList(
|
||||||
} else if (args[0].equalsIgnoreCase("parkour")) {
|
"setstart", "setfinish", "setcheckpoint", "reset", "clear", "removeall"
|
||||||
suggestions.addAll(Arrays.asList("setstart", "setfinish", "setcheckpoint", "reset", "clear", "removeall"));
|
));
|
||||||
} else if (args[0].equalsIgnoreCase("ball")) {
|
case "ball" -> {
|
||||||
if (sender.hasPermission("nexuslobby.admin")) {
|
if (sender.hasPermission("nexuslobby.admin")) {
|
||||||
suggestions.addAll(Arrays.asList("setspawn", "respawn", "remove"));
|
suggestions.addAll(Arrays.asList(
|
||||||
|
"setspawn", "respawn", "remove", "goal", "score"
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /nexuslobby <sub> <sub2> <?>
|
||||||
} else if (args.length == 3) {
|
} else if (args.length == 3) {
|
||||||
if (args[0].equalsIgnoreCase("parkour") && args[1].equalsIgnoreCase("setcheckpoint")) {
|
switch (args[0].toLowerCase()) {
|
||||||
suggestions.addAll(Arrays.asList("1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
case "parkour" -> {
|
||||||
|
if (args[1].equalsIgnoreCase("setcheckpoint"))
|
||||||
|
suggestions.addAll(Arrays.asList("1","2","3","4","5","6","7","8","9"));
|
||||||
|
}
|
||||||
|
case "ball" -> {
|
||||||
|
switch (args[1].toLowerCase()) {
|
||||||
|
// /nexuslobby ball goal <?>
|
||||||
|
case "goal" -> suggestions.addAll(Arrays.asList(
|
||||||
|
"pos1", "pos2", "save", "delete", "list", "show", "debug"
|
||||||
|
));
|
||||||
|
// /nexuslobby ball score <?>
|
||||||
|
case "score" -> suggestions.add("reset");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// /nexuslobby <sub> <sub2> <sub3> <?>
|
||||||
|
} else if (args.length == 4) {
|
||||||
|
if (args[0].equalsIgnoreCase("ball") && args[1].equalsIgnoreCase("goal")) {
|
||||||
|
switch (args[2].toLowerCase()) {
|
||||||
|
// /nexuslobby ball goal save <Name> <?> → Tor-Name (Freitext)
|
||||||
|
case "save" -> suggestions.add("<TorName>");
|
||||||
|
// /nexuslobby ball goal delete <Name>
|
||||||
|
case "delete" -> {
|
||||||
|
// Tor-Namen aus Config laden und vorschlagen
|
||||||
|
var section = NexusLobby.getInstance().getConfig()
|
||||||
|
.getConfigurationSection("ball.goals");
|
||||||
|
if (section != null) suggestions.addAll(section.getKeys(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// /nexuslobby ball goal save <Name> <?> → Team 1 oder 2
|
||||||
|
} else if (args.length == 5) {
|
||||||
|
if (args[0].equalsIgnoreCase("ball")
|
||||||
|
&& args[1].equalsIgnoreCase("goal")
|
||||||
|
&& args[2].equalsIgnoreCase("save")) {
|
||||||
|
suggestions.addAll(Arrays.asList("1", "2"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Hologram Befehl ---
|
// ── Hologram Befehl ───────────────────────────────────────────────────
|
||||||
else if (cmdName.equals("holo")) {
|
else if (cmdName.equals("holo")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.addAll(Arrays.asList("create", "delete"));
|
suggestions.addAll(Arrays.asList("create", "delete"));
|
||||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
||||||
if (hologramModule != null) {
|
if (hologramModule != null)
|
||||||
suggestions.addAll(hologramModule.getHologramIds());
|
suggestions.addAll(hologramModule.getHologramIds());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Wartungsmodus ---
|
// ── Wartungsmodus ─────────────────────────────────────────────────────
|
||||||
else if (cmdName.equals("maintenance")) {
|
else if (cmdName.equals("maintenance")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1)
|
||||||
suggestions.addAll(Arrays.asList("on", "off"));
|
suggestions.addAll(Arrays.asList("on", "off"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// ── Portalsystem ──────────────────────────────────────────────────────
|
||||||
// --- Portalsystem ---
|
|
||||||
else if (cmdName.equals("portal")) {
|
else if (cmdName.equals("portal")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.addAll(Arrays.asList("create", "delete", "list"));
|
suggestions.addAll(Arrays.asList("create", "delete", "list"));
|
||||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
||||||
if (portalManager != null) {
|
if (portalManager != null)
|
||||||
suggestions.addAll(portalManager.getPortalNames());
|
suggestions.addAll(portalManager.getPortalNames());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- MapArt ---
|
// ── MapArt ────────────────────────────────────────────────────────────
|
||||||
else if (cmdName.equals("mapart")) {
|
else if (cmdName.equals("mapart")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.add("https://");
|
suggestions.add("https://");
|
||||||
@@ -95,14 +141,13 @@ public class LobbyTabCompleter implements TabCompleter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Intro System ---
|
// ── Intro System ──────────────────────────────────────────────────────
|
||||||
else if (cmdName.equals("intro")) {
|
else if (cmdName.equals("intro")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1)
|
||||||
suggestions.addAll(Arrays.asList("add", "clear", "start"));
|
suggestions.addAll(Arrays.asList("add", "clear", "start"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- WorldBorder ---
|
// ── WorldBorder ───────────────────────────────────────────────────────
|
||||||
else if (cmdName.equals("border")) {
|
else if (cmdName.equals("border")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.addAll(Arrays.asList("circle", "square", "disable"));
|
suggestions.addAll(Arrays.asList("circle", "square", "disable"));
|
||||||
@@ -110,59 +155,49 @@ public class LobbyTabCompleter implements TabCompleter {
|
|||||||
suggestions.addAll(Arrays.asList("10", "25", "50", "100", "250"));
|
suggestions.addAll(Arrays.asList("10", "25", "50", "100", "250"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- NexusCmd / ArmorStandTools ---
|
// ── NexusCmd / ArmorStandTools ────────────────────────────────────────
|
||||||
else if (cmdName.equals("nexuscmd") || cmdName.equals("ncmd") || cmdName.equals("ascmd") || cmdName.equals("conv")) {
|
else if (cmdName.equals("nexuscmd") || cmdName.equals("ncmd")
|
||||||
|
|| cmdName.equals("ascmd") || cmdName.equals("conv")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.addAll(Arrays.asList("add", "remove", "list", "name", "lookat", "conv", "say"));
|
suggestions.addAll(Arrays.asList("add", "remove", "list", "name", "lookat", "conv", "say"));
|
||||||
}
|
} else if (args.length == 2) {
|
||||||
else if (args.length == 2) {
|
switch (args[0].toLowerCase()) {
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
case "add" -> suggestions.addAll(Arrays.asList("0","1","2","3","4","5","6","7","8","9"));
|
||||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
case "name" -> suggestions.addAll(Arrays.asList("<Anzeigename>", "none"));
|
||||||
} else if (args[0].equalsIgnoreCase("name")) {
|
case "conv" -> suggestions.addAll(Arrays.asList("select1","select2","select3","select4","link","unlink","start"));
|
||||||
suggestions.addAll(Arrays.asList("<Anzeigename>", "none"));
|
case "remove" -> suggestions.addAll(Arrays.asList("0","1","2","3","4","5","6","7","8","9","all"));
|
||||||
} else if (args[0].equalsIgnoreCase("conv")) {
|
case "say" -> suggestions.add("<Nachricht>");
|
||||||
suggestions.addAll(Arrays.asList("select1", "select2", "select3", "select4", "link", "unlink", "start"));
|
|
||||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
|
||||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "all"));
|
|
||||||
} else if (args[0].equalsIgnoreCase("say")) {
|
|
||||||
suggestions.add("<Nachricht>");
|
|
||||||
}
|
}
|
||||||
}
|
} else if (args.length == 3) {
|
||||||
else if (args.length == 3) {
|
|
||||||
if (args[0].equalsIgnoreCase("add")) {
|
if (args[0].equalsIgnoreCase("add")) {
|
||||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
suggestions.addAll(Arrays.asList("0","1","2","3","4","5","6","7","8","9"));
|
||||||
} else if (args[0].equalsIgnoreCase("conv")) {
|
} else if (args[0].equalsIgnoreCase("conv")
|
||||||
if (args[1].equalsIgnoreCase("start") || args[1].equalsIgnoreCase("link")) {
|
&& (args[1].equalsIgnoreCase("start") || args[1].equalsIgnoreCase("link"))) {
|
||||||
if (NexusLobby.getInstance().getConversationManager() != null) {
|
if (NexusLobby.getInstance().getConversationManager() != null)
|
||||||
suggestions.addAll(NexusLobby.getInstance().getConversationManager().getConversationIds());
|
suggestions.addAll(NexusLobby.getInstance().getConversationManager().getConversationIds());
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else if (args.length == 4 && args[0].equalsIgnoreCase("add")) {
|
||||||
else if (args.length == 4 && args[0].equalsIgnoreCase("add")) {
|
|
||||||
suggestions.addAll(Arrays.asList("bungee", "console", "player"));
|
suggestions.addAll(Arrays.asList("bungee", "console", "player"));
|
||||||
}
|
} else if (args.length == 5 && args[0].equalsIgnoreCase("add")
|
||||||
else if (args.length == 5 && args[0].equalsIgnoreCase("add") && args[3].equalsIgnoreCase("bungee")) {
|
&& args[3].equalsIgnoreCase("bungee")) {
|
||||||
if (NexusLobby.getInstance().getConfig().getConfigurationSection("servers") != null) {
|
var section = NexusLobby.getInstance().getConfig().getConfigurationSection("servers");
|
||||||
suggestions.addAll(NexusLobby.getInstance().getConfig().getConfigurationSection("servers").getKeys(false));
|
if (section != null) suggestions.addAll(section.getKeys(false));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- ArmorStandTools Alternate ---
|
// ── ArmorStandTools Alternate ─────────────────────────────────────────
|
||||||
else if (cmdName.equals("astools") || cmdName.equals("nt") || cmdName.equals("ntools")) {
|
else if (cmdName.equals("astools") || cmdName.equals("nt") || cmdName.equals("ntools")) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
suggestions.addAll(Arrays.asList("dynamic", "lookat", "addplayer", "addconsole", "remove", "reload", "say"));
|
suggestions.addAll(Arrays.asList("dynamic","lookat","addplayer","addconsole","remove","reload","say"));
|
||||||
}
|
} else if (args.length == 2) {
|
||||||
else if (args.length == 2 && args[0].equalsIgnoreCase("say")) {
|
if (args[0].equalsIgnoreCase("say"))
|
||||||
suggestions.add("<Nachricht>");
|
suggestions.add("<Nachricht>");
|
||||||
}
|
else if (args[0].equalsIgnoreCase("addplayer") || args[0].equalsIgnoreCase("addconsole"))
|
||||||
else if (args.length == 2 && (args[0].equalsIgnoreCase("addplayer") || args[0].equalsIgnoreCase("addconsole"))) {
|
suggestions.addAll(Arrays.asList("0","1","2","3","4","5","6","7","8","9"));
|
||||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
} else if (args.length == 3) {
|
||||||
}
|
if (args[0].equalsIgnoreCase("addplayer") || args[0].equalsIgnoreCase("addconsole"))
|
||||||
else if (args.length == 3 && (args[0].equalsIgnoreCase("addplayer") || args[0].equalsIgnoreCase("addconsole"))) {
|
suggestions.addAll(Arrays.asList("0","1","2","3","4","5","6","7","8","9"));
|
||||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ public class NexusLobbyCommand implements CommandExecutor {
|
|||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1f, 1.5f);
|
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1f, 1.5f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "cleanbubbles":
|
||||||
|
// Bereinigt alle hängengebliebenen Sprechblasen-ArmorStands im gesamten Server.
|
||||||
|
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||||
|
handleCleanBubbles(player);
|
||||||
|
break;
|
||||||
|
|
||||||
case "setspawn":
|
case "setspawn":
|
||||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
@@ -187,6 +193,18 @@ public class NexusLobbyCommand implements CommandExecutor {
|
|||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("parkour_start_set"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("parkour_start_set"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleCleanBubbles(Player player) {
|
||||||
|
de.nexuslobby.modules.armorstandtools.ConversationManager cm =
|
||||||
|
NexusLobby.getInstance().getConversationManager();
|
||||||
|
if (cm == null) {
|
||||||
|
player.sendMessage("§8[§6Nexus§8] §cConversationManager ist nicht aktiv.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cm.clearHangingBubbles();
|
||||||
|
player.sendMessage("§8[§6Nexus§8] §aAlle hängengebliebenen Sprechblasen wurden entfernt.");
|
||||||
|
player.playSound(player.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1f, 2f);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean noPerm(Player player) {
|
private boolean noPerm(Player player) {
|
||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("no_permission"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("no_permission"));
|
||||||
return true;
|
return true;
|
||||||
@@ -236,6 +254,7 @@ public class NexusLobbyCommand implements CommandExecutor {
|
|||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_setspawn"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_setspawn"));
|
||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_scoreboard"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_scoreboard"));
|
||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_reload"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_reload"));
|
||||||
|
player.sendMessage("§e/nexuslobby cleanbubbles §7- Hängende Sprechblasen entfernen");
|
||||||
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_footer"));
|
player.sendMessage(de.nexuslobby.utils.LangManager.get("info_footer"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,14 @@ import de.nexuslobby.commands.BuildCommand;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.block.BlockExplodeEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
@@ -30,7 +33,11 @@ public class ProtectionModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {}
|
public void onDisable() {
|
||||||
|
// FIX: Listener nach dem Deaktivieren abmelden, damit nach /reload
|
||||||
|
// keine doppelten Events ausgelöst werden.
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
@@ -91,4 +98,22 @@ public class ProtectionModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIX: Fehlender Explosionsschutz - settings.yml hat allowExplosions: false,
|
||||||
|
// aber bisher gab es keinen Handler dafür.
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
|
if (!getSettings().getBoolean("allowExplosions", false)) {
|
||||||
|
event.blockList().clear();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockExplode(BlockExplodeEvent event) {
|
||||||
|
if (!getSettings().getBoolean("allowExplosions", false)) {
|
||||||
|
event.blockList().clear();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -162,6 +162,7 @@ public class ScoreboardModule implements Module, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,32 +70,34 @@ public class ASTListener implements Listener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prüft, ob der ArmorStand Dialog-Tags hat und startet das Gespräch über den Manager.
|
* Prüft, ob der ArmorStand Dialog-Tags hat und startet das Gespräch über den Manager.
|
||||||
* Nutzt nun die Gruppen-Logik (z.B. owner_suche).
|
* FIX: Liest jetzt alle Partner-Tags (conv_partner, conv_partner2, conv_partner3)
|
||||||
|
* und verwendet playConversationGroup statt nur die 2-NPC-Methode.
|
||||||
|
* Vorher wurden Gruppen-Gespräche mit 3-4 NPCs als 2-NPC-Gespräch ausgeführt.
|
||||||
*/
|
*/
|
||||||
private void checkAndTriggerDialog(ArmorStand as, Player p) {
|
private void checkAndTriggerDialog(ArmorStand as, Player p) {
|
||||||
String groupName = null;
|
String groupName = null;
|
||||||
String partnerUUIDString = null;
|
String partner1 = null, partner2 = null, partner3 = null;
|
||||||
|
|
||||||
for (String tag : as.getScoreboardTags()) {
|
for (String tag : as.getScoreboardTags()) {
|
||||||
// conv_id enthält jetzt den Gruppennamen aus der conversations.yml
|
if (tag.startsWith("conv_id:")) groupName = tag.split(":", 2)[1];
|
||||||
if (tag.startsWith("conv_id:")) groupName = tag.split(":")[1];
|
if (tag.startsWith("conv_partner:")) partner1 = tag.split(":", 2)[1];
|
||||||
if (tag.startsWith("conv_partner:")) partnerUUIDString = tag.split(":")[1];
|
if (tag.startsWith("conv_partner2:")) partner2 = tag.split(":", 2)[1];
|
||||||
|
if (tag.startsWith("conv_partner3:")) partner3 = tag.split(":", 2)[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupName != null && partnerUUIDString != null) {
|
if (groupName == null || partner1 == null) return;
|
||||||
try {
|
|
||||||
UUID partnerUUID = UUID.fromString(partnerUUIDString);
|
try {
|
||||||
|
java.util.List<UUID> participants = new java.util.ArrayList<>();
|
||||||
// Wir rufen playConversation auf. Der Manager entscheidet selbst
|
participants.add(as.getUniqueId());
|
||||||
// anhand der Uhrzeit, ob er morgens, mittags oder nachts abspielt.
|
participants.add(UUID.fromString(partner1));
|
||||||
NexusLobby.getInstance().getConversationManager().playConversation(
|
if (partner2 != null) participants.add(UUID.fromString(partner2));
|
||||||
as.getUniqueId(),
|
if (partner3 != null) participants.add(UUID.fromString(partner3));
|
||||||
partnerUUID,
|
|
||||||
groupName
|
NexusLobby.getInstance().getConversationManager()
|
||||||
);
|
.playConversationGroup(participants, groupName);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
// Falls die UUID oder Gruppe ungültig ist
|
// Ungültige UUID oder fehlende Gruppe – still ignorieren
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,8 +99,11 @@ public enum ArmorStandTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ArmorStandTool get(ItemStack item) {
|
public static ArmorStandTool get(ItemStack item) {
|
||||||
if (item == null || !item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) return null;
|
if (item == null || !item.hasItemMeta()) return null;
|
||||||
String name = ChatColor.stripColor(item.getItemMeta().getDisplayName()).replace(" ", "_");
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
// FIX: getItemMeta() kann null zurückgeben; hasDisplayName() vor getDisplayName() prüfen
|
||||||
|
if (meta == null || !meta.hasDisplayName()) return null;
|
||||||
|
String name = ChatColor.stripColor(meta.getDisplayName()).replace(" ", "_");
|
||||||
if (name.equals("Pose_Editor_öffnen")) return OPEN_POSE_EDITOR;
|
if (name.equals("Pose_Editor_öffnen")) return OPEN_POSE_EDITOR;
|
||||||
if (name.equals("Gesprächs-Setup")) return CONV_SETUP;
|
if (name.equals("Gesprächs-Setup")) return CONV_SETUP;
|
||||||
try { return valueOf(name); } catch (Exception e) { return null; }
|
try { return valueOf(name); } catch (Exception e) { return null; }
|
||||||
|
|||||||
@@ -45,13 +45,15 @@ public class ConversationManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Entfernt alle verwaisten Sprechblasen in allen Welten.
|
* Entfernt alle verwaisten Sprechblasen in allen Welten.
|
||||||
|
* FIX: Nur ArmorStands mit dem Tag "nexus_bubble" werden entfernt.
|
||||||
|
* Die alte Bedingung (!isVisible && isMarker && customName != null) war
|
||||||
|
* zu breit und hätte auch legitime Marker-ArmorStands anderer Systeme gelöscht.
|
||||||
*/
|
*/
|
||||||
public void clearHangingBubbles() {
|
public void clearHangingBubbles() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (World world : Bukkit.getWorlds()) {
|
for (World world : Bukkit.getWorlds()) {
|
||||||
for (ArmorStand as : world.getEntitiesByClass(ArmorStand.class)) {
|
for (ArmorStand as : world.getEntitiesByClass(ArmorStand.class)) {
|
||||||
if (as.getScoreboardTags().contains("nexus_bubble") ||
|
if (as.getScoreboardTags().contains("nexus_bubble")) {
|
||||||
(!as.isVisible() && as.isMarker() && as.getCustomName() != null)) {
|
|
||||||
as.remove();
|
as.remove();
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -40,10 +40,21 @@ public class BorderCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
double radius = Double.parseDouble(args[1]);
|
double radius = Double.parseDouble(args[1]);
|
||||||
|
Location loc = p.getLocation();
|
||||||
|
|
||||||
config.set("worldborder.type", "CIRCLE");
|
config.set("worldborder.type", "CIRCLE");
|
||||||
config.set("worldborder.center", p.getLocation());
|
|
||||||
config.set("worldborder.radius", radius);
|
|
||||||
config.set("worldborder.enabled", true);
|
config.set("worldborder.enabled", true);
|
||||||
|
config.set("worldborder.radius", radius);
|
||||||
|
|
||||||
|
// FIX: Location als einzelne Werte speichern statt als Objekt.
|
||||||
|
// config.set(key, Location) ist nach Neustarts unzuverlässig,
|
||||||
|
// weil config.getLocation() die Welt zum Deserialisierungs-
|
||||||
|
// zeitpunkt auflösen muss und das fehlschlagen kann.
|
||||||
|
config.set("worldborder.center.world", loc.getWorld().getName());
|
||||||
|
config.set("worldborder.center.x", loc.getX());
|
||||||
|
config.set("worldborder.center.y", loc.getY());
|
||||||
|
config.set("worldborder.center.z", loc.getZ());
|
||||||
|
|
||||||
p.sendMessage("§8[§6Nexus§8] §aKreis-Grenze (Radius: " + radius + ") gesetzt.");
|
p.sendMessage("§8[§6Nexus§8] §aKreis-Grenze (Radius: " + radius + ") gesetzt.");
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
p.sendMessage("§cUngültige Zahl.");
|
p.sendMessage("§cUngültige Zahl.");
|
||||||
@@ -57,10 +68,21 @@ public class BorderCommand implements CommandExecutor {
|
|||||||
p.sendMessage("§8[§6Nexus§8] §cBitte markiere erst 2 Punkte mit der Portalwand!");
|
p.sendMessage("§8[§6Nexus§8] §cBitte markiere erst 2 Punkte mit der Portalwand!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.set("worldborder.type", "SQUARE");
|
config.set("worldborder.type", "SQUARE");
|
||||||
config.set("worldborder.pos1", l1);
|
|
||||||
config.set("worldborder.pos2", l2);
|
|
||||||
config.set("worldborder.enabled", true);
|
config.set("worldborder.enabled", true);
|
||||||
|
|
||||||
|
// FIX: Beide Positionen als einzelne Werte speichern
|
||||||
|
config.set("worldborder.pos1.world", l1.getWorld().getName());
|
||||||
|
config.set("worldborder.pos1.x", l1.getX());
|
||||||
|
config.set("worldborder.pos1.y", l1.getY());
|
||||||
|
config.set("worldborder.pos1.z", l1.getZ());
|
||||||
|
|
||||||
|
config.set("worldborder.pos2.world", l2.getWorld().getName());
|
||||||
|
config.set("worldborder.pos2.x", l2.getX());
|
||||||
|
config.set("worldborder.pos2.y", l2.getY());
|
||||||
|
config.set("worldborder.pos2.z", l2.getZ());
|
||||||
|
|
||||||
p.sendMessage("§8[§6Nexus§8] §aViereckige Grenze erfolgreich gesetzt.");
|
p.sendMessage("§8[§6Nexus§8] §aViereckige Grenze erfolgreich gesetzt.");
|
||||||
}
|
}
|
||||||
case "disable" -> {
|
case "disable" -> {
|
||||||
@@ -74,13 +96,13 @@ public class BorderCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NexusLobby.getInstance().saveConfig();
|
NexusLobby.getInstance().saveConfig();
|
||||||
|
|
||||||
// Update das Modul direkt im RAM
|
// Update das Modul direkt im RAM
|
||||||
BorderModule module = NexusLobby.getInstance().getModuleManager().getModule(BorderModule.class);
|
BorderModule module = NexusLobby.getInstance().getModuleManager().getModule(BorderModule.class);
|
||||||
if (module != null) {
|
if (module != null) {
|
||||||
module.reloadConfig();
|
module.reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,19 +9,29 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verwaltet die Lobby-Begrenzung (Kreis oder Rechteck).
|
* Verwaltet die Lobby-Begrenzung (Kreis oder Rechteck).
|
||||||
* Speichert Daten in der Haupt-config.yml unter 'worldborder'.
|
* Speichert Daten in der Haupt-config.yml unter 'worldborder'.
|
||||||
|
*
|
||||||
|
* FIX: Locations werden als einzelne Werte (worldName, x, y, z) gespeichert
|
||||||
|
* statt als serialisiertes Location-Objekt, da config.getLocation()
|
||||||
|
* nach einem Neustart unzuverlässig ist.
|
||||||
*/
|
*/
|
||||||
public class BorderModule implements Module, Listener {
|
public class BorderModule implements Module, Listener {
|
||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
private Location pos1, pos2, center;
|
// FIX: Statt Location-Objekte die rohen Werte cachen
|
||||||
|
private String pos1World, pos2World, centerWorld;
|
||||||
|
private double pos1X, pos1Y, pos1Z;
|
||||||
|
private double pos2X, pos2Y, pos2Z;
|
||||||
|
private double centerX, centerZ;
|
||||||
private double radius;
|
private double radius;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
private boolean hasPos1, hasPos2, hasCenter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() { return "WorldBorder"; }
|
public String getName() { return "WorldBorder"; }
|
||||||
@@ -34,74 +44,96 @@ public class BorderModule implements Module, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// Aufräumarbeiten falls nötig
|
// FIX: Listener beim Deaktivieren abmelden, damit nach /reload
|
||||||
|
// keine doppelten Events gefeuert werden.
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lädt die Border-Einstellungen aus der config.yml.
|
* Lädt die Border-Einstellungen aus der config.yml.
|
||||||
* Wird auch von NexusLobby.reloadPlugin() aufgerufen.
|
* Wird auch von BorderCommand und NexusLobby.reloadPlugin() aufgerufen.
|
||||||
|
*
|
||||||
|
* FIX: Robuste Methode - liest world-Name und einzelne Koordinaten,
|
||||||
|
* kein config.getLocation() mehr (das nach Neustarts versagen kann).
|
||||||
*/
|
*/
|
||||||
public void reloadConfig() {
|
public void reloadConfig() {
|
||||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||||
|
|
||||||
// Pfad in der config.yml: worldborder.enabled etc.
|
|
||||||
this.enabled = config.getBoolean("worldborder.enabled", false);
|
this.enabled = config.getBoolean("worldborder.enabled", false);
|
||||||
this.type = config.getString("worldborder.type", "CIRCLE");
|
this.type = config.getString("worldborder.type", "CIRCLE").toUpperCase();
|
||||||
this.radius = config.getDouble("worldborder.radius", 50.0);
|
this.radius = config.getDouble("worldborder.radius", 50.0);
|
||||||
|
|
||||||
// Locations laden
|
// --- CIRCLE-Daten laden ---
|
||||||
this.center = config.getLocation("worldborder.center");
|
this.hasCenter = config.contains("worldborder.center.world");
|
||||||
this.pos1 = config.getLocation("worldborder.pos1");
|
if (hasCenter) {
|
||||||
this.pos2 = config.getLocation("worldborder.pos2");
|
this.centerWorld = config.getString("worldborder.center.world");
|
||||||
|
this.centerX = config.getDouble("worldborder.center.x");
|
||||||
|
this.centerZ = config.getDouble("worldborder.center.z");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- SQUARE-Daten laden ---
|
||||||
|
this.hasPos1 = config.contains("worldborder.pos1.world");
|
||||||
|
this.hasPos2 = config.contains("worldborder.pos2.world");
|
||||||
|
if (hasPos1) {
|
||||||
|
this.pos1World = config.getString("worldborder.pos1.world");
|
||||||
|
this.pos1X = config.getDouble("worldborder.pos1.x");
|
||||||
|
this.pos1Y = config.getDouble("worldborder.pos1.y");
|
||||||
|
this.pos1Z = config.getDouble("worldborder.pos1.z");
|
||||||
|
}
|
||||||
|
if (hasPos2) {
|
||||||
|
this.pos2World = config.getString("worldborder.pos2.world");
|
||||||
|
this.pos2X = config.getDouble("worldborder.pos2.x");
|
||||||
|
this.pos2Y = config.getDouble("worldborder.pos2.y");
|
||||||
|
this.pos2Z = config.getDouble("worldborder.pos2.z");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onMove(PlayerMoveEvent event) {
|
public void onMove(PlayerMoveEvent event) {
|
||||||
if (!enabled || event.getTo() == null) return;
|
if (!enabled || event.getTo() == null) return;
|
||||||
|
|
||||||
// Performance: Nur prüfen, wenn sich die Block-Koordinaten ändern
|
// Performance: Nur prüfen wenn sich Block-Koordinaten ändern
|
||||||
if (event.getFrom().getBlockX() == event.getTo().getBlockX() &&
|
if (event.getFrom().getBlockX() == event.getTo().getBlockX() &&
|
||||||
event.getFrom().getBlockZ() == event.getTo().getBlockZ() &&
|
event.getFrom().getBlockZ() == event.getTo().getBlockZ() &&
|
||||||
event.getFrom().getBlockY() == event.getTo().getBlockY()) return;
|
event.getFrom().getBlockY() == event.getTo().getBlockY()) return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
// Admins und Spectators ignorieren
|
// FIX: nexuslobby.border.bypass statt nur nexuslobby.admin prüfen
|
||||||
if (player.hasPermission("nexuslobby.admin") || player.getGameMode().name().equals("SPECTATOR")) return;
|
if (player.hasPermission("nexuslobby.border.bypass") ||
|
||||||
|
player.hasPermission("nexuslobby.admin") ||
|
||||||
|
player.getGameMode().name().equals("SPECTATOR")) return;
|
||||||
|
|
||||||
Location to = event.getTo();
|
Location to = event.getTo();
|
||||||
boolean outside = false;
|
boolean outside = false;
|
||||||
|
|
||||||
// --- Prüfung: Kreis-Border ---
|
// --- Prüfung: Kreis-Border ---
|
||||||
if (type.equalsIgnoreCase("CIRCLE") && center != null) {
|
if (type.equals("CIRCLE") && hasCenter) {
|
||||||
if (to.getWorld().equals(center.getWorld())) {
|
World cWorld = Bukkit.getWorld(centerWorld);
|
||||||
double distSq = Math.pow(to.getX() - center.getX(), 2) + Math.pow(to.getZ() - center.getZ(), 2);
|
if (cWorld != null && to.getWorld().equals(cWorld)) {
|
||||||
if (distSq > Math.pow(radius, 2)) outside = true;
|
double distSq = Math.pow(to.getX() - centerX, 2) + Math.pow(to.getZ() - centerZ, 2);
|
||||||
|
if (distSq > radius * radius) outside = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// --- Prüfung: Rechteck-Border (Square) ---
|
// --- Prüfung: Rechteck-Border (Square) ---
|
||||||
else if (type.equalsIgnoreCase("SQUARE") && pos1 != null && pos2 != null) {
|
else if (type.equals("SQUARE") && hasPos1 && hasPos2) {
|
||||||
if (to.getWorld().equals(pos1.getWorld())) {
|
World bWorld = Bukkit.getWorld(pos1World);
|
||||||
double minX = Math.min(pos1.getX(), pos2.getX());
|
if (bWorld != null && to.getWorld().equals(bWorld)) {
|
||||||
double maxX = Math.max(pos1.getX(), pos2.getX());
|
double minX = Math.min(pos1X, pos2X);
|
||||||
double minZ = Math.min(pos1.getZ(), pos2.getZ());
|
double maxX = Math.max(pos1X, pos2X);
|
||||||
double maxZ = Math.max(pos1.getZ(), pos2.getZ());
|
double minZ = Math.min(pos1Z, pos2Z);
|
||||||
|
double maxZ = Math.max(pos1Z, pos2Z);
|
||||||
if (to.getX() < minX || to.getX() > maxX || to.getZ() < minZ || to.getZ() > maxZ) {
|
if (to.getX() < minX || to.getX() > maxX ||
|
||||||
|
to.getZ() < minZ || to.getZ() > maxZ) {
|
||||||
outside = true;
|
outside = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Aktion wenn außerhalb ---
|
|
||||||
if (outside) {
|
if (outside) {
|
||||||
Location spawnLocation = getMainSpawnLocation();
|
Location spawnLocation = getMainSpawnLocation();
|
||||||
|
|
||||||
if (spawnLocation != null) {
|
if (spawnLocation != null) {
|
||||||
// Sofortiger Teleport zum definierten Spawn
|
|
||||||
player.teleport(spawnLocation);
|
player.teleport(spawnLocation);
|
||||||
|
|
||||||
// Feedback an den Spieler
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.5f);
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.5f);
|
||||||
player.sendMessage("§8[§6Nexus§8] §cDu hast den Lobby-Bereich verlassen!");
|
player.sendMessage("§8[§6Nexus§8] §cDu hast den Lobby-Bereich verlassen!");
|
||||||
}
|
}
|
||||||
@@ -109,24 +141,22 @@ public class BorderModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holt den zentralen Spawnpunkt aus der Config (Pfad: spawn.world, spawn.x, etc.)
|
* Holt den Spawnpunkt aus der Config (Pfad: spawn.world, spawn.x, etc.)
|
||||||
*/
|
*/
|
||||||
private Location getMainSpawnLocation() {
|
private Location getMainSpawnLocation() {
|
||||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||||
String worldName = config.getString("spawn.world");
|
String worldName = config.getString("spawn.world");
|
||||||
|
|
||||||
if (worldName != null) {
|
if (worldName != null) {
|
||||||
World w = Bukkit.getWorld(worldName);
|
World w = Bukkit.getWorld(worldName);
|
||||||
if (w != null) {
|
if (w != null) {
|
||||||
return new Location(w,
|
return new Location(w,
|
||||||
config.getDouble("spawn.x"),
|
config.getDouble("spawn.x"),
|
||||||
config.getDouble("spawn.y"),
|
config.getDouble("spawn.y"),
|
||||||
config.getDouble("spawn.z"),
|
config.getDouble("spawn.z"),
|
||||||
(float) config.getDouble("spawn.yaw"),
|
(float) config.getDouble("spawn.yaw"),
|
||||||
(float) config.getDouble("spawn.pitch"));
|
(float) config.getDouble("spawn.pitch"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fallback falls kein Spawn gesetzt ist
|
|
||||||
return Bukkit.getWorlds().isEmpty() ? null : Bukkit.getWorlds().get(0).getSpawnLocation();
|
return Bukkit.getWorlds().isEmpty() ? null : Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,15 @@ import java.util.Random;
|
|||||||
|
|
||||||
public class ChickenRain {
|
public class ChickenRain {
|
||||||
|
|
||||||
|
// FIX: Verhindert, dass ein Spieler den Regen mehrfach gleichzeitig starten kann.
|
||||||
|
// Ohne diese Prüfung konnten beliebig viele parallele Tasks gestartet werden,
|
||||||
|
// was zu hunderten gespawnten Entities in Sekunden führte.
|
||||||
|
private static final java.util.Set<java.util.UUID> activeRains =
|
||||||
|
java.util.Collections.synchronizedSet(new java.util.HashSet<>());
|
||||||
|
|
||||||
public static void start(Player player) {
|
public static void start(Player player) {
|
||||||
|
if (activeRains.contains(player.getUniqueId())) return; // bereits aktiv
|
||||||
|
activeRains.add(player.getUniqueId());
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
int ticks = 0;
|
int ticks = 0;
|
||||||
final Random random = new Random();
|
final Random random = new Random();
|
||||||
@@ -22,6 +30,7 @@ public class ChickenRain {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!player.isOnline() || ticks > 100) { // 100 Ticks = 5 Sekunden
|
if (!player.isOnline() || ticks > 100) { // 100 Ticks = 5 Sekunden
|
||||||
|
activeRains.remove(player.getUniqueId());
|
||||||
this.cancel();
|
this.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,14 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FreezeRay {
|
public class FreezeRay {
|
||||||
// Auf public gesetzt, damit das GadgetModule im PlayerMoveEvent darauf prüfen kann
|
|
||||||
public static final Set<UUID> frozenPlayers = new HashSet<>();
|
// FIX: private statt public – Zugriff nur über isFrozen() und unfreeze()
|
||||||
|
private static final Set<UUID> frozenPlayers = new HashSet<>();
|
||||||
|
|
||||||
|
public static boolean isFrozen(UUID uuid) { return frozenPlayers.contains(uuid); }
|
||||||
|
|
||||||
|
/** Beim Disconnect aufrufen, damit kein Ghost-Eintrag bleibt. */
|
||||||
|
public static void unfreeze(UUID uuid) { frozenPlayers.remove(uuid); }
|
||||||
|
|
||||||
public static void shoot(Player shooter) {
|
public static void shoot(Player shooter) {
|
||||||
Location start = shooter.getEyeLocation();
|
Location start = shooter.getEyeLocation();
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class GadgetModule implements Module, Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, NexusLobby.getInstance());
|
Bukkit.getPluginManager().registerEvents(this, NexusLobby.getInstance());
|
||||||
|
// FIX: PetManager-Listener korrekt registrieren (war vorher toter Code)
|
||||||
|
PetManager.register();
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskTimer(NexusLobby.getInstance(), () -> {
|
Bukkit.getScheduler().runTaskTimer(NexusLobby.getInstance(), () -> {
|
||||||
PetManager.updatePets();
|
PetManager.updatePets();
|
||||||
@@ -83,7 +85,7 @@ public class GadgetModule implements Module, Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
if (FreezeRay.frozenPlayers.contains(event.getPlayer().getUniqueId())) {
|
if (FreezeRay.isFrozen(event.getPlayer().getUniqueId())) {
|
||||||
if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) {
|
if (event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) {
|
||||||
event.setTo(event.getFrom().setDirection(event.getTo().getDirection()));
|
event.setTo(event.getFrom().setDirection(event.getTo().getDirection()));
|
||||||
}
|
}
|
||||||
@@ -295,6 +297,7 @@ public class GadgetModule implements Module, Listener {
|
|||||||
activeEffects.remove(player.getUniqueId());
|
activeEffects.remove(player.getUniqueId());
|
||||||
activeShields.remove(player.getUniqueId());
|
activeShields.remove(player.getUniqueId());
|
||||||
PetManager.removePet(player);
|
PetManager.removePet(player);
|
||||||
|
FreezeRay.unfreeze(player.getUniqueId());
|
||||||
HatManager.removeHat(player);
|
HatManager.removeHat(player);
|
||||||
player.getInventory().remove(Material.FISHING_ROD);
|
player.getInventory().remove(Material.FISHING_ROD);
|
||||||
player.getInventory().remove(Material.PACKED_ICE);
|
player.getInventory().remove(Material.PACKED_ICE);
|
||||||
@@ -336,6 +339,8 @@ public class GadgetModule implements Module, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
|
PetManager.unregister();
|
||||||
PetManager.clearAll();
|
PetManager.clearAll();
|
||||||
activeBalloons.values().forEach(Balloon::remove);
|
activeBalloons.values().forEach(Balloon::remove);
|
||||||
activeBalloons.clear();
|
activeBalloons.clear();
|
||||||
|
|||||||
@@ -22,10 +22,30 @@ public class PetManager implements Listener {
|
|||||||
|
|
||||||
private static final Map<UUID, Entity> activePets = new HashMap<>();
|
private static final Map<UUID, Entity> activePets = new HashMap<>();
|
||||||
|
|
||||||
|
// Singleton-Instanz, damit registerEvents() nur einmal aufgerufen wird
|
||||||
|
private static PetManager instance;
|
||||||
|
|
||||||
public PetManager() {
|
public PetManager() {
|
||||||
Bukkit.getPluginManager().registerEvents(this, NexusLobby.getInstance());
|
Bukkit.getPluginManager().registerEvents(this, NexusLobby.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Registriert den PetManager als Listener, falls noch nicht geschehen.
|
||||||
|
* Muss einmalig beim Plugin-Start aufgerufen werden (z.B. aus GadgetModule.onEnable).
|
||||||
|
*/
|
||||||
|
public static void register() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new PetManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void unregister() {
|
||||||
|
if (instance != null) {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(instance);
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spawnt ein echtes Tier-Entity für den Spieler.
|
* Spawnt ein echtes Tier-Entity für den Spieler.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ public class HologramModule implements Module, Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
holograms.values().forEach(NexusHologram::removeAll);
|
holograms.values().forEach(NexusHologram::removeAll);
|
||||||
holograms.clear();
|
holograms.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class IntroModule implements Module, Listener, CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
activeIntro.clear();
|
activeIntro.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@@ -38,8 +40,18 @@ public class MapArtModule implements Module, CommandExecutor {
|
|||||||
private File storageFile;
|
private File storageFile;
|
||||||
private FileConfiguration storageConfig;
|
private FileConfiguration storageConfig;
|
||||||
|
|
||||||
// RAM-Schutz: Cache für bereits geladene Bild-Kacheln
|
// FIX: Unbegrenzter Cache führt bei vielen verschiedenen Bild-URLs zu einem
|
||||||
private final Map<String, BufferedImage> tileCache = new ConcurrentHashMap<>();
|
// OutOfMemoryError. Stattdessen nutzen wir einen LRU-Cache mit max. 50 Einträgen.
|
||||||
|
// Älteste Kacheln werden automatisch verdrängt.
|
||||||
|
private static final int MAX_CACHE_SIZE = 50;
|
||||||
|
private final Map<String, BufferedImage> tileCache = Collections.synchronizedMap(
|
||||||
|
new LinkedHashMap<String, BufferedImage>(MAX_CACHE_SIZE + 1, 0.75f, true) {
|
||||||
|
@Override
|
||||||
|
protected boolean removeEldestEntry(Map.Entry<String, BufferedImage> eldest) {
|
||||||
|
return size() > MAX_CACHE_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
// Hilfs-Set um parallele Downloads der gleichen URL zu verhindern
|
// Hilfs-Set um parallele Downloads der gleichen URL zu verhindern
|
||||||
private final Map<String, Boolean> loadingShield = new ConcurrentHashMap<>();
|
private final Map<String, Boolean> loadingShield = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ public class PlayerInspectModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {}
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEntityEvent event) {
|
public void onPlayerInteract(PlayerInteractEntityEvent event) {
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PortalCommand implements CommandExecutor {
|
public class PortalCommand implements CommandExecutor, Listener {
|
||||||
|
|
||||||
private final PortalManager portalManager;
|
private final PortalManager portalManager;
|
||||||
|
|
||||||
@@ -20,6 +23,17 @@ public class PortalCommand implements CommandExecutor {
|
|||||||
|
|
||||||
public PortalCommand(PortalManager portalManager) {
|
public PortalCommand(PortalManager portalManager) {
|
||||||
this.portalManager = portalManager;
|
this.portalManager = portalManager;
|
||||||
|
// FIX: Listener registrieren, damit Selektionen beim Verlassen bereinigt werden
|
||||||
|
de.nexuslobby.NexusLobby.getInstance().getServer().getPluginManager()
|
||||||
|
.registerEvents(this, de.nexuslobby.NexusLobby.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIX: Selektionen beim Quit entfernen – statische Maps wuchsen sonst ewig
|
||||||
|
@EventHandler
|
||||||
|
public void onQuit(PlayerQuitEvent event) {
|
||||||
|
UUID uuid = event.getPlayer().getUniqueId();
|
||||||
|
selection1.remove(uuid);
|
||||||
|
selection2.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statische Hilfsmethoden für andere Klassen
|
// Statische Hilfsmethoden für andere Klassen
|
||||||
|
|||||||
@@ -31,7 +31,12 @@ import java.util.UUID;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PortalManager - Verwaltet Portale, Markierungen und den globalen Grenzschutz.
|
* PortalManager - Verwaltet Portale und Wand-Markierungen.
|
||||||
|
*
|
||||||
|
* FIX: Die doppelte Border-Logik wurde entfernt. Der BorderModule ist
|
||||||
|
* der alleinige Verantwortliche für die Lobby-Grenze. Hätte der
|
||||||
|
* PortalManager die Border ebenfalls geprüft, wären Spieler doppelt
|
||||||
|
* teleportiert worden und hätten zwei Nachrichten erhalten.
|
||||||
*/
|
*/
|
||||||
public class PortalManager implements Module, Listener {
|
public class PortalManager implements Module, Listener {
|
||||||
|
|
||||||
@@ -42,12 +47,6 @@ public class PortalManager implements Module, Listener {
|
|||||||
private final NamespacedKey wandKey;
|
private final NamespacedKey wandKey;
|
||||||
private BukkitTask particleTask;
|
private BukkitTask particleTask;
|
||||||
|
|
||||||
// Boundary Cache
|
|
||||||
private Location borderMin;
|
|
||||||
private Location borderMax;
|
|
||||||
private boolean borderEnabled = false;
|
|
||||||
private String borderType;
|
|
||||||
|
|
||||||
public PortalManager(NexusLobby plugin) {
|
public PortalManager(NexusLobby plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.wandKey = new NamespacedKey(plugin, "nexuslobby_portal_wand");
|
this.wandKey = new NamespacedKey(plugin, "nexuslobby_portal_wand");
|
||||||
@@ -61,7 +60,6 @@ public class PortalManager implements Module, Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
loadPortals();
|
loadPortals();
|
||||||
loadBorderSettings();
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, plugin);
|
Bukkit.getPluginManager().registerEvents(this, plugin);
|
||||||
startParticleTask();
|
startParticleTask();
|
||||||
}
|
}
|
||||||
@@ -76,28 +74,6 @@ public class PortalManager implements Module, Listener {
|
|||||||
plugin.getLogger().info("PortalManager deaktiviert.");
|
plugin.getLogger().info("PortalManager deaktiviert.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadBorderSettings() {
|
|
||||||
this.borderType = plugin.getConfig().getString("worldborder.type", "SQUARE");
|
|
||||||
boolean enabled = plugin.getConfig().getBoolean("worldborder.enabled", false);
|
|
||||||
if (!enabled || !"SQUARE".equalsIgnoreCase(borderType)) {
|
|
||||||
this.borderEnabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plugin.getConfig().contains("worldborder.pos1") && plugin.getConfig().contains("worldborder.pos2")) {
|
|
||||||
Location p1 = plugin.getConfig().getLocation("worldborder.pos1");
|
|
||||||
Location p2 = plugin.getConfig().getLocation("worldborder.pos2");
|
|
||||||
if (p1 != null && p2 != null) {
|
|
||||||
this.borderMin = getMinLocation(p1, p2);
|
|
||||||
this.borderMax = getMaxLocation(p1, p2);
|
|
||||||
this.borderEnabled = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.borderEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getPortalNames() {
|
public Set<String> getPortalNames() {
|
||||||
return portals.keySet();
|
return portals.keySet();
|
||||||
}
|
}
|
||||||
@@ -135,20 +111,20 @@ public class PortalManager implements Module, Listener {
|
|||||||
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
selectionMap.get(uuid)[0] = clickedLoc;
|
selectionMap.get(uuid)[0] = clickedLoc;
|
||||||
PortalCommand.setSelection1(p, clickedLoc);
|
PortalCommand.setSelection1(p, clickedLoc);
|
||||||
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 2.0f);
|
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 2.0f);
|
||||||
p.sendMessage("§aPosition 1 gesetzt: " + clickedLoc.getBlockX() + ", " + clickedLoc.getBlockY() + ", " + clickedLoc.getBlockZ());
|
p.sendMessage("§aPosition 1 gesetzt: " + clickedLoc.getBlockX() + ", " + clickedLoc.getBlockY() + ", " + clickedLoc.getBlockZ());
|
||||||
|
|
||||||
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
} else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
selectionMap.get(uuid)[1] = clickedLoc;
|
selectionMap.get(uuid)[1] = clickedLoc;
|
||||||
PortalCommand.setSelection2(p, clickedLoc);
|
PortalCommand.setSelection2(p, clickedLoc);
|
||||||
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 1.0f);
|
p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 1.0f);
|
||||||
p.sendMessage("§bPosition 2 gesetzt: " + clickedLoc.getBlockX() + ", " + clickedLoc.getBlockY() + ", " + clickedLoc.getBlockZ());
|
p.sendMessage("§bPosition 2 gesetzt: " + clickedLoc.getBlockX() + ", " + clickedLoc.getBlockY() + ", " + clickedLoc.getBlockZ());
|
||||||
|
|
||||||
Location loc1 = selectionMap.get(uuid)[0];
|
Location loc1 = selectionMap.get(uuid)[0];
|
||||||
if (loc1 != null) {
|
if (loc1 != null) {
|
||||||
int width = Math.abs(loc1.getBlockX() - clickedLoc.getBlockX()) + 1;
|
int width = Math.abs(loc1.getBlockX() - clickedLoc.getBlockX()) + 1;
|
||||||
int height = Math.abs(loc1.getBlockY() - clickedLoc.getBlockY()) + 1;
|
int height = Math.abs(loc1.getBlockY() - clickedLoc.getBlockY()) + 1;
|
||||||
int length = Math.abs(loc1.getBlockZ() - clickedLoc.getBlockZ()) + 1;
|
int length = Math.abs(loc1.getBlockZ() - clickedLoc.getBlockZ()) + 1;
|
||||||
long volume = (long) width * height * length;
|
long volume = (long) width * height * length;
|
||||||
@@ -156,7 +132,7 @@ public class PortalManager implements Module, Listener {
|
|||||||
p.sendMessage("§7§m----------------------------------");
|
p.sendMessage("§7§m----------------------------------");
|
||||||
if (volume < 500) {
|
if (volume < 500) {
|
||||||
p.sendMessage("§e[Nexus] Kleiner Bereich erkannt (Portal-Größe)");
|
p.sendMessage("§e[Nexus] Kleiner Bereich erkannt (Portal-Größe)");
|
||||||
p.sendMessage("§fBefehl: §b/portal create <Name> <server|world>");
|
p.sendMessage("§fBefehl: §b/portal create <n> <server|world>");
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage("§6[Nexus] Großer Bereich erkannt (WorldBorder-Größe)");
|
p.sendMessage("§6[Nexus] Großer Bereich erkannt (WorldBorder-Größe)");
|
||||||
p.sendMessage("§fBefehl: §a/border square");
|
p.sendMessage("§fBefehl: §a/border square");
|
||||||
@@ -190,12 +166,9 @@ public class PortalManager implements Module, Listener {
|
|||||||
String type = portalConfig.getString("portals." + key + ".type", "WORLD");
|
String type = portalConfig.getString("portals." + key + ".type", "WORLD");
|
||||||
Portal portal = new Portal(key, type);
|
Portal portal = new Portal(key, type);
|
||||||
|
|
||||||
if (portalConfig.contains("portals." + key + ".pos1")) {
|
portal.setPos1(loadLocation(portalConfig, "portals." + key + ".pos1"));
|
||||||
portal.setPos1(portalConfig.getLocation("portals." + key + ".pos1"));
|
portal.setPos2(loadLocation(portalConfig, "portals." + key + ".pos2"));
|
||||||
}
|
portal.setReturnSpawn(loadLocation(portalConfig, "portals." + key + ".returnSpawn"));
|
||||||
if (portalConfig.contains("portals." + key + ".pos2")) {
|
|
||||||
portal.setPos2(portalConfig.getLocation("portals." + key + ".pos2"));
|
|
||||||
}
|
|
||||||
|
|
||||||
portal.setDestination(portalConfig.getString("portals." + key + ".destination", ""));
|
portal.setDestination(portalConfig.getString("portals." + key + ".destination", ""));
|
||||||
try {
|
try {
|
||||||
@@ -204,10 +177,6 @@ public class PortalManager implements Module, Listener {
|
|||||||
portal.setParticle(Particle.PORTAL);
|
portal.setParticle(Particle.PORTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (portalConfig.contains("portals." + key + ".returnSpawn")) {
|
|
||||||
portal.setReturnSpawn(portalConfig.getLocation("portals." + key + ".returnSpawn"));
|
|
||||||
}
|
|
||||||
|
|
||||||
portals.put(key, portal);
|
portals.put(key, portal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,11 +188,11 @@ public class PortalManager implements Module, Listener {
|
|||||||
for (Portal portal : portals.values()) {
|
for (Portal portal : portals.values()) {
|
||||||
String path = "portals." + portal.getName() + ".";
|
String path = "portals." + portal.getName() + ".";
|
||||||
config.set(path + "type", portal.getType());
|
config.set(path + "type", portal.getType());
|
||||||
config.set(path + "pos1", portal.getPos1());
|
saveLocation(config, path + "pos1", portal.getPos1());
|
||||||
config.set(path + "pos2", portal.getPos2());
|
saveLocation(config, path + "pos2", portal.getPos2());
|
||||||
config.set(path + "destination", portal.getDestination());
|
config.set(path + "destination", portal.getDestination());
|
||||||
config.set(path + "particle", portal.getParticle() != null ? portal.getParticle().name() : "PORTAL");
|
config.set(path + "particle", portal.getParticle() != null ? portal.getParticle().name() : "PORTAL");
|
||||||
config.set(path + "returnSpawn", portal.getReturnSpawn());
|
saveLocation(config, path + "returnSpawn", portal.getReturnSpawn());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -233,6 +202,35 @@ public class PortalManager implements Module, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIX: Hilfsmethoden für robustes Location-Speichern/Laden.
|
||||||
|
// Speichert world + x/y/z als einzelne Keys statt als serialisiertes
|
||||||
|
// Location-Objekt, was nach Neustarts zu null führen kann.
|
||||||
|
private void saveLocation(YamlConfiguration config, String path, Location loc) {
|
||||||
|
if (loc == null || loc.getWorld() == null) return;
|
||||||
|
config.set(path + ".world", loc.getWorld().getName());
|
||||||
|
config.set(path + ".x", loc.getX());
|
||||||
|
config.set(path + ".y", loc.getY());
|
||||||
|
config.set(path + ".z", loc.getZ());
|
||||||
|
config.set(path + ".yaw", (double) loc.getYaw());
|
||||||
|
config.set(path + ".pitch", (double) loc.getPitch());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Location loadLocation(YamlConfiguration config, String path) {
|
||||||
|
if (!config.contains(path + ".world")) return null;
|
||||||
|
String worldName = config.getString(path + ".world");
|
||||||
|
World world = Bukkit.getWorld(worldName);
|
||||||
|
if (world == null) {
|
||||||
|
plugin.getLogger().warning("Welt '" + worldName + "' nicht gefunden für Pfad: " + path);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Location(world,
|
||||||
|
config.getDouble(path + ".x"),
|
||||||
|
config.getDouble(path + ".y"),
|
||||||
|
config.getDouble(path + ".z"),
|
||||||
|
(float) config.getDouble(path + ".yaw"),
|
||||||
|
(float) config.getDouble(path + ".pitch"));
|
||||||
|
}
|
||||||
|
|
||||||
// --- CRUD ---
|
// --- CRUD ---
|
||||||
public boolean createPortal(String name, String type, Player creator) {
|
public boolean createPortal(String name, String type, Player creator) {
|
||||||
Location[] sel = selectionMap.getOrDefault(creator.getUniqueId(), new Location[2]);
|
Location[] sel = selectionMap.getOrDefault(creator.getUniqueId(), new Location[2]);
|
||||||
@@ -295,7 +293,7 @@ public class PortalManager implements Module, Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Movement / Teleport / Boundary Logic ---
|
// --- Movement / Teleport Logic ---
|
||||||
@org.bukkit.event.EventHandler
|
@org.bukkit.event.EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
if (event.getFrom().getX() == event.getTo().getX() &&
|
if (event.getFrom().getX() == event.getTo().getX() &&
|
||||||
@@ -307,20 +305,7 @@ public class PortalManager implements Module, Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Location loc = event.getTo();
|
Location loc = event.getTo();
|
||||||
|
|
||||||
// 1. Grenzschutz (Boundary Protection)
|
// Portal-Logik
|
||||||
if (borderEnabled && !player.hasPermission("nexuslobby.border.bypass")) {
|
|
||||||
if (!isWithinBorder(loc)) {
|
|
||||||
Location spawn = getMainSpawnLocation();
|
|
||||||
if (spawn != null) {
|
|
||||||
player.teleport(spawn);
|
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1.0f, 0.5f);
|
|
||||||
player.sendMessage("§c§lHEY! §7Du hast den erlaubten Bereich verlassen.");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2. Portal Logik
|
|
||||||
for (Portal portal : portals.values()) {
|
for (Portal portal : portals.values()) {
|
||||||
if (portal.getPos1() == null || portal.getPos2() == null) continue;
|
if (portal.getPos1() == null || portal.getPos2() == null) continue;
|
||||||
if (!isInArea(loc, portal.getPos1(), portal.getPos2())) continue;
|
if (!isInArea(loc, portal.getPos1(), portal.getPos2())) continue;
|
||||||
@@ -336,14 +321,6 @@ public class PortalManager implements Module, Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWithinBorder(Location loc) {
|
|
||||||
if (borderMin == null || borderMax == null) return true;
|
|
||||||
if (!loc.getWorld().equals(borderMin.getWorld())) return true;
|
|
||||||
return loc.getX() >= borderMin.getX() && loc.getX() <= borderMax.getX() &&
|
|
||||||
loc.getY() >= borderMin.getY() && loc.getY() <= borderMax.getY() &&
|
|
||||||
loc.getZ() >= borderMin.getZ() && loc.getZ() <= borderMax.getZ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void executeTeleport(Player player, Portal portal) {
|
private void executeTeleport(Player player, Portal portal) {
|
||||||
if ("SERVER".equalsIgnoreCase(portal.getType())) {
|
if ("SERVER".equalsIgnoreCase(portal.getType())) {
|
||||||
String serverName = portal.getDestination();
|
String serverName = portal.getDestination();
|
||||||
@@ -352,17 +329,17 @@ public class PortalManager implements Module, Listener {
|
|||||||
Location loc = portal.getReturnSpawn();
|
Location loc = portal.getReturnSpawn();
|
||||||
if (loc == null) {
|
if (loc == null) {
|
||||||
Location pos2 = portal.getPos2();
|
Location pos2 = portal.getPos2();
|
||||||
loc = player.getLocation();
|
loc = player.getLocation().clone();
|
||||||
if (pos2 != null) {
|
if (pos2 != null) {
|
||||||
double dx = loc.getX() - pos2.getX();
|
double dx = loc.getX() - pos2.getX();
|
||||||
double dz = loc.getZ() - pos2.getZ();
|
double dz = loc.getZ() - pos2.getZ();
|
||||||
double length = Math.sqrt(dx*dx + dz*dz);
|
double length = Math.sqrt(dx * dx + dz * dz);
|
||||||
if (length == 0) length = 1;
|
if (length == 0) length = 1;
|
||||||
dx = (dx / length) * 2;
|
dx = (dx / length) * 2;
|
||||||
dz = (dz / length) * 2;
|
dz = (dz / length) * 2;
|
||||||
loc.add(dx, 0, dz);
|
loc.add(dx, 0, dz);
|
||||||
} else {
|
} else {
|
||||||
loc.add(0,0,2);
|
loc.add(0, 0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
@@ -393,7 +370,7 @@ public class PortalManager implements Module, Listener {
|
|||||||
double x = Double.parseDouble(parts[1]);
|
double x = Double.parseDouble(parts[1]);
|
||||||
double y = Double.parseDouble(parts[2]);
|
double y = Double.parseDouble(parts[2]);
|
||||||
double z = Double.parseDouble(parts[3]);
|
double z = Double.parseDouble(parts[3]);
|
||||||
float yaw = parts.length >= 6 ? Float.parseFloat(parts[4]) : 0f;
|
float yaw = parts.length >= 5 ? Float.parseFloat(parts[4]) : 0f;
|
||||||
float pitch = parts.length >= 6 ? Float.parseFloat(parts[5]) : 0f;
|
float pitch = parts.length >= 6 ? Float.parseFloat(parts[5]) : 0f;
|
||||||
player.teleport(new Location(world, x, y, z, yaw, pitch));
|
player.teleport(new Location(world, x, y, z, yaw, pitch));
|
||||||
player.sendMessage("§aDu wurdest teleportiert!");
|
player.sendMessage("§aDu wurdest teleportiert!");
|
||||||
@@ -418,11 +395,11 @@ public class PortalManager implements Module, Listener {
|
|||||||
if (worldName != null) {
|
if (worldName != null) {
|
||||||
World w = Bukkit.getWorld(worldName);
|
World w = Bukkit.getWorld(worldName);
|
||||||
if (w != null) {
|
if (w != null) {
|
||||||
return new Location(w,
|
return new Location(w,
|
||||||
plugin.getConfig().getDouble("spawn.x"),
|
plugin.getConfig().getDouble("spawn.x"),
|
||||||
plugin.getConfig().getDouble("spawn.y"),
|
plugin.getConfig().getDouble("spawn.y"),
|
||||||
plugin.getConfig().getDouble("spawn.z"),
|
plugin.getConfig().getDouble("spawn.z"),
|
||||||
(float) plugin.getConfig().getDouble("spawn.yaw"),
|
(float) plugin.getConfig().getDouble("spawn.yaw"),
|
||||||
(float) plugin.getConfig().getDouble("spawn.pitch"));
|
(float) plugin.getConfig().getDouble("spawn.pitch"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -461,6 +438,7 @@ public class PortalManager implements Module, Listener {
|
|||||||
Location min = getMinLocation(portal.getPos1(), portal.getPos2());
|
Location min = getMinLocation(portal.getPos1(), portal.getPos2());
|
||||||
Location max = getMaxLocation(portal.getPos1(), portal.getPos2());
|
Location max = getMaxLocation(portal.getPos1(), portal.getPos2());
|
||||||
World world = portal.getPos1().getWorld();
|
World world = portal.getPos1().getWorld();
|
||||||
|
if (world == null) return;
|
||||||
for (int i = 0; i < 15; i++) {
|
for (int i = 0; i < 15; i++) {
|
||||||
double x = min.getX() + Math.random() * (max.getX() - min.getX() + 1);
|
double x = min.getX() + Math.random() * (max.getX() - min.getX() + 1);
|
||||||
double y = min.getY() + Math.random() * (max.getY() - min.getY() + 1);
|
double y = min.getY() + Math.random() * (max.getY() - min.getY() + 1);
|
||||||
|
|||||||
@@ -115,5 +115,7 @@ public class SecurityModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {}
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -231,5 +231,8 @@ public class LobbySettingsModule implements Module, Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() { saveSettings(); }
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
|
saveSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,7 @@ public class GlobalChatSuppressor implements Module, PluginMessageListener, List
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
|
org.bukkit.event.HandlerList.unregisterAll(this);
|
||||||
plugin.getServer().getMessenger().unregisterIncomingPluginChannel(plugin, CHANNEL_CONTROL);
|
plugin.getServer().getMessenger().unregisterIncomingPluginChannel(plugin, CHANNEL_CONTROL);
|
||||||
plugin.getServer().getMessenger().unregisterIncomingPluginChannel(plugin, CHANNEL_CHAT);
|
plugin.getServer().getMessenger().unregisterIncomingPluginChannel(plugin, CHANNEL_CHAT);
|
||||||
plugin.getServer().getMessenger().unregisterOutgoingPluginChannel(plugin, CHANNEL_CONTROL);
|
plugin.getServer().getMessenger().unregisterOutgoingPluginChannel(plugin, CHANNEL_CONTROL);
|
||||||
@@ -105,4 +106,4 @@ public class GlobalChatSuppressor implements Module, PluginMessageListener, List
|
|||||||
SuppressManager.unsuppress(uuid);
|
SuppressManager.unsuppress(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,12 +65,12 @@ worldborder:
|
|||||||
|
|
||||||
# Zentrum der Weltgrenze (optional, kann leer bleiben)
|
# Zentrum der Weltgrenze (optional, kann leer bleiben)
|
||||||
# Wenn nicht gesetzt, wird der Spawn-Punkt als Zentrum verwendet
|
# Wenn nicht gesetzt, wird der Spawn-Punkt als Zentrum verwendet
|
||||||
center:
|
# center wird automatisch über /border circle gesetzt
|
||||||
|
|
||||||
# Alternative: Definiere Eckpunkte (für rechteckige Border)
|
# Alternative: Definiere Eckpunkte (für rechteckige Border)
|
||||||
# Format: x,y,z
|
# Format: x,y,z
|
||||||
pos1:
|
# pos1 wird automatisch über /border square gesetzt
|
||||||
pos2:
|
# pos2 wird automatisch über /border square gesetzt
|
||||||
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════════════
|
||||||
# LOBBY EINSTELLUNGEN
|
# LOBBY EINSTELLUNGEN
|
||||||
@@ -162,7 +162,7 @@ items:
|
|||||||
# Kompass (Server-Auswahl / Teleporter)
|
# Kompass (Server-Auswahl / Teleporter)
|
||||||
compass:
|
compass:
|
||||||
# Aktiviert das Kompass-Item (true = an, false = aus)
|
# Aktiviert das Kompass-Item (true = an, false = aus)
|
||||||
enabled: true
|
enabled: false
|
||||||
|
|
||||||
# Anzeigename des Items (unterstützt Farbcodes)
|
# Anzeigename des Items (unterstützt Farbcodes)
|
||||||
displayname: "&eTeleporter"
|
displayname: "&eTeleporter"
|
||||||
@@ -184,7 +184,7 @@ items:
|
|||||||
# Gadget-Menü (Spezialeffekte und Extras)
|
# Gadget-Menü (Spezialeffekte und Extras)
|
||||||
gadget:
|
gadget:
|
||||||
# Aktiviert das Gadget-Item (true = an, false = aus)
|
# Aktiviert das Gadget-Item (true = an, false = aus)
|
||||||
enabled: false
|
enabled: true
|
||||||
|
|
||||||
# Anzeigename des Items (unterstützt Farbcodes)
|
# Anzeigename des Items (unterstützt Farbcodes)
|
||||||
displayname: "&bGadgets"
|
displayname: "&bGadgets"
|
||||||
@@ -283,7 +283,7 @@ player_inspect:
|
|||||||
# Join/Quit-Nachrichten Unterdrückung und BungeeCord-Messaging
|
# Join/Quit-Nachrichten Unterdrückung und BungeeCord-Messaging
|
||||||
suppressor:
|
suppressor:
|
||||||
# Aktiviert das Suppressor-System (true = an, false = aus)
|
# Aktiviert das Suppressor-System (true = an, false = aus)
|
||||||
enabled: true
|
enabled: false
|
||||||
|
|
||||||
# Unterdrückt Join- und Quit-Nachrichten für neue Spieler temporär
|
# Unterdrückt Join- und Quit-Nachrichten für neue Spieler temporär
|
||||||
# true = Nachrichten werden unterdrückt, false = normale Anzeige
|
# true = Nachrichten werden unterdrückt, false = normale Anzeige
|
||||||
@@ -402,7 +402,7 @@ ball:
|
|||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
# Spawn-Position des Balls
|
# Spawn-Position des Balls
|
||||||
# Tipp: Nutze /nexus ball setspawn um diese Position automatisch zu setzen
|
# Tipp: Nutze /nexuslobby ball setspawn um diese Position automatisch zu setzen
|
||||||
spawn:
|
spawn:
|
||||||
# Name der Welt in der der Ball spawnt
|
# Name der Welt in der der Ball spawnt
|
||||||
world: "world"
|
world: "world"
|
||||||
@@ -425,6 +425,57 @@ ball:
|
|||||||
# 0 = Kein automatischer Respawn
|
# 0 = Kein automatischer Respawn
|
||||||
respawn_delay: 60
|
respawn_delay: 60
|
||||||
|
|
||||||
|
# ══════════════════════════════════════════════════════════════════════════
|
||||||
|
# TOR-DEFINITIONEN
|
||||||
|
# ══════════════════════════════════════════════════════════════════════════
|
||||||
|
# Tore werden automatisch per Befehl gesetzt und hier gespeichert.
|
||||||
|
# Manuell bearbeiten ist möglich, aber der Befehlsweg ist empfohlen.
|
||||||
|
#
|
||||||
|
# Anleitung zum Einrichten eines Tores:
|
||||||
|
# 1. Gehe zur INNEREN Ecke des Torrahmens (z.B. linke untere Ecke)
|
||||||
|
# /nexuslobby ball goal pos1
|
||||||
|
# 2. Gehe zur GEGENÜBERLIEGENDEN Ecke (rechte obere Ecke, auch 1-2 Blöcke
|
||||||
|
# hinter dem Tor in Schussrichtung für bessere Erkennung!)
|
||||||
|
# /nexuslobby ball goal pos2
|
||||||
|
# 3. Speichern (Team 1 = Blau, Team 2 = Rot):
|
||||||
|
# /nexuslobby ball goal save torBlau 1
|
||||||
|
#
|
||||||
|
# WICHTIG für zuverlässige Erkennung:
|
||||||
|
# - Die Box muss MINDESTENS 1.5 Blöcke Tiefe in Schussrichtung haben
|
||||||
|
# - Die Box muss MINDESTENS 3 Blöcke hoch sein (Y-Achse)
|
||||||
|
# - Nutze /nexuslobby ball goal show um die Box sichtbar zu machen
|
||||||
|
# - Nutze /nexuslobby ball goal debug um die Ball-Position live zu prüfen
|
||||||
|
#
|
||||||
|
# Beispiel-Eintrag (wird vom Plugin automatisch befüllt):
|
||||||
|
# goals:
|
||||||
|
# torBlau:
|
||||||
|
# pos1:
|
||||||
|
# world: world
|
||||||
|
# x: 100.0
|
||||||
|
# y: 64.0
|
||||||
|
# z: 198.0
|
||||||
|
# pos2:
|
||||||
|
# world: world
|
||||||
|
# x: 106.0
|
||||||
|
# y: 68.0
|
||||||
|
# z: 200.5 # <-- 2.5 Blöcke Tiefe in Z-Richtung!
|
||||||
|
# team: 1
|
||||||
|
# torRot:
|
||||||
|
# pos1:
|
||||||
|
# world: world
|
||||||
|
# x: 100.0
|
||||||
|
# y: 64.0
|
||||||
|
# z: -198.0
|
||||||
|
# pos2:
|
||||||
|
# world: world
|
||||||
|
# x: 106.0
|
||||||
|
# y: 68.0
|
||||||
|
# z: -200.5
|
||||||
|
# team: 2
|
||||||
|
#
|
||||||
|
# Tore werden hier automatisch eingetragen sobald du den save-Befehl nutzt:
|
||||||
|
goals: {}
|
||||||
|
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════════════
|
||||||
# Links
|
# Links
|
||||||
# ══════════════════════════════════════════════════════════════════════════════
|
# ══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: NexusLobby
|
name: NexusLobby
|
||||||
main: de.nexuslobby.NexusLobby
|
main: de.nexuslobby.NexusLobby
|
||||||
version: "1.1.1"
|
version: "1.1.3"
|
||||||
api-version: "1.21"
|
api-version: "1.21"
|
||||||
author: M_Viper
|
author: M_Viper
|
||||||
description: Modular Lobby Plugin with an invisible Particle-Parkour system.
|
description: Modular Lobby Plugin with an invisible Particle-Parkour system.
|
||||||
|
|||||||
Reference in New Issue
Block a user