Interface TransactionContext


@AvailableSince("1.0") public sealed interface TransactionContext
Provides audit metadata about a transaction's initiator.

Tracks who initiated a transaction and optionally why, enabling audit trails and transaction attribution for economy operations.

Usage Example


 // Create context for a player action
 TransactionContext ctx = TransactionContext.builder()
     .actor(Actor.player(player))
     .reason("Purchase from shop")
     .build();

 // Create context for a plugin action
 TransactionContext ctx = TransactionContext.builder()
     .actor(Actor.plugin("MyPlugin"))
     .reason("Daily reward")
     .build();

 // Use with transaction
 economy.beginTransaction(accountId, ctx);
 
Since:
1.0
  • Method Details

    • create

      @AvailableSince("1.0") static TransactionContext create(TransactionContext.Actor actor, String reason)
      Creates a transaction context with an actor and optional reason.
      Parameters:
      actor - the entity initiating the transaction
      reason - optional human-readable justification
      Returns:
      new transaction context
    • actor

      @AvailableSince("1.0") TransactionContext.Actor actor()
      Gets the entity that initiated this transaction.
      Returns:
      the transaction actor
    • reason

      @AvailableSince("1.0") Optional<String> reason()
      Gets the optional human-readable justification for this transaction.
      Returns:
      optional reason string