Added option to change Economy Manager

This commit is contained in:
Fabrizio La Rosa 2020-07-16 11:07:08 +02:00
parent e71c0ef4de
commit 933ec952aa
15 changed files with 149 additions and 77 deletions

View File

@ -7,7 +7,6 @@ import com.songoda.core.compatibility.ServerProject;
import com.songoda.core.compatibility.ServerVersion;
import com.songoda.core.configuration.Config;
import com.songoda.core.gui.GuiManager;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.skyblock.api.SkyBlockAPI;
import com.songoda.skyblock.ban.BanManager;
import com.songoda.skyblock.bank.BankManager;
@ -18,6 +17,7 @@ import com.songoda.skyblock.command.commands.SkyBlockCommand;
import com.songoda.skyblock.config.FileManager;
import com.songoda.skyblock.confirmation.ConfirmationTask;
import com.songoda.skyblock.cooldown.CooldownManager;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.generator.GeneratorManager;
import com.songoda.skyblock.invite.InviteManager;
import com.songoda.skyblock.island.IslandManager;
@ -77,6 +77,7 @@ public class SkyBlock extends SongodaPlugin {
private InviteManager inviteManager;
private BiomeManager biomeManager;
private IslandLevelManager levellingManager;
private com.songoda.skyblock.economy.EconomyManager economyManager;
private CommandManager commandManager;
private StructureManager structureManager;
private StackableManager stackableManager;
@ -131,7 +132,7 @@ public class SkyBlock extends SongodaPlugin {
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
// Load Economy
EconomyManager.load();
economyManager = new EconomyManager(this);
// Load Holograms
com.songoda.core.hooks.HologramManager.load(this);
@ -180,7 +181,7 @@ public class SkyBlock extends SongodaPlugin {
rewardManager = new RewardManager(this);
rewardManager.loadRewards();
bankManager = new BankManager();
bankManager = new BankManager(this);
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
@ -227,6 +228,18 @@ public class SkyBlock extends SongodaPlugin {
if (pluginManager.isPluginEnabled("Vault")) {
this.vaultPermission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
}
switch (fileManager.getConfig(new File(getDataFolder(), "config.yml")).getFileConfiguration().getString("Economy.Manager", "Default")) {
case "Vault":
getEconomyManager().setEconomy("Vault");
break;
case "PlayerPoints":
getEconomyManager().setEconomy("PlayerPoints");
break;
case "Reserve":
getEconomyManager().setEconomy("Reserve");
break;
}
this.coreProtectAPI = loadCoreProtect();
@ -454,4 +467,8 @@ public class SkyBlock extends SongodaPlugin {
public Permission getVaultPermission() {
return vaultPermission;
}
public EconomyManager getEconomyManager() {
return economyManager;
}
}

View File

@ -1,5 +1,6 @@
package com.songoda.skyblock.api.bank;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.bank.Transaction;
import org.bukkit.Bukkit;
@ -10,7 +11,7 @@ import java.util.UUID;
public class TransactionLog {
public BankManager getImplementation() {
return BankManager.getInstance();
return SkyBlock.getInstance().getBankManager();
}
public List<Transaction> getLogForPlayer(UUID uuid) {

View File

@ -1,8 +1,9 @@
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;
import com.songoda.skyblock.economy.EconomyManager;
import com.songoda.skyblock.island.Island;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
@ -11,16 +12,15 @@ import java.io.File;
import java.util.*;
public class BankManager {
private static BankManager instance;
public static BankManager getInstance() {return instance == null ? instance = new BankManager() : instance;}
private final HashMap<UUID, List<Transaction>> log;
private final SkyBlock plugin;
public FileConfiguration lang;
public BankManager() {
SkyBlock plugin = SkyBlock.getInstance();
public BankManager(SkyBlock plugin) {
this.plugin = plugin;
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
lang = config.getFileConfiguration();
log = new HashMap<>();
@ -76,14 +76,16 @@ public class BankManager {
}
public List<String> getBalanceLore(Player player) {
Economy economy = plugin.getEconomyManager().getEconomy();
List<String> result = new ArrayList<>();
result.add("Some error occurred while loading your balance!");
Island island = SkyBlock.getInstance().getIslandManager().getIsland(player);
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 "+EconomyManager.formatEconomy(EconomyManager.getBalance(player)));
result.add(player.getDisplayName()+"'s island has "+EconomyManager.formatEconomy(island.getBankBalance()));
result.add(player.getDisplayName()+"'s balance is "+economy.formatEconomy(economy.getBalance(player)));
result.add(player.getDisplayName()+"'s island has "+ economy.formatEconomy(island.getBankBalance()));
}
return result;
}
@ -97,7 +99,7 @@ public class BankManager {
}
public BankResponse deposit(Player player, Island island, double amt, boolean admin) {
SkyBlock plugin = SkyBlock.getInstance();
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager fileManager = plugin.getFileManager();
// Make sure the amount is positive
@ -114,11 +116,11 @@ public class BankManager {
}
if(!admin) {
if (!EconomyManager.hasBalance(player, amt)) {
if (!economy.hasBalance(player, amt)) {
return BankResponse.NOT_ENOUGH_MONEY;
}
EconomyManager.withdrawBalance(player, amt);
economy.withdrawBalance(player, amt);
}
island.addToBank(amt);
@ -133,7 +135,7 @@ public class BankManager {
}
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
SkyBlock plugin = SkyBlock.getInstance();
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager fileManager = plugin.getFileManager();
// Make sure the amount is positive
@ -153,8 +155,8 @@ public class BankManager {
if (amt > island.getBankBalance()) {
return BankResponse.NOT_ENOUGH_MONEY;
}
EconomyManager.deposit(player, amt);
economy.deposit(player, amt);
}
island.removeFromBank(amt);

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.challenge.challenge;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
import com.songoda.skyblock.island.Island;
@ -23,6 +23,7 @@ import java.util.List;
import java.util.regex.Pattern;
public class Challenge {
private final ChallengeCategory category;
private final int id;
private final String name;
@ -492,23 +493,26 @@ public class Challenge {
@Override
public boolean has(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
if (obj instanceof Number) {
return EconomyManager.getBalance(p) >= ((Number) obj).doubleValue();
return economy.getBalance(p) >= ((Number) obj).doubleValue();
}
return false;
}
@Override
public void executeRequire(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
EconomyManager.withdrawBalance(p, ((Number) obj).doubleValue());
economy.withdrawBalance(p, ((Number) obj).doubleValue());
}
}
@Override
public void executeReward(Player p, Object obj) {
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
EconomyManager.deposit(p, ((Number) obj).doubleValue());
economy.deposit(p, ((Number) obj).doubleValue());
}
}
},

View File

@ -1,7 +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;
import com.songoda.skyblock.gui.bank.GuiBank;
@ -29,6 +29,7 @@ public class AdminBank extends SubCommand {
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
SoundManager soundManager = plugin.getSoundManager();
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
@ -47,15 +48,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%", "" + EconomyManager.formatEconomy(EconomyManager.getBalance(Bukkit.getOfflinePlayer(island.getOwnerUUID())))));
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())))));
} else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.Balance.Message").replace("%player%", args[1]).replace("%bal%", "" + EconomyManager.formatEconomy(EconomyManager.getBalance(Bukkit.getOfflinePlayer(args[1])))));
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])))));
}
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByPlayer(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%",EconomyManager.formatEconomy(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]))));
}else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
@ -63,7 +64,7 @@ public class AdminBank extends SubCommand {
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByPlayer(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%",EconomyManager.formatEconomy(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]))));
}else {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
@ -101,6 +102,7 @@ public class AdminBank extends SubCommand {
MessageManager messageManager = plugin.getMessageManager();
IslandManager islandManager = plugin.getIslandManager();
FileManager fileManager = plugin.getFileManager();
Economy economy = plugin.getEconomyManager().getEconomy();
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
@ -111,12 +113,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%",""+ EconomyManager.formatEconomy(EconomyManager.getBalance(Bukkit.getOfflinePlayer(args[1])))));
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])))));
return;
case "deposit":
if (args.length >= 3) {
islandManager.getIslandByPlayer(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%",EconomyManager.formatEconomy(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]))));
}else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}
@ -124,7 +126,7 @@ public class AdminBank extends SubCommand {
case "withdraw":
if (args.length >= 3) {
islandManager.getIslandByPlayer(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%",EconomyManager.formatEconomy(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]))));
}else {
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
}

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.command.commands.island;
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;
import com.songoda.skyblock.config.FileManager.Config;
@ -39,6 +39,7 @@ public class ConfirmCommand extends SubCommand {
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
Economy economy = plugin.getEconomyManager().getEconomy();
if (playerDataManager.hasPlayerData(player)) {
PlayerData playerData = playerDataManager.getPlayerData(player);
@ -127,15 +128,15 @@ public class ConfirmCommand extends SubCommand {
return;
}
if (EconomyManager.isEnabled() && island.getStructure() != null
if (economy.isEnabled() && island.getStructure() != null
&& !island.getStructure().isEmpty()
&& structureManager.containsStructure(island.getStructure())) {
Structure structure = structureManager.getStructure(island.getStructure());
double deletionCost = structure.getDeletionCost();
if (deletionCost != 0.0D) {
if (EconomyManager.hasBalance(player, deletionCost)) {
EconomyManager.withdrawBalance(player, deletionCost);
if (economy.hasBalance(player, deletionCost)) {
economy.withdrawBalance(player, deletionCost);
} else {
messageManager.sendMessage(player,
configLoad.getString(

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.command.commands.island;
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;
import com.songoda.skyblock.config.FileManager.Config;
@ -26,6 +26,7 @@ public class UnlockCommand extends SubCommand {
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
Economy economy = plugin.getEconomyManager().getEconomy();
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
@ -68,7 +69,7 @@ public class UnlockCommand extends SubCommand {
double price = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
.getFileConfiguration().getDouble("Island.World." + islandWorld.name() + ".UnlockPrice");
if (!EconomyManager.hasBalance(player, price)) {
if (!economy.hasBalance(player, price)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Money.Message").replace(
"%cost%", NumberUtil.formatNumberByDecimal(price)));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
@ -76,7 +77,7 @@ public class UnlockCommand extends SubCommand {
}
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, price);
economy.withdrawBalance(player, price);
islandManager.unlockIslandWorld(island, islandWorld);

View File

@ -1,7 +1,7 @@
package com.songoda.skyblock.command.commands.island;
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.Config;
import com.songoda.skyblock.menus.Upgrade;
@ -19,6 +19,7 @@ public class UpgradeCommand extends SubCommand {
public void onCommandByPlayer(Player player, String[] args) {
MessageManager messageManager = plugin.getMessageManager();
SoundManager soundManager = plugin.getSoundManager();
Economy economy = plugin.getEconomyManager().getEconomy();
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
FileConfiguration configLoad = config.getFileConfiguration();
@ -28,7 +29,7 @@ public class UpgradeCommand extends SubCommand {
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
} else {
if (!EconomyManager.isEnabled()) {
if (!economy.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
return;

View File

@ -0,0 +1,37 @@
package com.songoda.skyblock.economy;
import com.songoda.core.hooks.Hook;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.manager.Manager;
import org.bukkit.Bukkit;
import java.util.Arrays;
public class EconomyManager extends Manager {
private Economy economy;
public EconomyManager(SkyBlock plugin) {
super(plugin);
com.songoda.core.hooks.EconomyManager.load();
economy = com.songoda.core.hooks.EconomyManager.getEconomy();
}
public boolean setEconomy(String economyString) {
Hook hook = com.songoda.core.hooks.EconomyManager.getManager().getHook(economyString);
if(hook != null &&
hook.isEnabled() &&
hook instanceof Economy &&
!hook.equals(com.songoda.core.hooks.EconomyManager.getManager().getCurrentHook())) {
this.economy = (Economy) hook;
return true;
}
return false;
}
public Economy getEconomy() {
return this.economy;
}
}

View File

@ -5,7 +5,7 @@ import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.gui.AnvilGui;
import com.songoda.core.gui.Gui;
import com.songoda.core.gui.GuiUtils;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.core.utils.TextUtils;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.bank.BankManager;
@ -50,6 +50,7 @@ public class GuiBankSelector extends Gui {
}
public void paint() {
Economy economy = plugin.getEconomyManager().getEconomy();
if (inventory != null)
inventory.clear();
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
@ -90,7 +91,7 @@ public class GuiBankSelector extends Gui {
switch(type){
case DEPOSIT:
amount = EconomyManager.getBalance(event.player);
amount = economy.getBalance(event.player);
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
amount = Math.floor(amount);
}

View File

@ -1,6 +1,6 @@
package com.songoda.skyblock.island.reward;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.island.Island;
import org.bukkit.entity.Player;
@ -20,6 +20,7 @@ public class LevelReward {
}
public void give(Player player, SkyBlock plugin, long level) {
Economy economy = plugin.getEconomyManager().getEconomy();
if (islandBalance > 0) {
Island island = plugin.getIslandManager().getIsland(player);
@ -27,7 +28,7 @@ public class LevelReward {
}
if (money > 0)
EconomyManager.deposit(player, money);
economy.deposit(player, money);
if (!commands.isEmpty()) {
for (String cmd : commands) {

View File

@ -2,7 +2,7 @@ package com.songoda.skyblock.menus;
import com.songoda.core.compatibility.CompatibleMaterial;
import com.songoda.core.compatibility.CompatibleSound;
import com.songoda.core.hooks.EconomyManager;
import com.songoda.core.hooks.economies.Economy;
import com.songoda.skyblock.SkyBlock;
import com.songoda.skyblock.api.event.island.IslandUpgradeEvent;
import com.songoda.skyblock.api.utils.APIUtil;
@ -55,11 +55,12 @@ public class Upgrade {
IslandManager islandManager = plugin.getIslandManager();
SoundManager soundManager = plugin.getSoundManager();
FileManager fileManager = plugin.getFileManager();
Economy economy = plugin.getEconomyManager().getEconomy();
FileConfiguration configLoad = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"))
.getFileConfiguration();
if (!EconomyManager.isEnabled()) {
if (!economy.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
@ -70,7 +71,7 @@ public class Upgrade {
Island island = islandManager.getIsland(player);
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
if (!EconomyManager.isEnabled()) {
if (!economy.isEnabled()) {
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
@ -116,13 +117,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player,
com.songoda.skyblock.upgrade.Upgrade.Type.Speed, true);
@ -171,13 +172,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Jump,
true);
@ -221,13 +222,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Crop,
true);
@ -272,13 +273,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Fly,
true);
@ -324,13 +325,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Drops,
true);
@ -368,14 +369,14 @@ public class Upgrade {
.replace("%tier", "" + tier)))) {
if (upgrade.getValue() > island.getMaxMembers()
&& upgrade.getValue() != island.getMaxMembers()) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message").replace(
"%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setMaxMembers(upgrade.getValue());
Bukkit.getServer().getPluginManager().callEvent(new IslandUpgradeEvent(
@ -421,14 +422,14 @@ public class Upgrade {
.replace("%tier", "" + tier)))) {
if (upgrade.getValue() > island.getSize()
&& upgrade.getValue() != island.getSize()) {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message").replace(
"%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setSize(upgrade.getValue());
islandManager.updateBorder(island);
@ -482,13 +483,13 @@ public class Upgrade {
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
messageManager.sendMessage(player,
configLoad.getString("Island.Upgrade.Bought.Message")
.replace("%upgrade", is.getItemMeta().getDisplayName()));
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
EconomyManager.withdrawBalance(player, upgrade.getCost());
economy.withdrawBalance(player, upgrade.getCost());
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner,
true);
@ -551,7 +552,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Speed))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
@ -604,7 +605,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Jump))},
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(potion,
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
@ -642,7 +643,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Crop))},
null, null), 3);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
@ -680,7 +681,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Fly))},
null, null), 4);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
@ -718,7 +719,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Drops))},
null, null), 5);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
@ -765,7 +766,7 @@ public class Upgrade {
new Placeholder("%maxMembers", "" + upgrade.getValue())},
null, null), 6);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(
nInv.createItem(new ItemStack(Material.BOOKSHELF),
ChatColor.translateAlternateColorCodes('&',
@ -827,7 +828,7 @@ public class Upgrade {
new Placeholder("%size", "" + upgrade.getValue())},
null, null), 7);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(
nInv.createItem(new ItemStack(Material.BEACON),
ChatColor.translateAlternateColorCodes('&',
@ -880,7 +881,7 @@ public class Upgrade {
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner))},
null, null), 8);
} else {
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
if (economy.hasBalance(player, upgrade.getCost())) {
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
ChatColor.translateAlternateColorCodes('&',
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),

View File

@ -282,7 +282,7 @@ public class PlayerData {
}
public synchronized void save() {
transactions = BankManager.getInstance().getTransactionList(getPlayerUUID());
transactions = plugin.getBankManager().getTransactionList(getPlayerUUID());
Config config = getConfig();
FileConfiguration configLoad = config.getFileConfiguration();
configLoad.set("Statistics.Island.Playtime", getPlaytime());

View File

@ -8,6 +8,9 @@ Command:
Sound:
# When disabled all sounds will be disabled.
Enable: true
Economy:
# Possible managers: Default, Vault, PlayerPoints and Reserve
Manager: Default
Island:
Performance:
# Chunk loading per tick affecting operations like island deletion, scan and biome changing.

View File

@ -5,8 +5,8 @@ api-version: 1.13
description: A unique SkyBlock plugin
author: Songoda
authors: [Fabrimat]
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads,
EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector]
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, PlayerPoints,
LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector]
loadbefore: [Multiverse-Core, ProtocolLib]
commands:
island: