Update from Git Manager GUI
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package de.nexuslobby.commands;
|
||||
|
||||
import de.nexuslobby.NexusLobby;
|
||||
import de.nexuslobby.modules.portal.PortalManager;
|
||||
import de.nexuslobby.modules.hologram.HologramModule;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -25,31 +26,31 @@ public class LobbyTabCompleter implements TabCompleter {
|
||||
@Override
|
||||
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
String cmdName = command.getName().toLowerCase();
|
||||
|
||||
// --- NexusLobby Hauptbefehl (/nexus) ---
|
||||
if (command.getName().equalsIgnoreCase("nexuslobby") || command.getName().equalsIgnoreCase("nexus")) {
|
||||
if (cmdName.equals("nexuslobby") || cmdName.equals("nexus")) {
|
||||
if (args.length == 1) {
|
||||
// Hier fügen wir 'setspawn' hinzu
|
||||
if (sender.hasPermission("nexuslobby.admin")) {
|
||||
suggestions.add("reload");
|
||||
suggestions.add("setspawn");
|
||||
suggestions.addAll(Arrays.asList("reload", "setspawn", "silentjoin"));
|
||||
}
|
||||
suggestions.add("sb");
|
||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("sb")) {
|
||||
suggestions.add("on");
|
||||
suggestions.add("off");
|
||||
if (sender.hasPermission("nexuslobby.scoreboard.admin")) {
|
||||
suggestions.add("admin");
|
||||
suggestions.add("spieler");
|
||||
} else if (args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("sb")) {
|
||||
suggestions.addAll(Arrays.asList("on", "off"));
|
||||
if (sender.hasPermission("nexuslobby.scoreboard.admin")) {
|
||||
suggestions.addAll(Arrays.asList("admin", "spieler"));
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("silentjoin")) {
|
||||
suggestions.addAll(Arrays.asList("on", "off"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- Hologram Befehl ---
|
||||
else if (command.getName().equalsIgnoreCase("holo")) {
|
||||
else if (cmdName.equals("holo")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.add("create");
|
||||
suggestions.add("delete");
|
||||
suggestions.addAll(Arrays.asList("create", "delete"));
|
||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
||||
if (hologramModule != null) {
|
||||
suggestions.addAll(hologramModule.getHologramIds());
|
||||
@@ -58,19 +59,16 @@ public class LobbyTabCompleter implements TabCompleter {
|
||||
}
|
||||
|
||||
// --- Wartungsmodus ---
|
||||
else if (command.getName().equalsIgnoreCase("maintenance")) {
|
||||
else if (cmdName.equals("maintenance")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.add("on");
|
||||
suggestions.add("off");
|
||||
suggestions.addAll(Arrays.asList("on", "off"));
|
||||
}
|
||||
}
|
||||
|
||||
// --- Portalsystem ---
|
||||
else if (command.getName().equalsIgnoreCase("portal")) {
|
||||
else if (cmdName.equals("portal")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.add("create");
|
||||
suggestions.add("delete");
|
||||
suggestions.add("list");
|
||||
suggestions.addAll(Arrays.asList("create", "delete", "list"));
|
||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("delete")) {
|
||||
if (portalManager != null) {
|
||||
suggestions.addAll(portalManager.getPortalNames());
|
||||
@@ -79,7 +77,7 @@ public class LobbyTabCompleter implements TabCompleter {
|
||||
}
|
||||
|
||||
// --- MapArt ---
|
||||
else if (command.getName().equalsIgnoreCase("mapart")) {
|
||||
else if (cmdName.equals("mapart")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.add("https://");
|
||||
} else if (args.length == 2) {
|
||||
@@ -88,31 +86,73 @@ public class LobbyTabCompleter implements TabCompleter {
|
||||
}
|
||||
|
||||
// --- Intro System ---
|
||||
else if (command.getName().equalsIgnoreCase("intro")) {
|
||||
else if (cmdName.equals("intro")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.addAll(Arrays.asList("add", "clear", "start"));
|
||||
}
|
||||
}
|
||||
|
||||
// --- WorldBorder ---
|
||||
else if (command.getName().equalsIgnoreCase("border")) {
|
||||
else if (cmdName.equals("border")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.add("circle");
|
||||
suggestions.add("square");
|
||||
suggestions.add("disable");
|
||||
suggestions.addAll(Arrays.asList("circle", "square", "disable"));
|
||||
} else if (args.length == 2 && args[0].equalsIgnoreCase("circle")) {
|
||||
suggestions.addAll(Arrays.asList("10", "25", "50", "100", "250"));
|
||||
}
|
||||
}
|
||||
|
||||
// --- NexusCmd & Tools (Verkürzte Logik) ---
|
||||
else if (command.getName().equalsIgnoreCase("nexuscmd") || command.getName().equalsIgnoreCase("ncmd")) {
|
||||
// --- NexusCmd (ArmorStand Commands & Dialoge) ---
|
||||
else if (cmdName.equals("nexuscmd") || cmdName.equals("ncmd") || cmdName.equals("ascmd")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.addAll(Arrays.asList("name", "list", "add", "remove"));
|
||||
suggestions.addAll(Arrays.asList("add", "remove", "list", "name", "lookat", "conv"));
|
||||
}
|
||||
else if (args.length == 2) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
||||
} else if (args[0].equalsIgnoreCase("name")) {
|
||||
suggestions.addAll(Arrays.asList("<Anzeigename>", "none"));
|
||||
} else if (args[0].equalsIgnoreCase("conv")) {
|
||||
// NEU: unlink hinzugefügt
|
||||
suggestions.addAll(Arrays.asList("select1", "select2", "link", "unlink", "start"));
|
||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||
suggestions.add("all");
|
||||
}
|
||||
}
|
||||
else if (args.length == 3) {
|
||||
if (args[0].equalsIgnoreCase("add")) {
|
||||
suggestions.addAll(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"));
|
||||
} else if (args[0].equalsIgnoreCase("conv")) {
|
||||
if (args[1].equalsIgnoreCase("start") || args[1].equalsIgnoreCase("link")) {
|
||||
if (NexusLobby.getInstance().getConversationManager() != null) {
|
||||
suggestions.addAll(NexusLobby.getInstance().getConversationManager().getConversationIds());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.length == 4 && args[0].equalsIgnoreCase("add")) {
|
||||
suggestions.addAll(Arrays.asList("bungee", "console", "player"));
|
||||
}
|
||||
else if (args.length == 5 && args[0].equalsIgnoreCase("add") && args[3].equalsIgnoreCase("bungee")) {
|
||||
if (NexusLobby.getInstance().getConfig().getConfigurationSection("servers") != null) {
|
||||
suggestions.addAll(NexusLobby.getInstance().getConfig().getConfigurationSection("servers").getKeys(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Filtert die Vorschläge basierend auf dem, was der Spieler bereits getippt hat
|
||||
// --- ArmorStandTools (/astools) ---
|
||||
else if (cmdName.equals("astools") || cmdName.equals("nt") || cmdName.equals("ntools")) {
|
||||
if (args.length == 1) {
|
||||
suggestions.addAll(Arrays.asList("dynamic", "lookat", "addplayer", "addconsole", "remove", "reload"));
|
||||
}
|
||||
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"));
|
||||
}
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
// Filtert die Liste basierend auf der bisherigen Eingabe (für Case-Insensitivity und Teilübereinstimmung)
|
||||
return suggestions.stream()
|
||||
.filter(s -> s.toLowerCase().startsWith(args[args.length - 1].toLowerCase()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -18,15 +18,12 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage("§cDieser Befehl ist nur für Spieler!");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
// ==========================================
|
||||
// LOGIK FÜR /spawn
|
||||
// ==========================================
|
||||
// --- SPAWN BEFEHL ---
|
||||
if (command.getName().equalsIgnoreCase("spawn")) {
|
||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||
if (config.contains("spawn.world")) {
|
||||
@@ -44,75 +41,94 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// LOGIK FÜR /nexus (Hauptbefehl)
|
||||
// ==========================================
|
||||
|
||||
// Sub-Befehl: /nexus setspawn
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("setspawn")) {
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cDu hast keine Berechtigung, den Spawn zu setzen.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location loc = player.getLocation();
|
||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||
|
||||
config.set("spawn.world", loc.getWorld().getName());
|
||||
config.set("spawn.x", loc.getX());
|
||||
config.set("spawn.y", loc.getY());
|
||||
config.set("spawn.z", loc.getZ());
|
||||
config.set("spawn.yaw", (double) loc.getYaw());
|
||||
config.set("spawn.pitch", (double) loc.getPitch());
|
||||
|
||||
NexusLobby.getInstance().saveConfig();
|
||||
|
||||
player.sendMessage("§8[§6Nexus§8] §aLobby-Spawn erfolgreich gesetzt!");
|
||||
player.sendMessage("§7X: §f" + String.format("%.2f", loc.getX()) + " §7Y: §f" + String.format("%.2f", loc.getY()) + " §7Z: §f" + String.format("%.2f", loc.getZ()));
|
||||
// --- HAUPTBEFEHL ARGUMENTE ---
|
||||
if (args.length == 0) {
|
||||
sendInfo(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Sub-Befehl: /nexus sb <on|off|admin|spieler>
|
||||
if (args.length >= 2 && args[0].equalsIgnoreCase("sb")) {
|
||||
ScoreboardModule sbModule = (ScoreboardModule) NexusLobby.getInstance().getModuleManager().getModule(ScoreboardModule.class);
|
||||
if (sbModule == null) {
|
||||
player.sendMessage("§cScoreboard-Modul ist deaktiviert.");
|
||||
return true;
|
||||
}
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "reload":
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Aufruf der Reload-Methode in der Hauptklasse
|
||||
NexusLobby.getInstance().reloadPlugin();
|
||||
|
||||
player.sendMessage("§8[§6Nexus§8] §aPlugin erfolgreich neu geladen!");
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1f, 1.5f);
|
||||
break;
|
||||
|
||||
String sub = args[1].toLowerCase();
|
||||
switch (sub) {
|
||||
case "on": sbModule.setVisibility(player, true); break;
|
||||
case "off": sbModule.setVisibility(player, false); break;
|
||||
case "admin":
|
||||
if (player.hasPermission("nexuslobby.scoreboard.admin")) sbModule.setAdminMode(player, true);
|
||||
else player.sendMessage("§cKeine Rechte.");
|
||||
break;
|
||||
case "spieler":
|
||||
if (player.hasPermission("nexuslobby.scoreboard.admin")) sbModule.setAdminMode(player, false);
|
||||
else player.sendMessage("§cKeine Rechte.");
|
||||
break;
|
||||
default: player.sendMessage("§cBenutzung: /nexus sb <on|off|admin|spieler>"); break;
|
||||
}
|
||||
return true;
|
||||
case "setspawn":
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||
config.set("spawn.world", loc.getWorld().getName());
|
||||
config.set("spawn.x", loc.getX());
|
||||
config.set("spawn.y", loc.getY());
|
||||
config.set("spawn.z", loc.getZ());
|
||||
config.set("spawn.yaw", (double) loc.getYaw());
|
||||
config.set("spawn.pitch", (double) loc.getPitch());
|
||||
NexusLobby.getInstance().saveConfig();
|
||||
player.sendMessage("§8[§6Nexus§8] §aLobby-Spawn erfolgreich gesetzt!");
|
||||
break;
|
||||
|
||||
case "silentjoin":
|
||||
if (!player.hasPermission("nexuslobby.silentjoin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
if (NexusLobby.getInstance().getSilentPlayers().contains(player.getUniqueId())) {
|
||||
NexusLobby.getInstance().getSilentPlayers().remove(player.getUniqueId());
|
||||
player.sendMessage("§8[§6Nexus§8] §7Silent Join: §cDeaktiviert");
|
||||
} else {
|
||||
NexusLobby.getInstance().getSilentPlayers().add(player.getUniqueId());
|
||||
player.sendMessage("§8[§6Nexus§8] §7Silent Join: §aAktiviert");
|
||||
}
|
||||
break;
|
||||
|
||||
case "sb":
|
||||
handleScoreboard(player, args);
|
||||
break;
|
||||
|
||||
default:
|
||||
sendInfo(player);
|
||||
break;
|
||||
}
|
||||
|
||||
// Sub-Befehl: /nexus reload
|
||||
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cKeine Rechte.");
|
||||
return true;
|
||||
}
|
||||
NexusLobby.getInstance().reloadPlugin();
|
||||
player.sendMessage("§7[§6NexusLobby§7] §aPlugin erfolgreich neu geladen!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Info-Screen
|
||||
sendInfo(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleScoreboard(Player player, String[] args) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§cBenutzung: /nexus sb <on|off|admin|spieler>");
|
||||
return;
|
||||
}
|
||||
ScoreboardModule sbModule = (ScoreboardModule) NexusLobby.getInstance().getModuleManager().getModule(ScoreboardModule.class);
|
||||
if (sbModule == null) {
|
||||
player.sendMessage("§cScoreboard-Modul ist deaktiviert.");
|
||||
return;
|
||||
}
|
||||
String sub = args[1].toLowerCase();
|
||||
switch (sub) {
|
||||
case "on": sbModule.setVisibility(player, true); break;
|
||||
case "off": sbModule.setVisibility(player, false); break;
|
||||
case "admin":
|
||||
if (player.hasPermission("nexuslobby.scoreboard.admin")) sbModule.setAdminMode(player, true);
|
||||
else player.sendMessage("§cKeine Rechte.");
|
||||
break;
|
||||
case "spieler":
|
||||
if (player.hasPermission("nexuslobby.scoreboard.admin")) sbModule.setAdminMode(player, false);
|
||||
else player.sendMessage("§cKeine Rechte.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private Location getSpawnFromConfig(FileConfiguration config) {
|
||||
World world = Bukkit.getWorld(config.getString("spawn.world", "world"));
|
||||
if (world == null) return null;
|
||||
@@ -122,14 +138,14 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void sendInfo(Player player) {
|
||||
String version = NexusLobby.getInstance().getDescription().getVersion();
|
||||
player.sendMessage("§8§m--------------------------------------");
|
||||
player.sendMessage("§6§lNexusLobby §7- Informationen");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("§f/spawn §7- Zum Spawn teleportieren");
|
||||
player.sendMessage("§f/nexus setspawn §7- Spawn setzen");
|
||||
player.sendMessage("§f/nexus reload §7- Konfiguration laden");
|
||||
player.sendMessage("§f/nexus silentjoin §7- Join-Nachricht umschalten");
|
||||
player.sendMessage("§f/nexus sb <on|off> §7- Scoreboard");
|
||||
player.sendMessage("§f/nexus reload §7- Konfiguration laden");
|
||||
player.sendMessage("§8§m--------------------------------------");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user