blob: 336a07b7650add68b0b3027fdd29883bbcc7ab7c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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<String> 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<Waypoint> 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;
}
}
|