Package com.griefdefender.api
Interface User
- All Superinterfaces:
Subject
- All Known Subinterfaces:
ClanPlayer
Represents an online or offline player.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanChecks if this user can break a block at specified location.default booleancanHurtEntity(Object itemStack, Object entity) Checks if this player can attack entity.default booleancanIgnoreClaim(Claim claim) Checks if this user can ignore a claim.default booleancanInteractWithEntity(Object itemStack, Object entity, TrustType trustType) Checks if this player can interact with entity.default booleanChecks if this user can manage admin claims.default booleanChecks if this user can manage wilderness claims.default booleanChecks if this user can place a block at specified location.default booleanChecks if this user can pvp inClaim.default booleancanUseBlock(Object location, TrustType trustType, boolean leftClick, boolean shift) Checks if this user can use a block at specified location.default booleancanUseItem(Object itemStack, Object location, TrustType trustType, boolean leftClick, boolean shift) Checks if this user can use item at a specified location.@Nullable ClaimGets the currentClaimplayer is in.@Nullable ObjectGets the online player object.Gets thePlayerDataof user.Gets theUUIDof user.default booleanChecks if this user is in pvp combat.booleanisOnline()Whether this user is online.Methods inherited from interface com.griefdefender.api.Subject
getFriendlyName, getIdentifier
-
Method Details
-
getUniqueId
UUID getUniqueId()Gets theUUIDof user. -
getPlayerData
PlayerData getPlayerData()Gets thePlayerDataof user.- Returns:
- The player data
-
isOnline
boolean isOnline()Whether this user is online.- Returns:
- true if online, false otherwise
-
getOnlinePlayer
@Nullable Object getOnlinePlayer()Gets the online player object.- Returns:
- The online player object, if available
-
getCurrentClaim
@Nullable Claim getCurrentClaim()Gets the currentClaimplayer is in. Note: This will return no claim if player is not online.- Returns:
- The current claim
-
canBreak
Checks if this user can break a block at specified location.- Parameters:
location- The target block location- Returns:
- true if user can break, false if not
-
canPlace
Checks if this user can place a block at specified location.- Parameters:
placedItem- The item being placedlocation- The target block location- Returns:
- true if user can place, false if not
-
canHurtEntity
Checks if this player can attack entity.- Parameters:
itemStack- The item being used to attack entityentity- The target entity- Returns:
- true if entity can be attacked, false if not
-
canInteractWithEntity
Checks if this player can interact with entity.- Parameters:
itemStack- The item being used to interact with entityentity- The target entitytrustType- The minimumTrustTyperequired- Returns:
- true if entity can be interacted with, false if not
-
canUseBlock
Checks if this user can use a block at specified location.- Parameters:
location- The target block locationtrustType- The minimumTrustTyperequiredleftClick- If block will be activated on left-clickshift- If block activation requires shift- Returns:
- true if user can use block, false if not
-
canUseItem
default boolean canUseItem(Object itemStack, Object location, TrustType trustType, boolean leftClick, boolean shift) Checks if this user can use item at a specified location.
Note: If item is custom, pass a string identifier in format 'modid:name'
Note: If item is activated on right-click then 'leftClick' should be false.- Parameters:
itemStack- The target itemStacklocation- The location where item will be usedtrustType- The minimumTrustTyperequired.leftClick- If item will be activated on left-click.shift- If item activation requires shift.- Returns:
- true if player can use item, false if not
-
canIgnoreClaim
Checks if this user can ignore a claim.- Parameters:
claim- The claim to check- Returns:
- Whether this user can ignore the claim
-
canManageAdminClaims
default boolean canManageAdminClaims()Checks if this user can manage admin claims.- Returns:
- true if can manage, false if not
-
canManageWildernessClaims
default boolean canManageWildernessClaims()Checks if this user can manage wilderness claims.- Returns:
- true if can manage, false if not
-
canPvp
Checks if this user can pvp inClaim.- Parameters:
claim- The claim to check- Returns:
- Whether user has ability to pvp inside claim
-
inPvpCombat
default boolean inPvpCombat()Checks if this user is in pvp combat.- Returns:
- true if in pvp combat, false if not
-