27 lines
727 B
Java
27 lines
727 B
Java
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;
|
|
}
|
|
}
|