summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/commands/WaypointBack.java
blob: 3fa0de3b8b6727cd1963a8d66dd71e97ed2cc26e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package net.benjidial.nswp.commands;

import net.benjidial.nswp.Database;

import org.bukkit.entity.Player;
import org.bukkit.Location;

import java.sql.SQLException;

public class WaypointBack extends WaypointCommand {
  public CompletionType getCompletionType() {
    return CompletionType.None;
  }

  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);
    }
    return true;
  }
}