Class ClaimEvents

java.lang.Object
me.EtienneDx.RealEstate.ClaimEvents

public class ClaimEvents extends Object
Provides helper methods to handle claim-related events.

These methods are used by the RealEstate plugin to check permissions on claims involved in transactions and to cancel transactions when a claim is deleted.

  • Constructor Details

    • ClaimEvents

      public ClaimEvents()
      Default constructor for ClaimEvents.

      This class is not meant to be instantiated; all methods are static. The constructor is provided only to eliminate Javadoc warnings.

  • Method Details

    • onClaimPermission

      public static String onClaimPermission(IClaim claim, org.bukkit.entity.Player player, ClaimPermission permission)
      Checks if a player is allowed to perform a certain action on a claim, given an ongoing transaction.

      The method examines an active transaction for the specified claim. If the transaction is a BoughtTransaction with a non-null buyer and the player is either the owner of the transaction or (in the case of admin claims) has the appropriate admin permission, then a specific error message is returned based on the type of permission (EDIT, ACCESS, BUILD, CONTAINER, or MANAGE). In addition, if the action involves editing or managing, the method checks all child claims for active transactions and returns an error message if any are found. If no conditions are met that would prevent the action, null is returned.

      Parameters:
      claim - the claim being checked
      player - the player attempting the action
      permission - the permission type being checked
      Returns:
      an error message if the action is not allowed; null if the action is permitted
    • onClaimDeleted

      public static void onClaimDeleted(IClaim claim)
      Handles the deletion of a claim by cancelling any ongoing transactions.

      When a claim is deleted, this method cancels the transaction associated with the claim, and then iterates over all child claims (if any) to cancel their transactions as well.

      Parameters:
      claim - the claim that has been deleted