package de.teleportsuite.commands;
import de.teleportsuite.TeleportSuite;
import org.bukkit.command.*;
public class PortalsCommand implements CommandExecutor {
    private final TeleportSuite plugin;
    public PortalsCommand(TeleportSuite p) { this.plugin = p; }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!sender.hasPermission("teleportsuite.portals")) { sender.sendMessage(plugin.getConfigManager().getMessage("no-permission")); return true; }
        var portals = plugin.getPortalManager().getPortals();
        if (portals.isEmpty()) { sender.sendMessage("§eKeine Portale vorhanden."); return true; }
        sender.sendMessage("§6Portale §8(" + portals.size() + ")§6:");
        portals.forEach(p2 -> sender.sendMessage("§7- §a" + p2.getName() + " §7→ §e" + (p2.getTargetServer() != null ? p2.getTargetServer() + "/" : "") + p2.getDestination().getWorld()));
        return true;
    }
}
