use of com.griefdefender.api.provider.ClanProvider in project Bookshelf by LOOHP.
the class GriefDefenderEvents method onLandCheck.
@EventHandler(priority = EventPriority.LOWEST)
public void onLandCheck(PlayerOpenBookshelfEvent event) {
if (!Bookshelf.griefDefenderHook) {
return;
}
Player player = event.getPlayer();
Claim claim = GriefDefender.getCore().getClaimAt(event.getLocation());
ClanProvider clanProvider = GriefDefender.getCore().getClanProvider();
ClanPlayer clanPlayer = null;
if (clanProvider != null) {
clanPlayer = clanProvider.getClanPlayer(player.getUniqueId());
}
if (claim == null || claim.isWilderness()) {
return;
}
if (!claim.getOwnerUniqueId().equals(player.getUniqueId()) && !claim.isUserTrusted(player.getUniqueId(), TrustTypes.CONTAINER) && (clanPlayer == null || !claim.isClanTrusted(clanPlayer.getClan(), TrustTypes.CONTAINER))) {
event.setCancelled(true);
}
}
Aggregations