summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/commands/WaypointBack.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/benjidial/nswp/commands/WaypointBack.java')
-rw-r--r--src/main/java/net/benjidial/nswp/commands/WaypointBack.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/net/benjidial/nswp/commands/WaypointBack.java b/src/main/java/net/benjidial/nswp/commands/WaypointBack.java
new file mode 100644
index 0000000..3fa0de3
--- /dev/null
+++ b/src/main/java/net/benjidial/nswp/commands/WaypointBack.java
@@ -0,0 +1,27 @@
+package net.benjidial.nswp.commands;
+
+import net.benjidial.nswp.Database;
+
+import org.bukkit.entity.Player;
+import org.bukkit.Location;
+
+import java.sql.SQLException;
+
+public class WaypointBack extends WaypointCommand {
+ public CompletionType getCompletionType() {
+ return CompletionType.None;
+ }
+
+ public boolean body(Player player, String[] args) throws SQLException {
+ if (args.length != 0)
+ return false;
+ Location wback = Database.getWBack(player);
+ if (wback == null)
+ player.sendMessage("You have not teleported to any waypoints.");
+ else {
+ Database.setWBack(player, player.getLocation());
+ player.teleport(wback);
+ }
+ return true;
+ }
+}