-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/java/net/thenextlvl/services/economy/account/Account.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.thenextlvl.services.economy.account; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Account is an interface representing a financial account. | ||
*/ | ||
public interface Account { | ||
|
||
/** | ||
* Returns the UUID of the owner of this account. | ||
* | ||
* @return the UUID of the owner | ||
*/ | ||
UUID getOwner(); | ||
|
||
/** | ||
* Retrieves the balance of the account. | ||
* | ||
* @return the balance of the account | ||
*/ | ||
double getBalance(); | ||
|
||
/** | ||
* Withdraws the specified amount from the account balance. | ||
* | ||
* @param amount the amount to be withdrawn | ||
* @return the new balance after the withdrawal | ||
*/ | ||
double withdraw(double amount); | ||
|
||
/** | ||
* Deposits the specified amount into the account balance. | ||
* | ||
* @param amount the amount to be deposited | ||
* @return the new balance after the deposit | ||
*/ | ||
double deposit(double amount); | ||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/net/thenextlvl/services/economy/account/AccountController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package net.thenextlvl.services.economy.account; | ||
|
||
import org.bukkit.OfflinePlayer; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
/** | ||
* The AccountController interface provides methods to create, retrieve and delete accounts. | ||
*/ | ||
public interface AccountController { | ||
/** | ||
* Creates an account with the given unique ID. | ||
* | ||
* @param uniqueId the unique ID of the account to be created | ||
* @return a CompletableFuture that will complete with the created account | ||
*/ | ||
CompletableFuture<Account> createAccount(UUID uniqueId); | ||
|
||
/** | ||
* Creates an account for the specified player. | ||
* | ||
* @param player the player for whom the account will be created | ||
* @return a CompletableFuture that will complete with the created account | ||
*/ | ||
CompletableFuture<Account> createAccount(OfflinePlayer player); | ||
|
||
/** | ||
* Retrieves the account for the specified player. | ||
* | ||
* @param player the player for whom the account will be retrieved | ||
* @return a CompletableFuture that will complete with the retrieved account | ||
*/ | ||
CompletableFuture<Account> getAccount(OfflinePlayer player); | ||
|
||
/** | ||
* Retrieves the account with the specified unique ID. | ||
* | ||
* @param uniqueId the unique ID of the account to be retrieved | ||
* @return a CompletableFuture that will complete with the retrieved account | ||
*/ | ||
CompletableFuture<Account> getAccount(UUID uniqueId); | ||
|
||
/** | ||
* Deletes the specified account. | ||
* | ||
* @param account the account to be deleted | ||
* @return a CompletableFuture that will complete when the account is deleted | ||
*/ | ||
CompletableFuture<Void> deleteAccount(Account account); | ||
|
||
/** | ||
* Deletes the account of the specified player. | ||
* | ||
* @param player the player whose account will be deleted | ||
* @return a CompletableFuture that will complete when the account is deleted | ||
*/ | ||
CompletableFuture<Void> deleteAccount(OfflinePlayer player); | ||
|
||
/** | ||
* Deletes the account with the specified unique ID. | ||
* | ||
* @param uniqueId the unique ID of the account to be deleted | ||
* @return a CompletableFuture that will complete when the account is deleted | ||
*/ | ||
CompletableFuture<Void> deleteAccount(UUID uniqueId); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/net/thenextlvl/services/economy/account/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@TypesAreNotNullByDefault | ||
@FieldsAreNotNullByDefault | ||
@MethodsReturnNotNullByDefault | ||
@ParametersAreNotNullByDefault | ||
package net.thenextlvl.services.economy.account; | ||
|
||
import core.annotation.FieldsAreNotNullByDefault; | ||
import core.annotation.MethodsReturnNotNullByDefault; | ||
import core.annotation.ParametersAreNotNullByDefault; | ||
import core.annotation.TypesAreNotNullByDefault; |