ProtectionManager

Handles protection checks using registered ProtectionIntegrations.

Protection checks are cached for 60s after the last access. If all protection integrations can be called asynchronously, commonly used protection checks will be refreshed every 30s.

Functions

Link copied to clipboard

Checks whether the given ctx passes break permission checks.

suspend fun canBreak(player: OfflinePlayer, item: ItemStack?, pos: BlockPos): Boolean
fun canBreak(player: Player, item: ItemStack?, pos: BlockPos): Boolean

Checks if that player can break a block at that pos using that item.

suspend fun canBreak(tileEntity: TileEntity, item: ItemStack?, pos: BlockPos): Boolean

Checks if that tileEntity can break a block at that pos using that item.

Link copied to clipboard
suspend fun canHurtEntity(player: OfflinePlayer, entity: Entity, item: ItemStack?): Boolean
fun canHurtEntity(player: Player, entity: Entity, item: ItemStack?): Boolean

Checks if the player can hurt the entity with this item.

suspend fun canHurtEntity(tileEntity: TileEntity, entity: Entity, item: ItemStack?): Boolean

Checks if the tileEntity can hurt the entity with this item.

Link copied to clipboard
fun canHurtEntityAsync(player: OfflinePlayer, entity: Entity, item: ItemStack?): CompletableFuture<Boolean>

Checks if the player can hurt the entity with this item.

fun canHurtEntityAsync(tileEntity: TileEntity, entity: Entity, item: ItemStack?): CompletableFuture<Boolean>

Checks if the tileEntity can hurt the entity with this item.

Link copied to clipboard
suspend fun canInteractWithEntity(player: OfflinePlayer, entity: Entity, item: ItemStack?): Boolean
fun canInteractWithEntity(player: Player, entity: Entity, item: ItemStack?): Boolean

Checks if the player can interact with the entity while holding that item.

suspend fun canInteractWithEntity(tileEntity: TileEntity, entity: Entity, item: ItemStack?): Boolean

Checks if the tileEntity can interact with the entity wile holding that item.

Link copied to clipboard
fun canInteractWithEntityAsync(player: OfflinePlayer, entity: Entity, item: ItemStack?): CompletableFuture<Boolean>

Checks if the player can interact with the entity while holding that item.

fun canInteractWithEntityAsync(tileEntity: TileEntity, entity: Entity, item: ItemStack?): CompletableFuture<Boolean>

Checks if the tileEntity can interact with the entity while holding that item.

Link copied to clipboard

Checks whether the given ctx passes place permission checks.

suspend fun canPlace(player: OfflinePlayer, item: ItemStack, pos: BlockPos): Boolean
fun canPlace(player: Player, item: ItemStack, pos: BlockPos): Boolean

Checks if the player can place that item at that pos.

suspend fun canPlace(tileEntity: TileEntity, item: ItemStack, pos: BlockPos): Boolean

Checks if the tileEntity can place that item at that pos.

Link copied to clipboard

Checks whether the given ctx passes block interaction permission checks.

suspend fun canUseBlock(player: OfflinePlayer, item: ItemStack?, pos: BlockPos): Boolean
fun canUseBlock(player: Player, item: ItemStack?, pos: BlockPos): Boolean

Checks if the player can interact with a block at that pos using that item.

suspend fun canUseBlock(tileEntity: TileEntity, item: ItemStack?, pos: BlockPos): Boolean

Checks if the tileEntity can interact with a block at that pos using that item.

Link copied to clipboard
fun canUseBlockAsync(player: OfflinePlayer, item: ItemStack?, pos: BlockPos): CompletableFuture<Boolean>

Checks if the player can interact with a block at that pos using that item.

fun canUseBlockAsync(tileEntity: TileEntity, item: ItemStack?, pos: BlockPos): CompletableFuture<Boolean>

Checks if the tileEntity can interact with a block at that pos using that item.

Link copied to clipboard
suspend fun canUseItem(player: OfflinePlayer, item: ItemStack, location: Location): Boolean
fun canUseItem(player: Player, item: ItemStack, location: Location): Boolean

Checks if the player can use that item at that location.

suspend fun canUseItem(tileEntity: TileEntity, item: ItemStack, location: Location): Boolean

Checks if the tileEntity can use that item at that location.

Link copied to clipboard
fun canUseItemAsync(player: OfflinePlayer, item: ItemStack, location: Location): CompletableFuture<Boolean>

Checks if the player can use that item at that location.

fun canUseItemAsync(tileEntity: TileEntity, item: ItemStack, location: Location): CompletableFuture<Boolean>

Checks if the tileEntity can use that item at that location.