summaryrefslogtreecommitdiff
path: root/src/main/java/net/benjidial/nswp/commands/WaypointBack.java
blob: 2082ae7f7f4189a10aa1ec9475f2784cd3d9b273 (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
28
29
30
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 PlayerCommand {

  public boolean doCommand(Player sender, String[] args) throws SQLException {

    if (args.length != 0)
      return false;

    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;

  }

}