diff options
Diffstat (limited to 'src/main/java/net/benjidial/nswp/commands/TeleportToWaypoint.java')
-rw-r--r-- | src/main/java/net/benjidial/nswp/commands/TeleportToWaypoint.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/net/benjidial/nswp/commands/TeleportToWaypoint.java b/src/main/java/net/benjidial/nswp/commands/TeleportToWaypoint.java new file mode 100644 index 0000000..4e84e3c --- /dev/null +++ b/src/main/java/net/benjidial/nswp/commands/TeleportToWaypoint.java @@ -0,0 +1,27 @@ +package net.benjidial.nswp.commands; + +import net.benjidial.nswp.Database; +import net.benjidial.nswp.Waypoint; + +import org.bukkit.entity.Player; + +import java.sql.SQLException; + +public class TeleportToWaypoint extends WaypointCommand { + public CompletionType getCompletionType() { + return CompletionType.Waypoint; + } + + public boolean body(Player player, String[] args) throws SQLException { + if (args.length != 1) + return false; + Waypoint waypoint = Database.lookupWaypoint(player, args[0]); + if (waypoint == null) + player.sendMessage("No waypoint with that name."); + else { + Database.setWBack(player, player.getLocation()); + player.teleport(waypoint.location); + } + return true; + } +} |