WorldSystem/src/main/java/de/butzlabben/world/util/TeleportUtil.java

30 lines
698 B
Java
Raw Normal View History

2019-02-10 22:03:53 +01:00
package de.butzlabben.world.util;
import org.bukkit.Location;
import org.bukkit.entity.Player;
2019-05-04 09:23:09 +02:00
import java.util.HashMap;
import java.util.UUID;
2019-02-10 22:03:53 +01:00
/**
* @author Butzlabben
* @since 13.09.2018
*/
public class TeleportUtil {
2019-08-10 15:31:30 +02:00
private static final HashMap<UUID, Location> oldLocs = new HashMap<>();
private TeleportUtil() {
}
public static void teleportPlayer(Player p, Location loc) {
// Save old player location.
// If he does another teleport he will be taken back then to the first location
if (!oldLocs.containsKey(p.getUniqueId())) {
Location oldLoc = p.getLocation();
oldLocs.put(p.getUniqueId(), oldLoc);
}
}
2019-02-10 22:03:53 +01:00
}