mirror of
https://github.com/SimplexDevelopment/FreedomNetworkSuite.git
synced 2025-06-26 19:44:27 +00:00
Add economic entity interfaces
I decided to add these interfaces, instead of just building upon the User & UserData interface, as support for commerce between clans & users might be something that we want to add in the future in Clans.
This commit is contained in:
@ -0,0 +1,8 @@
|
||||
package me.totalfreedom.economy;
|
||||
|
||||
public interface EconomicEntity
|
||||
{
|
||||
EconomicEntityData getEconomicData();
|
||||
|
||||
String getName();
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package me.totalfreedom.economy;
|
||||
|
||||
public interface EconomicEntityData
|
||||
{
|
||||
long getBalance();
|
||||
|
||||
void addToBalance(final long amount);
|
||||
|
||||
void removeFromBalance(final long amount);
|
||||
|
||||
void setBalance(final long newBalance);
|
||||
}
|
@ -1,10 +1,25 @@
|
||||
package me.totalfreedom.user;
|
||||
|
||||
import me.totalfreedom.economy.EconomicEntity;
|
||||
import me.totalfreedom.economy.EconomicEntityData;
|
||||
import me.totalfreedom.security.PermissionHolder;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public interface User extends PermissionHolder
|
||||
public interface User extends PermissionHolder, EconomicEntity
|
||||
{
|
||||
// Implement a few EconomicEntity methods in the User interface
|
||||
@Override
|
||||
default String getName()
|
||||
{
|
||||
return getUserData().getUsername();
|
||||
}
|
||||
|
||||
@Override
|
||||
default EconomicEntityData getEconomicData()
|
||||
{
|
||||
return getUserData();
|
||||
}
|
||||
|
||||
UserData getUserData();
|
||||
|
||||
Component getDisplayName();
|
||||
|
@ -1,12 +1,13 @@
|
||||
package me.totalfreedom.user;
|
||||
|
||||
import me.totalfreedom.economy.EconomicEntityData;
|
||||
import me.totalfreedom.security.Group;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface UserData
|
||||
public interface UserData extends EconomicEntityData
|
||||
{
|
||||
@NotNull UUID getUniqueId();
|
||||
|
||||
|
Reference in New Issue
Block a user