package net.benjidial.nswp.commands; import net.benjidial.nswp.Database; import net.benjidial.nswp.Waypoint; import org.bukkit.entity.Player; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class ListWaypoints extends PlayerCommand { public List getTabCompletions(Player sender, String[] args) throws SQLException { return searchWaypointsByArg(sender, args, 0); } public boolean doCommand(Player sender, String[] args) throws SQLException { if (args.length > 1) return false; Database.createWaypointTable(sender); ArrayList wps = Database.searchWaypoints(sender, args.length == 0 ? "" : args[0]); if (wps.size() == 0) { sender.sendMessage("0 waypoints found."); return true; } if (wps.size() == 1) sender.sendMessage("1 waypoint found:"); else sender.sendMessage(wps.size() + " waypoints found:"); for (Waypoint wp : wps) sender.sendMessage(" " + wp.toString()); return true; } }