package de.teleportsuite.commands;
import de.teleportsuite.TeleportSuite;
import de.teleportsuite.models.Warp;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import java.util.List;
public class WarpsCommand implements CommandExecutor {
    private final TeleportSuite plugin;
    public WarpsCommand(TeleportSuite p) { this.plugin = p; }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!sender.hasPermission("teleportsuite.warp")) { sender.sendMessage(plugin.getConfigManager().getMessage("no-permission")); return true; }
        List<Warp> warps = plugin.getWarpManager().getAllWarps();
        if (warps.isEmpty()) { sender.sendMessage("§eKeine Warps vorhanden."); return true; }
        sender.sendMessage("§6Verfügbare Warps §8(" + warps.size() + ")§6:");
        warps.stream()
             .filter(w -> w.getPermission() == null || sender.hasPermission(w.getPermission()))
             .forEach(w -> sender.sendMessage("§7- §a" + w.getName() + " §7(" + w.getLocation().getWorld() + ")"));
        return true;
    }
}
