use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project Skript by SkriptLang.
the class ResidenceHook method getRegionsAt_i.
@SuppressWarnings("null")
@Override
public Collection<? extends Region> getRegionsAt_i(final Location l) {
final List<ResidenceRegion> ress = new ArrayList<>();
final ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(l);
if (res == null)
return Collections.emptyList();
ress.add(new ResidenceRegion(l.getWorld(), res));
return ress;
}
use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project CombatLogX by SirBlobman.
the class ResidenceRegionHandler method isSafeZone.
@Override
public boolean isSafeZone(Player player, Location location, TagType tagType) {
if (tagType != TagType.PLAYER)
return false;
ResidenceInterface residenceManager = ResidenceApi.getResidenceManager();
ClaimedResidence claimedResidence = residenceManager.getByLoc(location);
if (claimedResidence == null)
return false;
ResidencePermissions residencePermissions = claimedResidence.getPermissions();
return !residencePermissions.has(Flags.pvp, true);
}
use of com.bekvon.bukkit.residence.protection.ClaimedResidence 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;
}
use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project FastAsyncWorldEdit by IntellectualSites.
the class ResidenceFeature method getMask.
@Override
public FaweMask getMask(final com.sk89q.worldedit.entity.Player wePlayer, final MaskType type, boolean isWhitelist) {
final Player player = BukkitAdapter.adapt(wePlayer);
final Location location = player.getLocation();
ClaimedResidence residence = Residence.getInstance().getResidenceManager().getByLoc(location);
if (residence != null) {
boolean isAllowed;
while (!(isAllowed = isAllowed(player, residence, type)) && residence != null) {
residence = residence.getSubzoneByLoc(location);
}
if (isAllowed) {
final CuboidArea area = residence.getAreaArray()[0];
final Location pos1 = area.getLowLoc();
final Location pos2 = area.getHighLoc();
final ClaimedResidence finalResidence = residence;
return new FaweMask(new CuboidRegion(BukkitAdapter.asBlockVector(pos1), BukkitAdapter.asBlockVector(pos2))) {
@Override
public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) {
return isAllowed(BukkitAdapter.adapt(player), finalResidence, type);
}
};
}
}
return null;
}
use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project Skript by SkriptLang.
the class ResidenceHook method canBuild_i.
@Override
public boolean canBuild_i(final Player p, final Location l) {
final ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(l);
if (res == null)
// No claim here
return true;
ResidencePermissions perms = res.getPermissions();
return perms.playerHas(p, Flags.build, true);
}
Aggregations