Update from Git Manager GUI
This commit is contained in:
@@ -2,6 +2,7 @@ package de.nexuslobby.commands;
|
||||
|
||||
import de.nexuslobby.NexusLobby;
|
||||
import de.nexuslobby.modules.ScoreboardModule;
|
||||
import de.nexuslobby.modules.parkour.ParkourManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@@ -10,9 +11,13 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NexusLobbyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
@@ -23,8 +28,29 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
String cmdName = command.getName().toLowerCase();
|
||||
ParkourManager pm = NexusLobby.getInstance().getParkourManager();
|
||||
|
||||
// --- DIREKTE KURZ-BEFEHLE ---
|
||||
if (cmdName.equalsIgnoreCase("setstart")) {
|
||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||
handleSetStart(player, pm);
|
||||
return true;
|
||||
}
|
||||
if (cmdName.equalsIgnoreCase("setcheckpoint")) {
|
||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||
pm.setCheckpoint(player, player.getLocation());
|
||||
return true;
|
||||
}
|
||||
if (cmdName.equalsIgnoreCase("setfinish")) {
|
||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||
pm.setFinishLocation(player.getLocation());
|
||||
player.sendMessage("§8[§6Nexus§8] §aParkour-Zielpunkt gesetzt!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- SPAWN BEFEHL ---
|
||||
if (command.getName().equalsIgnoreCase("spawn")) {
|
||||
if (cmdName.equalsIgnoreCase("spawn")) {
|
||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||
if (config.contains("spawn.world")) {
|
||||
Location loc = getSpawnFromConfig(config);
|
||||
@@ -41,7 +67,7 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- HAUPTBEFEHL ARGUMENTE ---
|
||||
// --- HAUPTBEFEHL /NEXUSLOBBY oder /NEXUS ---
|
||||
if (args.length == 0) {
|
||||
sendInfo(player);
|
||||
return true;
|
||||
@@ -49,23 +75,14 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "reload":
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Aufruf der Reload-Methode in der Hauptklasse
|
||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||
NexusLobby.getInstance().reloadPlugin();
|
||||
|
||||
player.sendMessage("§8[§6Nexus§8] §aPlugin erfolgreich neu geladen!");
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1f, 1.5f);
|
||||
break;
|
||||
|
||||
case "setspawn":
|
||||
if (!player.hasPermission("nexuslobby.admin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
if (!player.hasPermission("nexuslobby.admin")) return noPerm(player);
|
||||
Location loc = player.getLocation();
|
||||
FileConfiguration config = NexusLobby.getInstance().getConfig();
|
||||
config.set("spawn.world", loc.getWorld().getName());
|
||||
@@ -79,10 +96,7 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
break;
|
||||
|
||||
case "silentjoin":
|
||||
if (!player.hasPermission("nexuslobby.silentjoin")) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
if (!player.hasPermission("nexuslobby.silentjoin")) return noPerm(player);
|
||||
if (NexusLobby.getInstance().getSilentPlayers().contains(player.getUniqueId())) {
|
||||
NexusLobby.getInstance().getSilentPlayers().remove(player.getUniqueId());
|
||||
player.sendMessage("§8[§6Nexus§8] §7Silent Join: §cDeaktiviert");
|
||||
@@ -96,6 +110,45 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
handleScoreboard(player, args);
|
||||
break;
|
||||
|
||||
case "parkour":
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§8[§6Nexus§8] §7Nutze: §e/nexus parkour <setstart|setfinish|setcheckpoint|reset|clear|removeall>");
|
||||
return true;
|
||||
}
|
||||
|
||||
String sub = args[1].toLowerCase();
|
||||
if (!player.hasPermission("nexuslobby.admin") && !sub.equals("reset")) return noPerm(player);
|
||||
|
||||
switch (sub) {
|
||||
case "setstart":
|
||||
handleSetStart(player, pm);
|
||||
break;
|
||||
case "setfinish":
|
||||
pm.setFinishLocation(player.getLocation());
|
||||
player.sendMessage("§8[§6Nexus§8] §aParkour-Zielpunkt gesetzt!");
|
||||
break;
|
||||
case "setcheckpoint":
|
||||
pm.setCheckpoint(player, player.getLocation());
|
||||
break;
|
||||
case "reset":
|
||||
pm.stopParkour(player);
|
||||
player.sendMessage("§8[§6Nexus§8] §7Dein aktueller Lauf wurde abgebrochen.");
|
||||
break;
|
||||
case "clear":
|
||||
pm.clearStats();
|
||||
player.sendMessage("§8[§6Nexus§8] §aAlle Parkour-Bestzeiten wurden gelöscht!");
|
||||
break;
|
||||
case "removeall":
|
||||
pm.removeAllPoints();
|
||||
player.sendMessage("§8[§6Nexus§8] §cDie gesamte Strecke (Checkpoints & Ziel) wurde gelöscht!");
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1f, 1f);
|
||||
break;
|
||||
default:
|
||||
player.sendMessage("§cUnbekannter Unterbefehl.");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
sendInfo(player);
|
||||
break;
|
||||
@@ -104,6 +157,34 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleSetStart(Player player, ParkourManager pm) {
|
||||
// NPC Erkennung (Blickrichtung auf ArmorStand)
|
||||
ArmorStand targetAs = null;
|
||||
List<Entity> nearby = player.getNearbyEntities(4, 4, 4);
|
||||
for (Entity e : nearby) {
|
||||
if (e instanceof ArmorStand as) {
|
||||
double dot = player.getLocation().getDirection().dot(as.getLocation().toVector().subtract(player.getLocation().toVector()).normalize());
|
||||
if (dot > 0.9) {
|
||||
targetAs = as;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetAs != null) {
|
||||
targetAs.addScoreboardTag("parkour_npc");
|
||||
player.sendMessage("§8[§6Nexus§8] §aArmorStand als Parkour-NPC markiert!");
|
||||
}
|
||||
|
||||
pm.setStartLocation(player.getLocation());
|
||||
player.sendMessage("§8[§6Nexus§8] §aParkour-Startpunkt an deiner Position gesetzt!");
|
||||
}
|
||||
|
||||
private boolean noPerm(Player player) {
|
||||
player.sendMessage("§cKeine Berechtigung.");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleScoreboard(Player player, String[] args) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§cBenutzung: /nexus sb <on|off|admin|spieler>");
|
||||
@@ -141,11 +222,12 @@ public class NexusLobbyCommand implements CommandExecutor {
|
||||
player.sendMessage("§8§m--------------------------------------");
|
||||
player.sendMessage("§6§lNexusLobby §7- Informationen");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("§f/spawn §7- Zum Spawn teleportieren");
|
||||
player.sendMessage("§f/spawn §7- Zum Spawn");
|
||||
player.sendMessage("§f/setstart §8| §f/setcheckpoint §8| §f/setfinish");
|
||||
player.sendMessage("§f/nexus parkour removeall §7- Strecke löschen");
|
||||
player.sendMessage("§f/nexus setspawn §7- Spawn setzen");
|
||||
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("§f/nexus reload §7- Config laden");
|
||||
player.sendMessage("§8§m--------------------------------------");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user