2022-11-11 21:16:26 +01:00
|
|
|
package wtf.beatrice.limbomanager;
|
|
|
|
|
2022-11-11 23:13:04 +01:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.entity.Player;
|
2022-11-11 21:16:26 +01:00
|
|
|
import wtf.beatrice.limbomanager.objects.Coordinates;
|
2022-11-11 23:13:04 +01:00
|
|
|
import wtf.beatrice.limbomanager.objects.LocationCheckRunnable;
|
2022-11-11 21:16:26 +01:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
public class Cache
|
|
|
|
{
|
|
|
|
|
|
|
|
public static final HashMap<String, Coordinates> playerIslands = new HashMap<>();
|
|
|
|
|
2022-11-11 23:13:04 +01:00
|
|
|
public static LocationCheckRunnable locationCheckRunnable;
|
|
|
|
|
|
|
|
public static void teleportToOwnIsland(Player player)
|
|
|
|
{
|
|
|
|
Coordinates islandCoords = playerIslands.get(player.getName());
|
|
|
|
Location targetLocation = new Location(player.getWorld(), islandCoords.getX(), 100, islandCoords.getZ());
|
|
|
|
|
|
|
|
Bukkit.getScheduler().runTask(LimboManager.getInstance(), () -> {
|
|
|
|
targetLocation.getWorld().loadChunk(targetLocation.getChunk().getX(), targetLocation.getChunk().getZ(), true);
|
|
|
|
player.teleport(targetLocation);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2022-11-11 21:16:26 +01:00
|
|
|
|
|
|
|
}
|