Merge branch 'kitchen-sink' into Displayable-GUI-API

This commit is contained in:
Paul Reilly 2023-06-09 13:25:18 -05:00
commit 6631aebaa0
9 changed files with 127 additions and 31 deletions

View File

@ -1,7 +1,14 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* Represents an immutable transaction that has been fully handled by a {@link Transactor} instance
*/
public interface CompletedTransaction extends Transaction public interface CompletedTransaction extends Transaction
{ {
/**
* Gets the final result of the {@link Transaction}
*
* @return the result
*/
TransactionResult getResult(); TransactionResult getResult();
} }

View File

@ -1,8 +1,21 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* An entity that is able to transfer sums of currency between other {@link EconomicEntity}
*/
public interface 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(); EconomicEntityData getEconomicData();
/**
* The name of the economic entity
*
* @return the economic entity's name
*/
String getName(); String getName();
} }

View File

@ -1,14 +1,41 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* Metadata associated with a {@link EconomicEntity}
*/
public interface EconomicEntityData public interface EconomicEntityData
{ {
/***
* @return the transaction freeze state
*/
boolean areTransactionsFrozen(); boolean areTransactionsFrozen();
/***
* @return the balance
*/
long getBalance(); 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); 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); long removeFromBalance(final long amount);
/**
* Sets the balance of the associated instance
*
* @param newBalance the new balance
*/
void setBalance(final long newBalance);
} }

View File

@ -1,14 +1,32 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/** /**
* Please ensure that all modifications of {@link MutableTransaction} happen BEFORE it is passed to a * A transaction that can be changed.
* {@link Transactor} implementation * <p>
* 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 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); 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); 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); void setBalance(final long newBalance);
} }

View File

@ -1,11 +1,23 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* A class that denotes the transfer of currency between two EconomicEntity instances.
*/
public interface Transaction public interface Transaction
{ {
/**
* @return the initiating entity
*/
EconomicEntity getSource(); EconomicEntity getSource();
/**
* @return the destination entity
*/
EconomicEntity getDestination(); EconomicEntity getDestination();
/**
* @return the balance transferred in this Transaction
*/
long getBalance(); long getBalance();
} }

View File

@ -1,6 +1,14 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* A class that intercepts transactions after they are completed and logs them to a data point
*/
public interface TransactionLogger public interface TransactionLogger
{ {
/**
* Logs a completed transaction
*
* @param completedTransaction the completed transaction to log
*/
void logTransaction(CompletedTransaction completedTransaction); void logTransaction(CompletedTransaction completedTransaction);
} }

View File

@ -2,6 +2,9 @@ package me.totalfreedom.economy;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
/**
* A class that represents the result of a transaction
*/
public interface TransactionResult public interface TransactionResult
{ {
String getMessage(); String getMessage();

View File

@ -1,6 +1,15 @@
package me.totalfreedom.economy; package me.totalfreedom.economy;
/**
* A class that implements the completion of transactions.
*/
public interface Transactor public interface Transactor
{ {
/**
* Processes a transaction
*
* @param transaction the transaction to process
* @return the completed transaction
*/
CompletedTransaction handleTransaction(MutableTransaction transaction); CompletedTransaction handleTransaction(MutableTransaction transaction);
} }

View File

@ -23,21 +23,21 @@
### ###
[<img src="https://img.shields.io/static/v1?label=%20&message=Help%20Wanted&color=red&style=for-the-badge">](https://discord.gg/4PdtmrVNRx) [<img src="https://img.shields.io/static/v1?label=%20&message=Help%20Wanted&color=red&style=for-the-badge">](https://discord.gg/4PdtmrVNRx)
![GitHub contributors](https://img.shields.io/github/contributors/SimplexDevelopment/FreedomNetworkSuite?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/SimplexDevelopment/FreedomNetworkSuite?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)
[<img src="https://img.shields.io/github/issues/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge">](https://github.com/SimplexDevelopment/FreedomNetworkSuite/issues) [<img src="https://img.shields.io/github/issues/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge">](https://github.com/AtlasMediaGroup/Freedom-Network-Suite/issues)
[<img src="https://img.shields.io/github/issues-pr/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge">](https://github.com/SimplexDevelopment/FreedomNetworkSuite/pulls) [<img src="https://img.shields.io/github/issues-pr/AtlasMediaGroup/Freedom-Network-Suite?style=for-the-badge">](https://github.com/AtlasMediaGroup/Freedom-Network-Suite/pulls)
![GitHub last commit](https://img.shields.io/github/last-commit/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge) ![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/7a0fa4694878444dabc6cc2804fbf125?style=for-the-badge) ![Codacy grade](https://img.shields.io/codacy/grade/176b8003312c4602afb9be7706aef146?style=for-the-badge)
### ###
[<img src="https://img.shields.io/static/v1?label=Roadmap&message=Google%20Docs&color=4285F4&style=for-the-badge&logo=googledrive">](https://docs.google.com/document/d/197fwNo076RsCiPW6e6QWaGEzTGnDcRuf5FBA6lNeiPE) [<img src="https://img.shields.io/static/v1?label=Roadmap&message=Google%20Docs&color=4285F4&style=for-the-badge&logo=googledrive">](https://docs.google.com/document/d/197fwNo076RsCiPW6e6QWaGEzTGnDcRuf5FBA6lNeiPE)
[<img src="https://img.shields.io/github/license/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge">](https://github.com/SimplexDevelopment/FreedomNetworkSuite/blob/kitchen-sink/LICENSE.md) [<img src="https://img.shields.io/github/license/AtlasMediaGroup/Freedom-Network-Suite?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/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge&logo=github) ![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/SimplexDevelopment/FreedomNetworkSuite?include_prereleases&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/SimplexDevelopment/FreedomNetworkSuite?style=for-the-badge) ![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/SimplexDevelopment/FreedomNetworkSuite?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) ![TFM Used](https://img.shields.io/static/v1?label=TFM%20Code%20Used&message=0%25&color=red&style=for-the-badge&logo=tensorflow)
# FreedomNetworkSuite # 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 designed to encompass the ideologies of a Freedom server, while maintaining full customization through modules.
This is a ground up rewrite of [TotalFreedomMod]. This is a ground up rewrite of [TotalFreedomMod].
<br> <br>
<br>
Honorable mention: Honorable mention:
<br> <br>
[<img src="https://img.shields.io/static/v1?label=Plex&message=A%20New%20Freedom%20Plugin&color=4285F4&style=flat-square&logo=plex)">](https://github.com/plexusorg/Plex) [<img src="https://img.shields.io/static/v1?label=Plex&message=A%20New%20Freedom%20Plugin&color=4285F4&style=flat-square&logo=plex)">](https://github.com/plexusorg/Plex)
@ -76,33 +77,31 @@ Patchwork:
- [x] Logging System - [x] Logging System
- [x] SQL API - [x] SQL API
- [x] Economy API - [x] Economy API
- [ ] Command API - [x] Command API
- [ ] Particle API - [x] Particle API
- [x] User API - [x] User API
- [ ] Ban API
- [x] Service API - [x] Service API
- [x] Task API - [x] Task API
- [x] Permissions API - [x] Permissions API
- [ ] Configuration API - [ ] Configuration API *(In Progress...)*
- [ ] Event API - [ ] Event API *(In Progress...)*
Datura: Datura:
- [ ] Permission Handling - [ ] Permission Handling *(In Progress...)*
- [ ] Permission Registration & Assignment - [ ] Permission Registration & Assignment *(In Progress...)*
- [ ] SQL Data Handling - [ ] SQL Data Handling *(In Progress...)*
- [ ] Configuration Implementations - [ ] Configuration Implementations
- [ ] User Data Implementations - [ ] User Data Implementations *(In Progress...)*
- [ ] Banning Implementation - [x] Punishment Systems (e.x. Locker, Halter, Cager)
- [ ] Punishment Systems (e.x. Locker, Halter, Muter, Cager)
Fossil: Fossil:
- [x] Economy Implementation - [x] Economy Implementation
- [ ] Particle Implementation / Trails - [ ] Particle Implementation / Trails *(In Progress...)*
- [ ] Command Implementations - [ ] Command Implementations *(In Progress...)*
- [ ] Implement a shop for the economy - [ ] Implement a shop for the economy *(In Progress...)*
- [ ] Chat reaction / game system - [ ] Chat reaction / game system
- [ ] Jumppads - [ ] Jumppads
Corvo: Corvo: