From 57853a37c5eb859febaf6ab3dbbd46ffdc4f42a2 Mon Sep 17 00:00:00 2001 From: Allink Date: Sat, 20 May 2023 05:14:10 +0100 Subject: [PATCH] Add transaction freezing --- .../totalfreedom/datura/user/SimpleUserData.java | 14 ++++++++++++-- .../totalfreedom/economy/EconomicEntityData.java | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Datura/src/main/java/me/totalfreedom/datura/user/SimpleUserData.java b/Datura/src/main/java/me/totalfreedom/datura/user/SimpleUserData.java index 8b4fbce..e19d3f9 100644 --- a/Datura/src/main/java/me/totalfreedom/datura/user/SimpleUserData.java +++ b/Datura/src/main/java/me/totalfreedom/datura/user/SimpleUserData.java @@ -27,6 +27,7 @@ public class SimpleUserData implements UserData private boolean canInteract; private boolean caged; private long balance; + private boolean transactionsFrozen; public SimpleUserData(final Player player) { @@ -44,7 +45,8 @@ public class SimpleUserData implements UserData final boolean frozen, final boolean canInteract, final boolean caged, - final long balance) + final long balance, + final boolean transactionsFrozen) { this.uuid = uuid; this.username = username; @@ -55,6 +57,7 @@ public class SimpleUserData implements UserData this.canInteract = canInteract; this.caged = caged; this.balance = balance; + this.transactionsFrozen = transactionsFrozen; } public static SimpleUserData fromSQL(SQL sql, String uuid) @@ -86,7 +89,8 @@ public class SimpleUserData implements UserData boolean canInteract = result.getBoolean("canInteract"); boolean caged = result.getBoolean("caged"); long balance = result.getLong("balance"); - return new SimpleUserData(u, username, user, group, playtime, frozen, canInteract, caged, balance); + boolean transactionsFrozen = result.getBoolean("transactionsFrozen"); + return new SimpleUserData(u, username, user, group, playtime, frozen, canInteract, caged, balance, transactionsFrozen); } } catch (SQLException ex) { @@ -202,6 +206,12 @@ public class SimpleUserData implements UserData this.caged = caged; } + @Override + public boolean areTransactionsFrozen() + { + return this.transactionsFrozen; + } + @Override public long getBalance() { diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java index 9546489..356daac 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/EconomicEntityData.java @@ -2,6 +2,8 @@ package me.totalfreedom.economy; public interface EconomicEntityData { + boolean areTransactionsFrozen(); + long getBalance(); void addToBalance(final long amount);