From 042960473754a19352547699352a654b0b2e7dbc Mon Sep 17 00:00:00 2001 From: Allink Date: Sat, 20 May 2023 05:55:26 +0100 Subject: [PATCH] Add method for directly setting a transaction's balance --- .../me/totalfreedom/fossil/economy/SimpleTransaction.java | 6 ++++++ .../src/main/java/me/totalfreedom/economy/Transaction.java | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java index 0e1ea2c..8fb9b8c 100644 --- a/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java +++ b/Fossil/src/main/java/me/totalfreedom/fossil/economy/SimpleTransaction.java @@ -53,4 +53,10 @@ public class SimpleTransaction implements Transaction { return this.addBalance(-amount); } + + @Override + public void setBalance(long newBalance) + { + balance.set(newBalance); + } } diff --git a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java index bcafa51..fc094cc 100644 --- a/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java +++ b/Patchwork/src/main/java/me/totalfreedom/economy/Transaction.java @@ -13,4 +13,6 @@ public interface Transaction long addBalance(final long amount); long removeBalance(final long amount); + + void setBalance(final long newBalance); }