From 64f1e5d7a3136950302430ba229da8bae6031fb8 Mon Sep 17 00:00:00 2001 From: Brianna Date: Fri, 18 Sep 2020 17:43:26 -0500 Subject: [PATCH] Modified to support the new SongodaCore EconomyManager. --- .../com/songoda/skyblock/bank/BankManager.java | 7 ++++--- .../command/commands/admin/AdminBank.java | 15 ++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/songoda/skyblock/bank/BankManager.java b/src/main/java/com/songoda/skyblock/bank/BankManager.java index a2687c18..c682cbc1 100644 --- a/src/main/java/com/songoda/skyblock/bank/BankManager.java +++ b/src/main/java/com/songoda/skyblock/bank/BankManager.java @@ -1,5 +1,6 @@ package com.songoda.skyblock.bank; +import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.economies.Economy; import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.config.FileManager; @@ -73,7 +74,7 @@ public class BankManager { } } - public List getBalanceLore(Player player) { + public List getBalanceLore(Player player) {; Economy economy = plugin.getEconomyManager().getEconomy(); List result = new ArrayList<>(); @@ -82,8 +83,8 @@ public class BankManager { result.add("If this is null then its a easy to fix bug: "+island.toString()); if (island != null) { result.clear(); - result.add(player.getDisplayName()+"'s balance is "+economy.formatEconomy(economy.getBalance(player))); - result.add(player.getDisplayName()+"'s island has "+ economy.formatEconomy(island.getBankBalance())); + result.add(player.getDisplayName()+"'s balance is "+ EconomyManager.formatEconomy(economy.getBalance(player))); + result.add(player.getDisplayName()+"'s island has "+ EconomyManager.formatEconomy(island.getBankBalance())); } return result; } diff --git a/src/main/java/com/songoda/skyblock/command/commands/admin/AdminBank.java b/src/main/java/com/songoda/skyblock/command/commands/admin/AdminBank.java index e5914acf..10806f83 100644 --- a/src/main/java/com/songoda/skyblock/command/commands/admin/AdminBank.java +++ b/src/main/java/com/songoda/skyblock/command/commands/admin/AdminBank.java @@ -1,6 +1,7 @@ package com.songoda.skyblock.command.commands.admin; import com.songoda.core.compatibility.CompatibleSound; +import com.songoda.core.hooks.EconomyManager; import com.songoda.core.hooks.economies.Economy; import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.config.FileManager; @@ -53,15 +54,15 @@ public class AdminBank extends SubCommand { switch (args[0].toLowerCase()) { case "balance": if (args.length >= 3) { - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + economy.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(island.getOwnerUUID()))))); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(island.getOwnerUUID()))))); } else { - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + economy.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1]))))); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1]))))); } return; case "deposit": if (args.length >= 3) { islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2])); - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2])))); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2])))); }else { messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); } @@ -69,7 +70,7 @@ public class AdminBank extends SubCommand { case "withdraw": if (args.length >= 3) { islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2])); - messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2])))); + messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2])))); }else { messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); } @@ -118,12 +119,12 @@ public class AdminBank extends SubCommand { } switch (args[0]) { case "balance": - messageManager.sendMessage(sender,configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%",args[1]).replace("%bal%",""+ economy.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1]))))); + messageManager.sendMessage(sender,configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%",args[1]).replace("%bal%",""+ EconomyManager.formatEconomy(economy.getBalance(Bukkit.getOfflinePlayer(args[1]))))); return; case "deposit": if (args.length >= 3) { islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2])); - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2])))); + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesDeposit.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2])))); }else { messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); } @@ -131,7 +132,7 @@ public class AdminBank extends SubCommand { case "withdraw": if (args.length >= 3) { islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2])); - messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",economy.formatEconomy(Double.parseDouble(args[2])))); + messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.SuccesWithdraw.Message").replace("%player%",args[1]).replace("%ammount%",EconomyManager.formatEconomy(Double.parseDouble(args[2])))); }else { messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); }