kolejne poprawki logów

This commit is contained in:
2025-11-02 03:26:46 +01:00
parent 55fcfb15eb
commit 2d5a48b426
7 changed files with 10 additions and 6 deletions

View File

@@ -38,7 +38,8 @@ public class GuiListener implements Listener {
if (price > 0) {
int balance = plugin.getCurrencyManager().getBalance(player);
if (balance >= price) {
plugin.getCurrencyManager().subtractBalance(player, price, "CONSOLE");
plugin.logToFile("[Purchase] Player: " + player.getName() + " purchased item: " + clickedItem.getType().toString() + " for " + price + ". Balance before: " + balance);
plugin.getCurrencyManager().subtractBalance(player, price, player.getName());
for (String command : commands) {
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), command.replace("%player%", player.getName()));
}

View File

@@ -28,9 +28,10 @@ public class CurrencyManager {
}
public void setBalance(UUID uuid, int amount, String actor) {
int balanceBefore = getBalance(uuid);
dataManager.getConfig().set("balances." + uuid.toString(), amount);
dataManager.saveConfig();
plugin.logToFile("[Currency] Actor: " + actor + " set balance of " + uuid.toString() + " to " + amount);
plugin.logToFile("[Currency] Actor: " + actor + " set balance of " + uuid.toString() + " to " + amount + ". Balance before: " + balanceBefore);
}
public void addBalance(Player player, int amount, String actor) {
@@ -38,8 +39,9 @@ public class CurrencyManager {
}
public void addBalance(UUID uuid, int amount, String actor) {
setBalance(uuid, getBalance(uuid) + amount, actor);
plugin.logToFile("[Currency] Actor: " + actor + " added " + amount + " to " + uuid.toString());
int balanceBefore = getBalance(uuid);
setBalance(uuid, balanceBefore + amount, actor);
plugin.logToFile("[Currency] Actor: " + actor + " added " + amount + " to " + uuid.toString() + ". Balance before: " + balanceBefore);
}
public void subtractBalance(Player player, int amount, String actor) {
@@ -47,7 +49,8 @@ public class CurrencyManager {
}
public void subtractBalance(UUID uuid, int amount, String actor) {
setBalance(uuid, getBalance(uuid) - amount, actor);
plugin.logToFile("[Currency] Actor: " + actor + " subtracted " + amount + " from " + uuid.toString());
int balanceBefore = getBalance(uuid);
setBalance(uuid, balanceBefore - amount, actor);
plugin.logToFile("[Currency] Actor: " + actor + " subtracted " + amount + " from " + uuid.toString() + ". Balance before: " + balanceBefore);
}
}