diff options
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; + } + } |