Search in sources :

Example 6 with ClaimedResidence

use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project Bookshelf by LOOHP.

the class ResidenceEvents method onResidenceCheck.

@EventHandler(priority = EventPriority.LOWEST)
public void onResidenceCheck(PlayerOpenBookshelfEvent event) {
    if (!Bookshelf.residenceHook) {
        return;
    }
    Player player = event.getPlayer();
    ClaimedResidence area = ResidenceApi.getResidenceManager().getByLoc(event.getLocation());
    if (area == null) {
        return;
    }
    if (!area.getPermissions().playerHas(player, Flags.container, true)) {
        event.setCancelled(true);
        String message = Residence.getInstance().getLM().getMessage("Language.Flag.Deny").replace("%1", Flags.container.name());
        player.sendMessage(message);
    }
}
Also used : Player(org.bukkit.entity.Player) ClaimedResidence(com.bekvon.bukkit.residence.protection.ClaimedResidence) EventHandler(org.bukkit.event.EventHandler)

Example 7 with ClaimedResidence

use of com.bekvon.bukkit.residence.protection.ClaimedResidence in project Depenizen by DenizenScript.

the class ResidenceTag method valueOf.

@Fetchable("residence")
public static ResidenceTag valueOf(String string, TagContext context) {
    if (string == null) {
        return null;
    }
    // //////
    // Match residence name
    string = string.replace("residence@", "");
    ClaimedResidence residence = Residence.getInstance().getResidenceManagerAPI().getByName(string);
    if (residence == null) {
        return null;
    }
    return new ResidenceTag(residence);
}
Also used : ClaimedResidence(com.bekvon.bukkit.residence.protection.ClaimedResidence) Fetchable(com.denizenscript.denizencore.objects.Fetchable)

Aggregations

ClaimedResidence (com.bekvon.bukkit.residence.protection.ClaimedResidence)7 ResidencePermissions (com.bekvon.bukkit.residence.protection.ResidencePermissions)2 ArrayList (java.util.ArrayList)2 Location (org.bukkit.Location)2 Player (org.bukkit.entity.Player)2 ResidenceInterface (com.bekvon.bukkit.residence.api.ResidenceInterface)1 ResidencePlayer (com.bekvon.bukkit.residence.containers.ResidencePlayer)1 CuboidArea (com.bekvon.bukkit.residence.protection.CuboidArea)1 Fetchable (com.denizenscript.denizencore.objects.Fetchable)1 PlayerWarp (com.elmakers.mine.bukkit.api.protection.PlayerWarp)1 FaweMask (com.fastasyncworldedit.core.regions.FaweMask)1 CuboidRegion (com.sk89q.worldedit.regions.CuboidRegion)1 Nullable (javax.annotation.Nullable)1 EventHandler (org.bukkit.event.EventHandler)1