Search in sources :

Example 1 with User

use of com.griefdefender.api.User in project GDHooks by bloodmc.

the class GDHooks method generateClaimIdTabList.

private Set<String> generateClaimIdTabList(Player player) {
    final Set<String> tabList = new HashSet<>();
    final User user = GriefDefender.getCore().getUser(player.getUniqueId());
    if (user.getPlayerData().canManageAdminClaims()) {
        final Map<String, UUID> adminMap = GriefDefender.getCore().getFriendlyIdentifierMapView().get(GriefDefender.getCore().getAdminUser().getUniqueId());
        if (adminMap != null) {
            for (String key : adminMap.keySet()) {
                tabList.add("admin:" + key);
            }
        }
    }
    if (user.getPlayerData().canManageWildernessClaims()) {
        final Map<String, UUID> worldMap = GriefDefender.getCore().getFriendlyIdentifierMapView().get(GriefDefender.getCore().getWildernessUser().getUniqueId());
        if (worldMap != null) {
            for (String key : worldMap.keySet()) {
                tabList.add("wilderness:" + key);
            }
        }
    }
    final Map<String, UUID> playerMap = GriefDefender.getCore().getFriendlyIdentifierMapView().get(player.getUniqueId());
    if (playerMap != null) {
        for (String key : playerMap.keySet()) {
            tabList.add(key);
        }
    }
    return tabList;
}
Also used : User(com.griefdefender.api.User) UUID(java.util.UUID) HashSet(java.util.HashSet)

Example 2 with User

use of com.griefdefender.api.User in project CombatLogX by SirBlobman.

the class GriefDefenderRegionHandler method isSafeZone.

@Override
public boolean isSafeZone(Player player, Location location, TagType tagType) {
    if (tagType != TagType.PLAYER) {
        return false;
    }
    Claim claim = getClaimAt(location);
    if (claim == null) {
        return false;
    }
    UUID playerId = player.getUniqueId();
    Core core = GriefDefender.getCore();
    User user = core.getUser(playerId);
    Set<Context> contexts = new HashSet<>();
    TypeToken<Tristate> typeTokenTristate = TypeToken.get(Tristate.class);
    Tristate activeOptionValue = claim.getActiveOptionValue(typeTokenTristate, Options.PVP, user, contexts);
    return (activeOptionValue != Tristate.TRUE);
}
Also used : Context(com.griefdefender.api.permission.Context) User(com.griefdefender.api.User) Tristate(com.griefdefender.api.Tristate) UUID(java.util.UUID) Claim(com.griefdefender.api.claim.Claim) Core(com.griefdefender.api.Core) HashSet(java.util.HashSet)

Aggregations

User (com.griefdefender.api.User)2 HashSet (java.util.HashSet)2 UUID (java.util.UUID)2 Core (com.griefdefender.api.Core)1 Tristate (com.griefdefender.api.Tristate)1 Claim (com.griefdefender.api.claim.Claim)1 Context (com.griefdefender.api.permission.Context)1