summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2023-12-30 14:24:46 -0500
committerBenji Dial <benji@benjidial.net>2023-12-30 14:24:46 -0500
commite06ee55259b3549a59358a13c095a274bacf6a05 (patch)
treea6e8b1b33434ee2c7de7028d4abad77b7fbe8296 /src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java
parentef65431d405a713b138a55054e78497883f27e54 (diff)
downloadnew-simple-waypoints-e06ee55259b3549a59358a13c095a274bacf6a05.tar.gz
testing new version
Diffstat (limited to 'src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java')
-rw-r--r--src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java b/src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java
index d24d133..785d31f 100644
--- a/src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java
+++ b/src/main/java/net/benjidial/nswp/commands/DeleteWaypoint.java
@@ -1,20 +1,36 @@
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.List;
-public class DeleteWaypoint extends WaypointCommand {
- public CompletionType getCompletionType() {
- return CompletionType.Waypoint;
+public class DeleteWaypoint extends PlayerCommand {
+
+ public List<String> getTabCompletions(Player sender, String[] args) throws SQLException {
+ return searchWaypointsByArg(sender, args, 0);
}
- public boolean body(Player player, String[] args) throws SQLException {
+ public boolean doCommand(Player sender, String[] args) throws SQLException {
+
if (args.length != 1)
return false;
- Database.deleteWaypoint(player, args[0]);
+
+ Database.createWaypointTable(sender);
+
+ Waypoint wp = Database.lookupWaypoint(sender, args[0]);
+ if (wp != null) {
+ Database.deleteWaypoint(sender, args[0]);
+ sender.sendMessage("Deleted " + wp.toString() + ".");
+ }
+ else
+ sender.sendMessage("You do not have a waypoint " + args[0] + ".");
+
return true;
+
}
+
}