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:
@ -26,6 +26,7 @@ public class SimpleUserData implements UserData
|
||||
private boolean frozen;
|
||||
private boolean canInteract;
|
||||
private boolean caged;
|
||||
private long balance;
|
||||
|
||||
public SimpleUserData(final Player player)
|
||||
{
|
||||
@ -42,7 +43,8 @@ public class SimpleUserData implements UserData
|
||||
final long playtime,
|
||||
final boolean frozen,
|
||||
final boolean canInteract,
|
||||
final boolean caged)
|
||||
final boolean caged,
|
||||
final long balance)
|
||||
{
|
||||
this.uuid = uuid;
|
||||
this.username = username;
|
||||
@ -52,6 +54,7 @@ public class SimpleUserData implements UserData
|
||||
this.frozen = frozen;
|
||||
this.canInteract = canInteract;
|
||||
this.caged = caged;
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public static SimpleUserData fromSQL(SQL sql, String uuid)
|
||||
@ -82,7 +85,8 @@ public class SimpleUserData implements UserData
|
||||
boolean frozen = result.getBoolean("frozen");
|
||||
boolean canInteract = result.getBoolean("canInteract");
|
||||
boolean caged = result.getBoolean("caged");
|
||||
return new SimpleUserData(u, username, user, group, playtime, frozen, canInteract, caged);
|
||||
long balance = result.getLong("balance");
|
||||
return new SimpleUserData(u, username, user, group, playtime, frozen, canInteract, caged, balance);
|
||||
}
|
||||
} catch (SQLException ex)
|
||||
{
|
||||
@ -197,4 +201,28 @@ public class SimpleUserData implements UserData
|
||||
{
|
||||
this.caged = caged;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBalance()
|
||||
{
|
||||
return balance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToBalance(long amount)
|
||||
{
|
||||
this.balance += amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromBalance(long amount)
|
||||
{
|
||||
this.balance -= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBalance(long newBalance)
|
||||
{
|
||||
this.balance = newBalance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user