Interface ProtectionManager
public interface ProtectionManager
Manages creation and lookup of block and entity protections.
Obtain via
ChestProtectAPI.getProtectionManager().-
Method Summary
Modifier and TypeMethodDescription@NotNull BlockProtectioncreateBlockProtection(@NotNull ProtectionHook protectionHook, @NotNull org.bukkit.block.Block block, @NotNull ProtectPlayer protectPlayer) Create block protection.@NotNull EntityProtectioncreateEntityProtection(@NotNull ProtectionHook protectionHook, @NotNull org.bukkit.entity.Entity entity, @NotNull ProtectPlayer player) Create entity protection.booleanisProtectableBlock(@NotNull org.bukkit.Material material) Check if block is protectable.booleanisProtectableEntity(@NotNull org.bukkit.entity.EntityType entityType) Check if block is protectable.
-
Method Details
-
isProtectableBlock
boolean isProtectableBlock(@NotNull @NotNull org.bukkit.Material material) Check if block is protectable. This depends on the server's configuration.- Parameters:
material- the block type- Returns:
- false, if the server admin doesn't allow this block type to be protected, or it's not supported.
-
isProtectableEntity
boolean isProtectableEntity(@NotNull @NotNull org.bukkit.entity.EntityType entityType) Check if block is protectable. This depends on the server's configuration.- Parameters:
entityType- the entity- Returns:
- false, if the server admin doesn't allow this entity type to be protected, or it's not supported.
-
createBlockProtection
@NotNull @NotNull BlockProtection createBlockProtection(@NotNull @NotNull ProtectionHook protectionHook, @NotNull @NotNull org.bukkit.block.Block block, @NotNull @NotNull ProtectPlayer protectPlayer) throws IllegalArgumentException, IllegalStateException Create block protection.- Parameters:
protectionHook- your pluginblock- Make sure to testisProtectableBlock(Material)firstprotectPlayer- the owner- Returns:
- never null
- Throws:
IllegalArgumentException- IfisProtectableBlock(Material)would return falseIllegalStateException- If already protected
-
createEntityProtection
@NotNull @NotNull EntityProtection createEntityProtection(@NotNull @NotNull ProtectionHook protectionHook, @NotNull @NotNull org.bukkit.entity.Entity entity, @NotNull @NotNull ProtectPlayer player) throws IllegalArgumentException, IllegalStateException Create entity protection.- Parameters:
protectionHook- your pluginentity- Make sure to testisProtectableEntity(EntityType)firstplayer- the owner- Returns:
- never null
- Throws:
IllegalArgumentException- IfisProtectableEntity(EntityType)would return falseIllegalStateException- If already protected
-