Package dev.mintychochip.mint
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents the initiator of a transaction.static final recordActor implementation for player-initiated transactions.static final recordActor implementation for plugin-initiated transactions. -
Method Summary
Modifier and TypeMethodDescriptionactor()Gets the entity that initiated this transaction.static TransactionContextcreate(TransactionContext.Actor actor, String reason) Creates a transaction context with an actor and optional reason.reason()Gets the optional human-readable justification for this transaction.
-
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 transactionreason- optional human-readable justification- Returns:
- new transaction context
-
actor
Gets the entity that initiated this transaction.- Returns:
- the transaction actor
-
reason
Gets the optional human-readable justification for this transaction.- Returns:
- optional reason string
-