Search in sources :

Example 1 with ResidencePlayer

use of com.bekvon.bukkit.residence.containers.ResidencePlayer in project MagicPlugin by elBukkit.

the class ResidenceManager method getWarps.

@Nullable
@Override
public Collection<PlayerWarp> getWarps(@Nonnull Player player) {
    ResidencePlayer residencePlayer = getResidencePlayer(player);
    if (residencePlayer == null) {
        return null;
    }
    Collection<ClaimedResidence> residences = residencePlayer.getResList();
    if (residences == null || residences.isEmpty()) {
        return null;
    }
    Collection<PlayerWarp> warps = new ArrayList<>();
    for (ClaimedResidence residence : residences) {
        Location location = residence.getTeleportLocation(player);
        if (location == null) {
            location = residence.getMainArea().getHighLoc().clone().add(residence.getMainArea().getLowLoc()).multiply(0.5);
            location = location.getWorld().getHighestBlockAt(location).getLocation();
        }
        PlayerWarp warp = new PlayerWarp(residence.getName(), location);
        warps.add(warp);
    }
    return warps;
}
Also used : ResidencePlayer(com.bekvon.bukkit.residence.containers.ResidencePlayer) ClaimedResidence(com.bekvon.bukkit.residence.protection.ClaimedResidence) PlayerWarp(com.elmakers.mine.bukkit.api.protection.PlayerWarp) ArrayList(java.util.ArrayList) Location(org.bukkit.Location) Nullable(javax.annotation.Nullable)

Aggregations

ResidencePlayer (com.bekvon.bukkit.residence.containers.ResidencePlayer)1 ClaimedResidence (com.bekvon.bukkit.residence.protection.ClaimedResidence)1 PlayerWarp (com.elmakers.mine.bukkit.api.protection.PlayerWarp)1 ArrayList (java.util.ArrayList)1 Nullable (javax.annotation.Nullable)1 Location (org.bukkit.Location)1