public class TransactionHandler extends com.google.common.collect.ForwardingCollection<Transaction> implements Transactions
Constructor and Description |
---|
TransactionHandler()
Do not instantiate.
|
Modifier and Type | Method and Description |
---|---|
int |
amount(int account,
Object person,
Object type)
Obtains the amount of an item as indicated by the amount field in each transaction
|
protected Collection<Transaction> |
delegate() |
void |
deposit(int account,
Transaction transaction)
Performs a transaction from the transaction's sender to the transaction's receiver
|
int |
globalEconomy()
The global economy ID to be used as the transaction ID
|
int |
globalExchange()
The global exchange ID to be used as the transaction ID
|
int |
newAcount()
Creates a new account from the internal account clock
|
boolean |
withdraw(int account,
Transaction transaction)
Withdraws an item from the account
|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, standardAddAll, standardClear, standardContains, standardContainsAll, standardIsEmpty, standardRemove, standardRemoveAll, standardRetainAll, standardToArray, standardToArray, standardToString, toArray, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
public TransactionHandler()
To access this handler, use this code:
Transactions handler = Registered.transactions();
public int newAcount()
Transactions
newAcount
in interface Transactions
public int globalEconomy()
Transactions
This is just a recommendation to use for plugins. You do not need to use this.
globalEconomy
in interface Transactions
public int globalExchange()
Transactions
This is just a recommendation to use for plugins. You do not need to use this.
globalExchange
in interface Transactions
public void deposit(int account, Transaction transaction)
Transactions
deposit
in interface Transactions
account
- the account ID to be usedtransaction
- the transaction to performpublic boolean withdraw(int account, Transaction transaction)
Transactions
IMPORTANT: The sender is the person withdrawing from the account. The receiver is not taken into
consideration, so that is allowed to be null
.
withdraw
in interface Transactions
account
- the account ID to be usedtransaction
- the transaction to performfalse
if the account for the withdrawer does not exist, true
if the transaction completes
successfullypublic int amount(int account, Object person, Object type)
Transactions
amount
in interface Transactions
account
- the account ID to be usedperson
- the object which the transactions were sent to that is checked by this amountingtype
- the types to find the amount of. Also the parameter in
Transaction.item()
type
found the account of person
,
or Integer.MIN_VALUE
if the account for person
does not exist, or the accound ID is not
used for that personprotected Collection<Transaction> delegate()
delegate
in class com.google.common.collect.ForwardingCollection<Transaction>
Copyright © 2016. All rights reserved.