Skip to content

Commit

Permalink
Merge pull request #59 from MrIvanPlays/fix/javadocs
Browse files Browse the repository at this point in the history
Javadocs
  • Loading branch information
lokka30 authored Dec 9, 2021
2 parents 52ff1d5 + 6eba125 commit 6fa080f
Show file tree
Hide file tree
Showing 18 changed files with 248 additions and 124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,26 @@
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
* Represents an event, holding a {@link Account} of some type.
*
* @author MrNemo64
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public class AccountEvent extends Event {

@NotNull private final Account account;

public AccountEvent(@NotNull final Account account) {
this.account = account;
}


/**
* Returns the {@link Account} for this account event.
*
* @return account
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
@NotNull
public Account getAccount() { return account; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
* Represents an event, called when an account does a {@link Transaction}
*
* @author lokka30, MrNemo64
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public class AccountTransactionEvent extends AccountEvent implements Cancellable {

@NotNull private final Transaction transaction;
Expand All @@ -20,6 +26,11 @@ public AccountTransactionEvent(@NotNull final Transaction transaction, @NotNull
this.transaction = transaction;
}

/**
* Returns the transaction the {@link #getAccount()} is doing.
*
* @return transaction
*/
@NotNull
public Transaction getTransaction() { return transaction; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
* Represents an event, called when a {@link BankAccount} does a {@link Transaction}
*
* @author lokka30
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public class BankAccountTransactionEvent extends AccountTransactionEvent {

public BankAccountTransactionEvent(@NotNull Transaction transaction, @NotNull BankAccount account) {
super(transaction, account);
}

/**
* {@inheritDoc}
*/
@Override
public @NotNull BankAccount getAccount() { return (BankAccount) super.getAccount(); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
* Represents an event, called when a {@link PlayerAccount} does a {@link Transaction}
*
* @author lokka30
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public class PlayerAccountTransactionEvent extends AccountTransactionEvent {

public PlayerAccountTransactionEvent(@NotNull Transaction transaction, @NotNull PlayerAccount account) {
super(transaction, account);
}

/**
* {@inheritDoc}
*/
@Override
public @NotNull PlayerAccount getAccount() { return (PlayerAccount) super.getAccount(); }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* the specific platform they're implementing it for.
*
* @author lokka30
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public interface EconomyProvider {

Expand All @@ -34,7 +34,7 @@ public interface EconomyProvider {
*
* @author lokka30, MrIvanPlays
* @return the API version
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
@NotNull
EconomyAPIVersion getSupportedAPIVersion();
Expand All @@ -46,7 +46,7 @@ public interface EconomyProvider {
*
* @author lokka30, NoahvdAa
* @return whether the economy supports bank accounts
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
default boolean hasBankAccountSupport() { return false; }

Expand All @@ -60,8 +60,7 @@ public interface EconomyProvider {
*
* @author lokka30, NoahvdAa
* @return whether the economy calls Treasury's transaction events
* @see me.lokka30.treasury.api.economy.event
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
default boolean hasTransactionEventSupport() { return false; }

Expand All @@ -71,7 +70,7 @@ public interface EconomyProvider {
*
* @author lokka30, NoahvdAa
* @return whether the economy supports negative balances
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
default boolean hasNegativeBalanceSupport() { return false; }

Expand All @@ -80,7 +79,8 @@ public interface EconomyProvider {
*
* @param accountId the {@link UUID} of the account owner
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unkown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void hasPlayerAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<Boolean> subscription);

Expand All @@ -89,7 +89,8 @@ public interface EconomyProvider {
*
* @param accountId the {@link UUID} of the account owner
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrievePlayerAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<PlayerAccount> subscription);

Expand All @@ -98,15 +99,17 @@ public interface EconomyProvider {
*
* @param accountId the {@link UUID} of the account owner
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void createPlayerAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<PlayerAccount> subscription);

/**
* Request all {@link UUID UUIDs} with associated {@link PlayerAccount PlayerAccounts}.
*
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrievePlayerAccountIds(@NotNull EconomySubscriber<Collection<UUID>> subscription);

Expand All @@ -115,7 +118,8 @@ public interface EconomyProvider {
*
* @param accountId the {@code UUID} of the account
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void hasBankAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<Boolean> subscription);

Expand All @@ -124,7 +128,8 @@ public interface EconomyProvider {
*
* @param accountId the {@code UUID} of the account
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveBankAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<BankAccount> subscription);

Expand All @@ -133,31 +138,35 @@ public interface EconomyProvider {
*
* @param accountId the {@code UUID} of the account
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void createBankAccount(@NotNull UUID accountId, @NotNull EconomySubscriber<BankAccount> subscription);

/**
* Request all {@link UUID UUIDs} with associated {@link BankAccount BankAccounts}.
*
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveBankAccountIds(@NotNull EconomySubscriber<Collection<UUID>> subscription);

/**
* Request all {@link UUID UUIDs} for valid {@link Currency Currencies}.
*
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveCurrencyIds(@NotNull EconomySubscriber<Collection<UUID>> subscription);

/**
* Request all names for valid {@link Currency Currencies}.
*
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveCurrencyNames(@NotNull EconomySubscriber<Collection<String>> subscription);

Expand All @@ -166,7 +175,8 @@ public interface EconomyProvider {
*
* @param currencyId the {@code UUID} identifying the {@code Currency}
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveCurrency(@NotNull UUID currencyId, @NotNull EconomySubscriber<Currency> subscription);

Expand All @@ -175,15 +185,17 @@ public interface EconomyProvider {
*
* @param currencyName the name of the {@code Currency}
* @param subscription the {@link EconomySubscriber} accepting the resulting value
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveCurrency(@NotNull String currencyName, @NotNull EconomySubscriber<Currency> subscription);

/**
* Get the primary or main {@link Currency} of the economy.
*
* @return the primary currency
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
@NotNull
Currency getPrimaryCurrency();
Expand All @@ -192,7 +204,8 @@ public interface EconomyProvider {
* Get the {@link UUID} of the primary or main {@link Currency} of the economy.
*
* @return the {@code UUID} identifying the primary currency
* @since v1.0.0
* @author unknown
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
@NotNull
default UUID getPrimaryCurrencyId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @see EconomyProvider
* @see PlayerAccount
* @see BankAccount
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
public interface Account {

Expand All @@ -31,7 +31,7 @@ public interface Account {
* @author lokka30
* @return uuid of the Account.
* @see UUID
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
@NotNull UUID getUniqueId();

Expand All @@ -42,7 +42,7 @@ public interface Account {
* @param currency the {@link Currency} of the balance being requested
* @param subscription the {@link EconomySubscriber} accepting the amount
* @see Account#setBalance(double, Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void retrieveBalance(@NotNull Currency currency, @NotNull EconomySubscriber<Double> subscription);

Expand All @@ -56,7 +56,7 @@ public interface Account {
* @param currency the {@link Currency} of the balance being set
* @param subscription the {@link EconomySubscriber} accepting the new balance
* @see Account#retrieveBalance(Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void setBalance(double amount, @NotNull Currency currency, @NotNull EconomySubscriber<Double> subscription);

Expand All @@ -70,7 +70,7 @@ public interface Account {
* @param currency the {@link Currency} of the balance being modified
* @param subscription the {@link EconomySubscriber} accepting the new balance
* @see Account#setBalance(double, Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void withdrawBalance(double amount, @NotNull Currency currency, @NotNull EconomySubscriber<Double> subscription);

Expand All @@ -84,7 +84,7 @@ public interface Account {
* @param currency the {@link Currency} of the balance being modified
* @param subscription the {@link EconomySubscriber} accepting the new balance
* @see Account#setBalance(double, Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void depositBalance(double amount, @NotNull Currency currency, @NotNull EconomySubscriber<Double> subscription);

Expand All @@ -98,7 +98,7 @@ public interface Account {
* @param subscription the {@link EconomySubscriber} accepting the new balance
* @see PlayerAccount#resetBalance(Currency, EconomySubscriber)
* @see Account#setBalance(double, Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
default void resetBalance(@NotNull Currency currency, @NotNull EconomySubscriber<Double> subscription) {
setBalance(0.0d, currency, new EconomySubscriber<Double>() {
Expand All @@ -125,7 +125,7 @@ public void fail(@NotNull EconomyException exception) {
* @param currency the {@link Currency} of the balance being queried
* @param subscription the {@link EconomySubscriber} accepting whether the balance is high enough
* @see Account#retrieveBalance(Currency, EconomySubscriber)
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
default void canAfford(double amount, @NotNull Currency currency, @NotNull EconomySubscriber<Boolean> subscription) {
retrieveBalance(currency, new EconomySubscriber<Double>() {
Expand All @@ -149,7 +149,7 @@ public void fail(@NotNull EconomyException exception) {
*
* @author lokka30
* @param subscription the {@link EconomySubscriber} accepting whether deletion occurred successfully
* @since v1.0.0
* @since {@link me.lokka30.treasury.api.economy.misc.EconomyAPIVersion#v1_0 v1.0}
*/
void deleteAccount(@NotNull EconomySubscriber<Boolean> subscription);

Expand Down
Loading

0 comments on commit 6fa080f

Please sign in to comment.