Class ProtectionQuery

java.lang.Object
com.sk89q.worldguard.bukkit.ProtectionQuery

public class ProtectionQuery extends Object
A helper class to query whether a block or entity is protected by WorldGuard.
  • Constructor Details

    • ProtectionQuery

      public ProtectionQuery()
  • Method Details

    • testBlockPlace

      public boolean testBlockPlace(@Nullable Object cause, org.bukkit.Location location, org.bukkit.Material newMaterial)
      Test whether a block can be placed at a given location.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      location - the location of the block
      newMaterial - the new material
      Returns:
      true if the action is permitted
    • testBlockBreak

      public boolean testBlockBreak(@Nullable Object cause, org.bukkit.block.Block block)
      Test whether a block can be broken.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      block - the block broken
      Returns:
      true if the action is permitted
    • testBlockInteract

      public boolean testBlockInteract(@Nullable Object cause, org.bukkit.block.Block block)
      Test whether a block can be interacted with.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      block - the block that is interacted with
      Returns:
      true if the action is permitted
    • testEntityPlace

      public boolean testEntityPlace(@Nullable Object cause, org.bukkit.Location location, org.bukkit.entity.EntityType type)
      Test whether an entity can be placed.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      location - the location that the entity will be spawned at
      type - the type that is to be spawned
      Returns:
      true if the action is permitted
    • testEntityDestroy

      public boolean testEntityDestroy(@Nullable Object cause, org.bukkit.entity.Entity entity)
      Test whether an entity can be destroyed.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      entity - the entity broken
      Returns:
      true if the action is permitted
    • testEntityInteract

      public boolean testEntityInteract(@Nullable Object cause, org.bukkit.entity.Entity entity)
      Test whether an entity can be interacted with.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      entity - the entity interacted with
      Returns:
      true if the action is permitted
    • testEntityDamage

      public boolean testEntityDamage(@Nullable Object cause, org.bukkit.entity.Entity entity)
      Test whether an entity can be damaged.

      The cause does not have to be a player. It can be null if the cause is not known, although the checks will executed assuming that the actor is a non-member of all regions.

      Parameters:
      cause - the cause, which can be a block, an entity, or a player, or null if unknown
      entity - the entity damaged
      Returns:
      true if the action is permitted