Modified to support the new SongodaCore EconomyManager.

This commit is contained in:
Brianna 2020-09-18 17:43:26 -05:00
parent b2f570cd5d
commit 64f1e5d7a3
2 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.bank; package com.songoda.skyblock.bank;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy; import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock; import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
@ -73,7 +74,7 @@ public class BankManager {
} }
} }
public List<String> getBalanceLore(Player player) { public List<String> getBalanceLore(Player player) {;
Economy economy = plugin.getEconomyManager().getEconomy(); Economy economy = plugin.getEconomyManager().getEconomy();
List<String> result = new ArrayList<>(); List<String> 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()); result.add("If this is null then its a easy to fix bug: "+island.toString());
if (island != null) { if (island != null) {
result.clear(); result.clear();
result.add(player.getDisplayName()+"'s balance is "+economy.formatEconomy(economy.getBalance(player))); result.add(player.getDisplayName()+"'s balance is "+ EconomyManager.formatEconomy(economy.getBalance(player)));
result.add(player.getDisplayName()+"'s island has "+ economy.formatEconomy(island.getBankBalance())); result.add(player.getDisplayName()+"'s island has "+ EconomyManager.formatEconomy(island.getBankBalance()));
} }
return result; return result;
} }

View File

@ -1,6 +1,7 @@
package com.songoda.skyblock.command.commands.admin; package com.songoda.skyblock.command.commands.admin;
import com.songoda.core.compatibility.CompatibleSound; import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy; import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.command.SubCommand; import com.songoda.skyblock.command.SubCommand;
import com.songoda.skyblock.config.FileManager; import com.songoda.skyblock.config.FileManager;
@ -53,15 +54,15 @@ public class AdminBank extends SubCommand {
switch (args[0].toLowerCase()) { switch (args[0].toLowerCase()) {
case "balance": case "balance":
if (args.length >= 3) { 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 { } 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; return;
case "deposit": case "deposit":
if (args.length >= 3) { if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2])); 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 { }else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
} }
@ -69,7 +70,7 @@ public class AdminBank extends SubCommand {
case "withdraw": case "withdraw":
if (args.length >= 3) { if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2])); 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 { }else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
} }
@ -118,12 +119,12 @@ public class AdminBank extends SubCommand {
} }
switch (args[0]) { switch (args[0]) {
case "balance": 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; return;
case "deposit": case "deposit":
if (args.length >= 3) { if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2])); 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 { }else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
} }
@ -131,7 +132,7 @@ public class AdminBank extends SubCommand {
case "withdraw": case "withdraw":
if (args.length >= 3) { if (args.length >= 3) {
islandManager.getIslandByOwner(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2])); 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 { }else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message")); messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
} }