From e06ee55259b3549a59358a13c095a274bacf6a05 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 30 Dec 2023 14:24:46 -0500 Subject: testing new version --- .../net/benjidial/nswp/commands/WaypointBack.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/main/java/net/benjidial/nswp/commands/WaypointBack.java') 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; + } + } -- cgit v1.2.3