diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/CompletedTransaction.java b/Patchwork/src/main/java/me/totalfreedom/economy/CompletedTransaction.java index 7b58dfd..50af8c9 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/CompletedTransaction.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/CompletedTransaction.java @@ -1,7 +1,14 @@ package me.totalfreedom.economy; +/** + * Represents an immutable transaction that has been fully handled by a {@link Transactor} instance + */ public interface CompletedTransaction extends Transaction { - + /** + * Gets the final result of the {@link Transaction} + * + * @return the result + */ TransactionResult getResult(); } diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntity.java b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntity.java index 1855d1e..59b11c2 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntity.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntity.java @@ -1,8 +1,21 @@ package me.totalfreedom.economy; +/** + * An entity that is able to transfer sums of currency between other {@link EconomicEntity} + */ public interface EconomicEntity { + /** + * Gets the {@link EconomicEntityData} (which contains various common metadata about this {@link EconomicEntity}) associated with this class + * + * @return the {@link EconomicEntityData} + */ EconomicEntityData getEconomicData(); + /** + * The name of the economic entity + * + * @return the economic entity's name + */ String getName(); } diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java index 061c4a7..7e1f5aa 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java @@ -1,14 +1,41 @@ package me.totalfreedom.economy; +/** + * Metadata associated with a {@link EconomicEntity} + */ public interface EconomicEntityData { + /*** + * @return the transaction freeze state + */ boolean areTransactionsFrozen(); + /*** + * @return the balance + */ long getBalance(); - void setBalance(final long newBalance); + /** + * Adds the provided amount to the associated instance's balance + * + * @param amount the amount to add + * @return the new balance + */ long addToBalance(final long amount); + /** + * Subtracts the provided amount from the associated instance's balance + * + * @param amount the amount to subtract + * @return the new balance + */ long removeFromBalance(final long amount); + + /** + * Sets the balance of the associated instance + * + * @param newBalance the new balance + */ + void setBalance(final long newBalance); } diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/MutableTransaction.java b/Patchwork/src/main/java/me/totalfreedom/economy/MutableTransaction.java index ba09b9e..0deebc8 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/MutableTransaction.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/MutableTransaction.java @@ -1,14 +1,32 @@ package me.totalfreedom.economy; /** - * Please ensure that all modifications of {@link MutableTransaction} happen BEFORE it is passed to a - * {@link Transactor} implementation + * A transaction that can be changed. + *
+ * IMPORTANT NOTE: Please ensure that all modifications of {@link MutableTransaction} happen BEFORE it is passed to a {@link Transactor} implementation
*/
public interface MutableTransaction extends Transaction
{
+ /**
+ * Adds a number to the balance transferred in this transaction
+ *
+ * @param amount the amount to add
+ * @return the new amount
+ */
long addToBalance(final long amount);
+ /**
+ * Subtracts a number from the balance transferred in this transaction
+ *
+ * @param amount the amount to remove
+ * @return the new amount
+ */
long removeFromBalance(final long amount);
+ /**
+ * Sets the balance transferred in this transaction
+ *
+ * @param newBalance the new balance of the transaction
+ */
void setBalance(final long newBalance);
}
diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java
index eb0e310..5968265 100644
--- a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java
+++ b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java
@@ -1,11 +1,23 @@
package me.totalfreedom.economy;
+/**
+ * A class that denotes the transfer of currency between two EconomicEntity instances.
+ */
public interface Transaction
{
+ /**
+ * @return the initiating entity
+ */
EconomicEntity getSource();
+ /**
+ * @return the destination entity
+ */
EconomicEntity getDestination();
+ /**
+ * @return the balance transferred in this Transaction
+ */
long getBalance();
}
diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/TransactionLogger.java b/Patchwork/src/main/java/me/totalfreedom/economy/TransactionLogger.java
index f8dce2d..1d57fdd 100644
--- a/Patchwork/src/main/java/me/totalfreedom/economy/TransactionLogger.java
+++ b/Patchwork/src/main/java/me/totalfreedom/economy/TransactionLogger.java
@@ -1,6 +1,14 @@
package me.totalfreedom.economy;
+/**
+ * A class that intercepts transactions after they are completed and logs them to a data point
+ */
public interface TransactionLogger
{
+ /**
+ * Logs a completed transaction
+ *
+ * @param completedTransaction the completed transaction to log
+ */
void logTransaction(CompletedTransaction completedTransaction);
}
diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/TransactionResult.java b/Patchwork/src/main/java/me/totalfreedom/economy/TransactionResult.java
index fd4a13d..9859a99 100644
--- a/Patchwork/src/main/java/me/totalfreedom/economy/TransactionResult.java
+++ b/Patchwork/src/main/java/me/totalfreedom/economy/TransactionResult.java
@@ -2,6 +2,9 @@ package me.totalfreedom.economy;
import net.kyori.adventure.text.Component;
+/**
+ * A class that represents the result of a transaction
+ */
public interface TransactionResult
{
String getMessage();
diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/Transactor.java b/Patchwork/src/main/java/me/totalfreedom/economy/Transactor.java
index 8fd9c47..60e1b3c 100644
--- a/Patchwork/src/main/java/me/totalfreedom/economy/Transactor.java
+++ b/Patchwork/src/main/java/me/totalfreedom/economy/Transactor.java
@@ -1,6 +1,15 @@
package me.totalfreedom.economy;
+/**
+ * A class that implements the completion of transactions.
+ */
public interface Transactor
{
+ /**
+ * Processes a transaction
+ *
+ * @param transaction the transaction to process
+ * @return the completed transaction
+ */
CompletedTransaction handleTransaction(MutableTransaction transaction);
}
diff --git a/README.md b/README.md
index 345f2ac..1007c96 100644
--- a/README.md
+++ b/README.md
@@ -23,21 +23,21 @@
###
[](https://discord.gg/4PdtmrVNRx)
-![GitHub contributors](https://img.shields.io/github/contributors/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge)
-![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge)
-[](https://github.com/SimplexDevelopment/FreedomNetworkSuite/issues)
-[](https://github.com/SimplexDevelopment/FreedomNetworkSuite/pulls)
-![GitHub last commit](https://img.shields.io/github/last-commit/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge)
-![Codacy grade](https://img.shields.io/codacy/grade/7a0fa4694878444dabc6cc2804fbf125?style=for-the-badge)
+![GitHub contributors](https://img.shields.io/github/contributors/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge)
+![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge)
+[](https://github.com/AtlasMediaGroup/Freedom-Network-Suite/issues)
+[](https://github.com/AtlasMediaGroup/Freedom-Network-Suite/pulls)
+![GitHub last commit](https://img.shields.io/github/last-commit/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge)
+![Codacy grade](https://img.shields.io/codacy/grade/176b8003312c4602afb9be7706aef146?style=for-the-badge)
###
[](https://docs.google.com/document/d/197fwNo076RsCiPW6e6QWaGEzTGnDcRuf5FBA6lNeiPE)
-[](https://github.com/SimplexDevelopment/FreedomNetworkSuite/blob/kitchen-sink/LICENSE.md)
-![GitHub top language](https://img.shields.io/github/languages/top/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge&logo=github)
-![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/SimplexDevelopment/FreedomNetworkSuite?include_prereleases&style=for-the-badge&logo=github)
-![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge)
-![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge)
+[](https://github.com/AtlasMediaGroup/Freedom-Network-Suite/blob/kitchen-sink/LICENSE.md)
+![GitHub top language](https://img.shields.io/github/languages/top/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge&logo=github)
+![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/AtlasMediaGroup/Freedom-Network-Suite?include_prereleases&style=for-the-badge&logo=github)
+![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge)
+![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge)
![TFM Used](https://img.shields.io/static/v1?label=TFM%20Code%20Used&message=0%25&color=red&style=for-the-badge&logo=tensorflow)
# FreedomNetworkSuite
@@ -46,6 +46,7 @@ This is a proof of concept for a new suite of modules supported by a common libr
This is designed to encompass the ideologies of a Freedom server, while maintaining full customization through modules.
This is a ground up rewrite of [TotalFreedomMod].
+
Honorable mention:
[](https://github.com/plexusorg/Plex)
@@ -76,33 +77,31 @@ Patchwork:
- [x] Logging System
- [x] SQL API
- [x] Economy API
-- [ ] Command API
-- [ ] Particle API
+- [x] Command API
+- [x] Particle API
- [x] User API
-- [ ] Ban API
- [x] Service API
- [x] Task API
- [x] Permissions API
-- [ ] Configuration API
-- [ ] Event API
+- [ ] Configuration API *(In Progress...)*
+- [ ] Event API *(In Progress...)*
Datura:
-- [ ] Permission Handling
-- [ ] Permission Registration & Assignment
-- [ ] SQL Data Handling
-- [ ] Configuration Implementations
-- [ ] User Data Implementations
-- [ ] Banning Implementation
-- [ ] Punishment Systems (e.x. Locker, Halter, Muter, Cager)
+- [ ] Permission Handling *(In Progress...)*
+- [ ] Permission Registration & Assignment *(In Progress...)*
+- [ ] SQL Data Handling *(In Progress...)*
+- [ ] Configuration Implementations
+- [ ] User Data Implementations *(In Progress...)*
+- [x] Punishment Systems (e.x. Locker, Halter, Cager)
Fossil:
- [x] Economy Implementation
-- [ ] Particle Implementation / Trails
-- [ ] Command Implementations
-- [ ] Implement a shop for the economy
-- [ ] Chat reaction / game system
+- [ ] Particle Implementation / Trails *(In Progress...)*
+- [ ] Command Implementations *(In Progress...)*
+- [ ] Implement a shop for the economy *(In Progress...)*
+- [ ] Chat reaction / game system
- [ ] Jumppads
Corvo: