package de.teleportsuite.commands;
import de.teleportsuite.TeleportSuite;
import de.teleportsuite.models.Home;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import java.util.List;
public class HomesCommand implements CommandExecutor {
    private final TeleportSuite plugin;
    public HomesCommand(TeleportSuite p) { this.plugin = p; }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (!(sender instanceof Player)) { sender.sendMessage("§cNur für Spieler!"); return true; }
        Player p = (Player) sender;
        List<Home> homes = plugin.getHomeManager().getHomes(p.getUniqueId());
        if (homes.isEmpty()) { p.sendMessage("§eKeine Homes gesetzt."); return true; }
        p.sendMessage("§6Deine Homes §8(" + homes.size() + "/" + plugin.getHomeManager().getMaxHomes(p) + ")§6:");
        homes.forEach(h -> p.sendMessage("§7- §a" + h.getName() + " §7(" + h.getLocation().getWorld() + ")"));
        return true;
    }
}
