diff options
author | Benji Dial <benji@benjidial.net> | 2023-12-30 14:24:46 -0500 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2023-12-30 14:24:46 -0500 |
commit | e06ee55259b3549a59358a13c095a274bacf6a05 (patch) | |
tree | a6e8b1b33434ee2c7de7028d4abad77b7fbe8296 /src/main/java/net/benjidial/nswp/commands/WaypointBack.java | |
parent | ef65431d405a713b138a55054e78497883f27e54 (diff) | |
download | new-simple-waypoints-e06ee55259b3549a59358a13c095a274bacf6a05.tar.gz |
testing new version
Diffstat (limited to 'src/main/java/net/benjidial/nswp/commands/WaypointBack.java')
-rw-r--r-- | src/main/java/net/benjidial/nswp/commands/WaypointBack.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/main/java/net/benjidial/nswp/commands/WaypointBack.java b/src/main/java/net/benjidial/nswp/commands/WaypointBack.java index 3fa0de3..2082ae7 100644 --- a/src/main/java/net/benjidial/nswp/commands/WaypointBack.java +++ b/src/main/java/net/benjidial/nswp/commands/WaypointBack.java @@ -7,21 +7,24 @@ import org.bukkit.Location; import java.sql.SQLException; -public class WaypointBack extends WaypointCommand { - public CompletionType getCompletionType() { - return CompletionType.None; - } +public class WaypointBack extends PlayerCommand { + + public boolean doCommand(Player sender, String[] args) throws SQLException { - 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); + + Location wback = Database.getWBack(sender); + + if (wback == null) { + sender.sendMessage("You have never teleported anywhere with NewSimpleWaypoints."); + return true; } + + Database.setWBack(sender, sender.getLocation()); + sender.teleport(wback); return true; + } + } |