Interface Protection

All Superinterfaces:
Nameable, ProtectionHookHolder, com.github.angeschossen.pluginframework.api.trusted.RoleHolder
All Known Subinterfaces:
BlockProtection, EntityProtection

public interface Protection extends Nameable, com.github.angeschossen.pluginframework.api.trusted.RoleHolder, ProtectionHookHolder
Represents a protection on a block or entity, owned by a player.
  • Method Details

    • getProtectionType

      @NotNull @NotNull ProtectionType getProtectionType()
      Get the type of protection.
      Returns:
      block or entity
    • getX

      int getX()
      Get the block x coordinate.
      Specified by:
      getX in interface ProtectionHookHolder
      Returns:
      block x
    • getY

      int getY()
      Get the block y coordinate.
      Specified by:
      getY in interface ProtectionHookHolder
      Returns:
      block y
    • getZ

      int getZ()
      Get the block z coordinate.
      Specified by:
      getZ in interface ProtectionHookHolder
      Returns:
      block z
    • type

      @NotNull @NotNull Type type()
      Get the type of protection.
      Returns:
      protection type
    • getGroup

      @Nullable @Nullable com.github.angeschossen.pluginframework.api.trusted.group.Group getGroup()
      Get group that this protection belongs to.
      Returns:
      null, if no group set
    • delete

      void delete(@Nullable @Nullable ProtectPlayer deleter, boolean msg) throws IllegalStateException
      Delete the protection.
      Parameters:
      deleter - The player that deletes the protection, will receive an unlock message.
      msg - whether to send the unlock message to the deleter
      Throws:
      IllegalStateException
    • delete

      void delete(@Nullable @Nullable ProtectPlayer deleter) throws IllegalStateException
      Delete the protection and send the unlock message to the deleter.
      Parameters:
      deleter - the player that deletes the protection, will receive an unlock message
      Throws:
      IllegalStateException
    • getTrustedWithoutGroup

      @NotNull @NotNull Collection<UUID> getTrustedWithoutGroup()
      Get players that are trusted directly to this protection and aren't trusted via a group Group.
      Returns:
      Players directly trusted at this protection
    • hasFlag

      boolean hasFlag(@NotNull @NotNull ProtectionFlag flag)
      Check if a protection has a flag set.
      Parameters:
      flag - the flag
      Returns:
      false, if flag not set
    • toggleFlag

      boolean toggleFlag(@NotNull @NotNull ProtectionFlag flag)
      Toggle a flag for this protection.
      Parameters:
      flag - the flag to toggle
      Returns:
      new state of the flag
    • untrustPlayer

      boolean untrustPlayer(@NotNull @NotNull UUID playerUUID)
      Untrust a player that is trusted directly to this protection.
      Specified by:
      untrustPlayer in interface com.github.angeschossen.pluginframework.api.trusted.RoleHolder
      Parameters:
      playerUUID - The player to untrust