mirror of
https://github.com/songoda/FabledSkyBlock.git
synced 2024-11-26 20:26:34 +01:00
Added option to change Economy Manager
This commit is contained in:
parent
e71c0ef4de
commit
933ec952aa
@ -7,7 +7,6 @@ import com.songoda.core.compatibility.ServerProject;
|
|||||||
import com.songoda.core.compatibility.ServerVersion;
|
import com.songoda.core.compatibility.ServerVersion;
|
||||||
import com.songoda.core.configuration.Config;
|
import com.songoda.core.configuration.Config;
|
||||||
import com.songoda.core.gui.GuiManager;
|
import com.songoda.core.gui.GuiManager;
|
||||||
import com.songoda.core.hooks.EconomyManager;
|
|
||||||
import com.songoda.skyblock.api.SkyBlockAPI;
|
import com.songoda.skyblock.api.SkyBlockAPI;
|
||||||
import com.songoda.skyblock.ban.BanManager;
|
import com.songoda.skyblock.ban.BanManager;
|
||||||
import com.songoda.skyblock.bank.BankManager;
|
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.config.FileManager;
|
||||||
import com.songoda.skyblock.confirmation.ConfirmationTask;
|
import com.songoda.skyblock.confirmation.ConfirmationTask;
|
||||||
import com.songoda.skyblock.cooldown.CooldownManager;
|
import com.songoda.skyblock.cooldown.CooldownManager;
|
||||||
|
import com.songoda.skyblock.economy.EconomyManager;
|
||||||
import com.songoda.skyblock.generator.GeneratorManager;
|
import com.songoda.skyblock.generator.GeneratorManager;
|
||||||
import com.songoda.skyblock.invite.InviteManager;
|
import com.songoda.skyblock.invite.InviteManager;
|
||||||
import com.songoda.skyblock.island.IslandManager;
|
import com.songoda.skyblock.island.IslandManager;
|
||||||
@ -77,6 +77,7 @@ public class SkyBlock extends SongodaPlugin {
|
|||||||
private InviteManager inviteManager;
|
private InviteManager inviteManager;
|
||||||
private BiomeManager biomeManager;
|
private BiomeManager biomeManager;
|
||||||
private IslandLevelManager levellingManager;
|
private IslandLevelManager levellingManager;
|
||||||
|
private com.songoda.skyblock.economy.EconomyManager economyManager;
|
||||||
private CommandManager commandManager;
|
private CommandManager commandManager;
|
||||||
private StructureManager structureManager;
|
private StructureManager structureManager;
|
||||||
private StackableManager stackableManager;
|
private StackableManager stackableManager;
|
||||||
@ -131,7 +132,7 @@ public class SkyBlock extends SongodaPlugin {
|
|||||||
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
|
SongodaCore.registerPlugin(this, 17, CompatibleMaterial.GRASS_BLOCK);
|
||||||
|
|
||||||
// Load Economy
|
// Load Economy
|
||||||
EconomyManager.load();
|
economyManager = new EconomyManager(this);
|
||||||
|
|
||||||
// Load Holograms
|
// Load Holograms
|
||||||
com.songoda.core.hooks.HologramManager.load(this);
|
com.songoda.core.hooks.HologramManager.load(this);
|
||||||
@ -180,7 +181,7 @@ public class SkyBlock extends SongodaPlugin {
|
|||||||
rewardManager = new RewardManager(this);
|
rewardManager = new RewardManager(this);
|
||||||
rewardManager.loadRewards();
|
rewardManager.loadRewards();
|
||||||
|
|
||||||
bankManager = new BankManager();
|
bankManager = new BankManager(this);
|
||||||
|
|
||||||
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
|
new PlaytimeTask(playerDataManager, islandManager).runTaskTimerAsynchronously(this, 0L, 20L);
|
||||||
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
|
new VisitTask(playerDataManager).runTaskTimerAsynchronously(this, 0L, 20L);
|
||||||
@ -228,6 +229,18 @@ public class SkyBlock extends SongodaPlugin {
|
|||||||
this.vaultPermission = getServer().getServicesManager().getRegistration(Permission.class).getProvider();
|
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();
|
this.coreProtectAPI = loadCoreProtect();
|
||||||
|
|
||||||
SkyBlockAPI.setImplementation(INSTANCE);
|
SkyBlockAPI.setImplementation(INSTANCE);
|
||||||
@ -454,4 +467,8 @@ public class SkyBlock extends SongodaPlugin {
|
|||||||
public Permission getVaultPermission() {
|
public Permission getVaultPermission() {
|
||||||
return vaultPermission;
|
return vaultPermission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EconomyManager getEconomyManager() {
|
||||||
|
return economyManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.songoda.skyblock.api.bank;
|
package com.songoda.skyblock.api.bank;
|
||||||
|
|
||||||
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.bank.BankManager;
|
import com.songoda.skyblock.bank.BankManager;
|
||||||
import com.songoda.skyblock.bank.Transaction;
|
import com.songoda.skyblock.bank.Transaction;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -10,7 +11,7 @@ import java.util.UUID;
|
|||||||
public class TransactionLog {
|
public class TransactionLog {
|
||||||
|
|
||||||
public BankManager getImplementation() {
|
public BankManager getImplementation() {
|
||||||
return BankManager.getInstance();
|
return SkyBlock.getInstance().getBankManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Transaction> getLogForPlayer(UUID uuid) {
|
public List<Transaction> getLogForPlayer(UUID uuid) {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
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.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
|
import com.songoda.skyblock.economy.EconomyManager;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -11,16 +12,15 @@ import java.io.File;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class BankManager {
|
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 HashMap<UUID, List<Transaction>> log;
|
||||||
|
|
||||||
|
private final SkyBlock plugin;
|
||||||
|
|
||||||
public FileConfiguration lang;
|
public FileConfiguration lang;
|
||||||
|
|
||||||
public BankManager() {
|
public BankManager(SkyBlock plugin) {
|
||||||
SkyBlock plugin = SkyBlock.getInstance();
|
this.plugin = plugin;
|
||||||
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
FileManager.Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
lang = config.getFileConfiguration();
|
lang = config.getFileConfiguration();
|
||||||
log = new HashMap<>();
|
log = new HashMap<>();
|
||||||
@ -76,14 +76,16 @@ public class BankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getBalanceLore(Player player) {
|
public List<String> getBalanceLore(Player player) {
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
result.add("Some error occurred while loading your balance!");
|
result.add("Some error occurred while loading your balance!");
|
||||||
Island island = SkyBlock.getInstance().getIslandManager().getIsland(player);
|
Island island = SkyBlock.getInstance().getIslandManager().getIsland(player);
|
||||||
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 "+EconomyManager.formatEconomy(EconomyManager.getBalance(player)));
|
result.add(player.getDisplayName()+"'s balance is "+economy.formatEconomy(economy.getBalance(player)));
|
||||||
result.add(player.getDisplayName()+"'s island has "+EconomyManager.formatEconomy(island.getBankBalance()));
|
result.add(player.getDisplayName()+"'s island has "+ economy.formatEconomy(island.getBankBalance()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -97,7 +99,7 @@ public class BankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BankResponse deposit(Player player, Island island, double amt, boolean admin) {
|
public BankResponse deposit(Player player, Island island, double amt, boolean admin) {
|
||||||
SkyBlock plugin = SkyBlock.getInstance();
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
|
||||||
// Make sure the amount is positive
|
// Make sure the amount is positive
|
||||||
@ -114,11 +116,11 @@ public class BankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!admin) {
|
if(!admin) {
|
||||||
if (!EconomyManager.hasBalance(player, amt)) {
|
if (!economy.hasBalance(player, amt)) {
|
||||||
return BankResponse.NOT_ENOUGH_MONEY;
|
return BankResponse.NOT_ENOUGH_MONEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
EconomyManager.withdrawBalance(player, amt);
|
economy.withdrawBalance(player, amt);
|
||||||
}
|
}
|
||||||
|
|
||||||
island.addToBank(amt);
|
island.addToBank(amt);
|
||||||
@ -133,7 +135,7 @@ public class BankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
|
public BankResponse withdraw(Player player, Island island, double amt, boolean admin) {
|
||||||
SkyBlock plugin = SkyBlock.getInstance();
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
|
||||||
// Make sure the amount is positive
|
// Make sure the amount is positive
|
||||||
@ -154,7 +156,7 @@ public class BankManager {
|
|||||||
return BankResponse.NOT_ENOUGH_MONEY;
|
return BankResponse.NOT_ENOUGH_MONEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
EconomyManager.deposit(player, amt);
|
economy.deposit(player, amt);
|
||||||
}
|
}
|
||||||
|
|
||||||
island.removeFromBank(amt);
|
island.removeFromBank(amt);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.skyblock.challenge.challenge;
|
package com.songoda.skyblock.challenge.challenge;
|
||||||
|
|
||||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
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.SkyBlock;
|
||||||
import com.songoda.skyblock.bank.BankManager;
|
import com.songoda.skyblock.bank.BankManager;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Challenge {
|
public class Challenge {
|
||||||
|
|
||||||
private final ChallengeCategory category;
|
private final ChallengeCategory category;
|
||||||
private final int id;
|
private final int id;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -492,23 +493,26 @@ public class Challenge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(Player p, Object obj) {
|
public boolean has(Player p, Object obj) {
|
||||||
|
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
|
||||||
if (obj instanceof Number) {
|
if (obj instanceof Number) {
|
||||||
return EconomyManager.getBalance(p) >= ((Number) obj).doubleValue();
|
return economy.getBalance(p) >= ((Number) obj).doubleValue();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeRequire(Player p, Object obj) {
|
public void executeRequire(Player p, Object obj) {
|
||||||
|
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
|
||||||
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
|
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
|
||||||
EconomyManager.withdrawBalance(p, ((Number) obj).doubleValue());
|
economy.withdrawBalance(p, ((Number) obj).doubleValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeReward(Player p, Object obj) {
|
public void executeReward(Player p, Object obj) {
|
||||||
|
Economy economy = SkyBlock.getInstance().getEconomyManager().getEconomy();
|
||||||
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
|
if (obj instanceof Number && ((Number) obj).doubleValue() > 0) {
|
||||||
EconomyManager.deposit(p, ((Number) obj).doubleValue());
|
economy.deposit(p, ((Number) obj).doubleValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,7 +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.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
import com.songoda.skyblock.gui.bank.GuiBank;
|
import com.songoda.skyblock.gui.bank.GuiBank;
|
||||||
@ -29,6 +29,7 @@ public class AdminBank extends SubCommand {
|
|||||||
IslandManager islandManager = plugin.getIslandManager();
|
IslandManager islandManager = plugin.getIslandManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
SoundManager soundManager = plugin.getSoundManager();
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
@ -47,15 +48,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%", "" + 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 {
|
} 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;
|
return;
|
||||||
case "deposit":
|
case "deposit":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
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 {
|
}else {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
}
|
}
|
||||||
@ -63,7 +64,7 @@ public class AdminBank extends SubCommand {
|
|||||||
case "withdraw":
|
case "withdraw":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
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 {
|
}else {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
}
|
}
|
||||||
@ -101,6 +102,7 @@ public class AdminBank extends SubCommand {
|
|||||||
MessageManager messageManager = plugin.getMessageManager();
|
MessageManager messageManager = plugin.getMessageManager();
|
||||||
IslandManager islandManager = plugin.getIslandManager();
|
IslandManager islandManager = plugin.getIslandManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
FileManager.Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
@ -111,12 +113,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%",""+ 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;
|
return;
|
||||||
case "deposit":
|
case "deposit":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).addToBank(Double.parseDouble(args[2]));
|
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 {
|
}else {
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
}
|
}
|
||||||
@ -124,7 +126,7 @@ public class AdminBank extends SubCommand {
|
|||||||
case "withdraw":
|
case "withdraw":
|
||||||
if (args.length >= 3) {
|
if (args.length >= 3) {
|
||||||
islandManager.getIslandByPlayer(Bukkit.getOfflinePlayer(Bukkit.getPlayer(args[1]).getUniqueId())).removeFromBank(Double.parseDouble(args[2]));
|
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 {
|
}else {
|
||||||
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
messageManager.sendMessage(sender, configLoad.getString("Command.Island.Admin.Bank.ByConsole.Message"));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.skyblock.command.commands.island;
|
package com.songoda.skyblock.command.commands.island;
|
||||||
|
|
||||||
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.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
@ -39,6 +39,7 @@ public class ConfirmCommand extends SubCommand {
|
|||||||
IslandManager islandManager = plugin.getIslandManager();
|
IslandManager islandManager = plugin.getIslandManager();
|
||||||
SoundManager soundManager = plugin.getSoundManager();
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
if (playerDataManager.hasPlayerData(player)) {
|
if (playerDataManager.hasPlayerData(player)) {
|
||||||
PlayerData playerData = playerDataManager.getPlayerData(player);
|
PlayerData playerData = playerDataManager.getPlayerData(player);
|
||||||
@ -127,15 +128,15 @@ public class ConfirmCommand extends SubCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EconomyManager.isEnabled() && island.getStructure() != null
|
if (economy.isEnabled() && island.getStructure() != null
|
||||||
&& !island.getStructure().isEmpty()
|
&& !island.getStructure().isEmpty()
|
||||||
&& structureManager.containsStructure(island.getStructure())) {
|
&& structureManager.containsStructure(island.getStructure())) {
|
||||||
Structure structure = structureManager.getStructure(island.getStructure());
|
Structure structure = structureManager.getStructure(island.getStructure());
|
||||||
double deletionCost = structure.getDeletionCost();
|
double deletionCost = structure.getDeletionCost();
|
||||||
|
|
||||||
if (deletionCost != 0.0D) {
|
if (deletionCost != 0.0D) {
|
||||||
if (EconomyManager.hasBalance(player, deletionCost)) {
|
if (economy.hasBalance(player, deletionCost)) {
|
||||||
EconomyManager.withdrawBalance(player, deletionCost);
|
economy.withdrawBalance(player, deletionCost);
|
||||||
} else {
|
} else {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString(
|
configLoad.getString(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.skyblock.command.commands.island;
|
package com.songoda.skyblock.command.commands.island;
|
||||||
|
|
||||||
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.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager;
|
import com.songoda.skyblock.config.FileManager;
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
@ -26,6 +26,7 @@ public class UnlockCommand extends SubCommand {
|
|||||||
IslandManager islandManager = plugin.getIslandManager();
|
IslandManager islandManager = plugin.getIslandManager();
|
||||||
SoundManager soundManager = plugin.getSoundManager();
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
Config config = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
@ -68,7 +69,7 @@ public class UnlockCommand extends SubCommand {
|
|||||||
double price = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
double price = fileManager.getConfig(new File(plugin.getDataFolder(), "config.yml"))
|
||||||
.getFileConfiguration().getDouble("Island.World." + islandWorld.name() + ".UnlockPrice");
|
.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(
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Unlock.Money.Message").replace(
|
||||||
"%cost%", NumberUtil.formatNumberByDecimal(price)));
|
"%cost%", NumberUtil.formatNumberByDecimal(price)));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
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);
|
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
||||||
EconomyManager.withdrawBalance(player, price);
|
economy.withdrawBalance(player, price);
|
||||||
|
|
||||||
islandManager.unlockIslandWorld(island, islandWorld);
|
islandManager.unlockIslandWorld(island, islandWorld);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.songoda.skyblock.command.commands.island;
|
package com.songoda.skyblock.command.commands.island;
|
||||||
|
|
||||||
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.skyblock.command.SubCommand;
|
import com.songoda.skyblock.command.SubCommand;
|
||||||
import com.songoda.skyblock.config.FileManager.Config;
|
import com.songoda.skyblock.config.FileManager.Config;
|
||||||
import com.songoda.skyblock.menus.Upgrade;
|
import com.songoda.skyblock.menus.Upgrade;
|
||||||
@ -19,6 +19,7 @@ public class UpgradeCommand extends SubCommand {
|
|||||||
public void onCommandByPlayer(Player player, String[] args) {
|
public void onCommandByPlayer(Player player, String[] args) {
|
||||||
MessageManager messageManager = plugin.getMessageManager();
|
MessageManager messageManager = plugin.getMessageManager();
|
||||||
SoundManager soundManager = plugin.getSoundManager();
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
Config config = plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "language.yml"));
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
@ -28,7 +29,7 @@ public class UpgradeCommand extends SubCommand {
|
|||||||
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
|
configLoad.getString("Command.Island.Upgrade.Owner.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
if (!EconomyManager.isEnabled()) {
|
if (!economy.isEnabled()) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Command.Island.Upgrade.Disabled.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,7 +5,7 @@ import com.songoda.core.compatibility.CompatibleSound;
|
|||||||
import com.songoda.core.gui.AnvilGui;
|
import com.songoda.core.gui.AnvilGui;
|
||||||
import com.songoda.core.gui.Gui;
|
import com.songoda.core.gui.Gui;
|
||||||
import com.songoda.core.gui.GuiUtils;
|
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.core.utils.TextUtils;
|
||||||
import com.songoda.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.bank.BankManager;
|
import com.songoda.skyblock.bank.BankManager;
|
||||||
@ -50,6 +50,7 @@ public class GuiBankSelector extends Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void paint() {
|
public void paint() {
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
if (inventory != null)
|
if (inventory != null)
|
||||||
inventory.clear();
|
inventory.clear();
|
||||||
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
|
setDefaultItem(CompatibleMaterial.BLACK_STAINED_GLASS_PANE.getItem());
|
||||||
@ -90,7 +91,7 @@ public class GuiBankSelector extends Gui {
|
|||||||
|
|
||||||
switch(type){
|
switch(type){
|
||||||
case DEPOSIT:
|
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")) {
|
if (!plugin.getFileManager().getConfig(new File(plugin.getDataFolder(), "config.yml")).getFileConfiguration().getBoolean("Island.Bank.AllowDecimals")) {
|
||||||
amount = Math.floor(amount);
|
amount = Math.floor(amount);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.songoda.skyblock.island.reward;
|
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.SkyBlock;
|
||||||
import com.songoda.skyblock.island.Island;
|
import com.songoda.skyblock.island.Island;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -20,6 +20,7 @@ public class LevelReward {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void give(Player player, SkyBlock plugin, long level) {
|
public void give(Player player, SkyBlock plugin, long level) {
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
if (islandBalance > 0) {
|
if (islandBalance > 0) {
|
||||||
Island island = plugin.getIslandManager().getIsland(player);
|
Island island = plugin.getIslandManager().getIsland(player);
|
||||||
@ -27,7 +28,7 @@ public class LevelReward {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (money > 0)
|
if (money > 0)
|
||||||
EconomyManager.deposit(player, money);
|
economy.deposit(player, money);
|
||||||
|
|
||||||
if (!commands.isEmpty()) {
|
if (!commands.isEmpty()) {
|
||||||
for (String cmd : commands) {
|
for (String cmd : commands) {
|
||||||
|
@ -2,7 +2,7 @@ package com.songoda.skyblock.menus;
|
|||||||
|
|
||||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||||
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.skyblock.SkyBlock;
|
import com.songoda.skyblock.SkyBlock;
|
||||||
import com.songoda.skyblock.api.event.island.IslandUpgradeEvent;
|
import com.songoda.skyblock.api.event.island.IslandUpgradeEvent;
|
||||||
import com.songoda.skyblock.api.utils.APIUtil;
|
import com.songoda.skyblock.api.utils.APIUtil;
|
||||||
@ -55,11 +55,12 @@ public class Upgrade {
|
|||||||
IslandManager islandManager = plugin.getIslandManager();
|
IslandManager islandManager = plugin.getIslandManager();
|
||||||
SoundManager soundManager = plugin.getSoundManager();
|
SoundManager soundManager = plugin.getSoundManager();
|
||||||
FileManager fileManager = plugin.getFileManager();
|
FileManager fileManager = plugin.getFileManager();
|
||||||
|
Economy economy = plugin.getEconomyManager().getEconomy();
|
||||||
|
|
||||||
FileConfiguration configLoad = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
FileConfiguration configLoad = fileManager.getConfig(new File(plugin.getDataFolder(), "language.yml"))
|
||||||
.getFileConfiguration();
|
.getFileConfiguration();
|
||||||
|
|
||||||
if (!EconomyManager.isEnabled()) {
|
if (!economy.isEnabled()) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ public class Upgrade {
|
|||||||
Island island = islandManager.getIsland(player);
|
Island island = islandManager.getIsland(player);
|
||||||
|
|
||||||
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
nInventoryUtil nInv = new nInventoryUtil(player, event -> {
|
||||||
if (!EconomyManager.isEnabled()) {
|
if (!economy.isEnabled()) {
|
||||||
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
|
messageManager.sendMessage(player, configLoad.getString("Island.Upgrade.Disabled.Message"));
|
||||||
soundManager.playSound(player, CompatibleSound.BLOCK_ANVIL_LAND.getSound(), 1.0F, 1.0F);
|
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()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player,
|
||||||
com.songoda.skyblock.upgrade.Upgrade.Type.Speed, true);
|
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()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Jump,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -221,13 +222,13 @@ public class Upgrade {
|
|||||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Crop,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -272,13 +273,13 @@ public class Upgrade {
|
|||||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Fly,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -324,13 +325,13 @@ public class Upgrade {
|
|||||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Drops,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -368,14 +369,14 @@ public class Upgrade {
|
|||||||
.replace("%tier", "" + tier)))) {
|
.replace("%tier", "" + tier)))) {
|
||||||
if (upgrade.getValue() > island.getMaxMembers()
|
if (upgrade.getValue() > island.getMaxMembers()
|
||||||
&& upgrade.getValue() != island.getMaxMembers()) {
|
&& upgrade.getValue() != island.getMaxMembers()) {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message").replace(
|
configLoad.getString("Island.Upgrade.Bought.Message").replace(
|
||||||
"%upgrade", is.getItemMeta().getDisplayName()));
|
"%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
|
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
|
||||||
1.0F);
|
1.0F);
|
||||||
|
|
||||||
EconomyManager.withdrawBalance(player, upgrade.getCost());
|
economy.withdrawBalance(player, upgrade.getCost());
|
||||||
island.setMaxMembers(upgrade.getValue());
|
island.setMaxMembers(upgrade.getValue());
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new IslandUpgradeEvent(
|
Bukkit.getServer().getPluginManager().callEvent(new IslandUpgradeEvent(
|
||||||
@ -421,14 +422,14 @@ public class Upgrade {
|
|||||||
.replace("%tier", "" + tier)))) {
|
.replace("%tier", "" + tier)))) {
|
||||||
if (upgrade.getValue() > island.getSize()
|
if (upgrade.getValue() > island.getSize()
|
||||||
&& upgrade.getValue() != island.getSize()) {
|
&& upgrade.getValue() != island.getSize()) {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message").replace(
|
configLoad.getString("Island.Upgrade.Bought.Message").replace(
|
||||||
"%upgrade", is.getItemMeta().getDisplayName()));
|
"%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
|
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F,
|
||||||
1.0F);
|
1.0F);
|
||||||
|
|
||||||
EconomyManager.withdrawBalance(player, upgrade.getCost());
|
economy.withdrawBalance(player, upgrade.getCost());
|
||||||
island.setSize(upgrade.getValue());
|
island.setSize(upgrade.getValue());
|
||||||
islandManager.updateBorder(island);
|
islandManager.updateBorder(island);
|
||||||
|
|
||||||
@ -482,13 +483,13 @@ public class Upgrade {
|
|||||||
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
if (upgrades != null && upgrades.size() > 0 && upgrades.get(0).isEnabled()) {
|
||||||
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
com.songoda.skyblock.upgrade.Upgrade upgrade = upgrades.get(0);
|
||||||
|
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
messageManager.sendMessage(player,
|
messageManager.sendMessage(player,
|
||||||
configLoad.getString("Island.Upgrade.Bought.Message")
|
configLoad.getString("Island.Upgrade.Bought.Message")
|
||||||
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
.replace("%upgrade", is.getItemMeta().getDisplayName()));
|
||||||
soundManager.playSound(player, CompatibleSound.ENTITY_PLAYER_LEVELUP.getSound(), 1.0F, 1.0F);
|
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,
|
island.setUpgrade(player, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -551,7 +552,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Speed))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Speed))},
|
||||||
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
|
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 0);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(potion,
|
nInv.addItem(nInv.createItem(potion,
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Speed.Displayname")),
|
||||||
@ -604,7 +605,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Jump))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Jump))},
|
||||||
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
|
null, new ItemFlag[]{ItemFlag.HIDE_POTION_EFFECTS}), 1);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(potion,
|
nInv.addItem(nInv.createItem(potion,
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Jump.Displayname")),
|
||||||
@ -642,7 +643,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Crop))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Crop))},
|
||||||
null, null), 3);
|
null, null), 3);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
|
nInv.addItem(nInv.createItem(CompatibleMaterial.WHEAT_SEEDS.getItem(),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Crop.Displayname")),
|
||||||
@ -680,7 +681,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Fly))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Fly))},
|
||||||
null, null), 4);
|
null, null), 4);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
|
nInv.addItem(nInv.createItem(new ItemStack(Material.FEATHER),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Fly.Displayname")),
|
||||||
@ -718,7 +719,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Drops))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Drops))},
|
||||||
null, null), 5);
|
null, null), 5);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
|
nInv.addItem(nInv.createItem(new ItemStack(Material.SPIDER_EYE),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Drops.Displayname")),
|
||||||
@ -765,7 +766,7 @@ public class Upgrade {
|
|||||||
new Placeholder("%maxMembers", "" + upgrade.getValue())},
|
new Placeholder("%maxMembers", "" + upgrade.getValue())},
|
||||||
null, null), 6);
|
null, null), 6);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(
|
nInv.addItem(
|
||||||
nInv.createItem(new ItemStack(Material.BOOKSHELF),
|
nInv.createItem(new ItemStack(Material.BOOKSHELF),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
@ -827,7 +828,7 @@ public class Upgrade {
|
|||||||
new Placeholder("%size", "" + upgrade.getValue())},
|
new Placeholder("%size", "" + upgrade.getValue())},
|
||||||
null, null), 7);
|
null, null), 7);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(
|
nInv.addItem(
|
||||||
nInv.createItem(new ItemStack(Material.BEACON),
|
nInv.createItem(new ItemStack(Material.BEACON),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
@ -880,7 +881,7 @@ public class Upgrade {
|
|||||||
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner))},
|
getStatus(island, com.songoda.skyblock.upgrade.Upgrade.Type.Spawner))},
|
||||||
null, null), 8);
|
null, null), 8);
|
||||||
} else {
|
} else {
|
||||||
if (EconomyManager.hasBalance(player, upgrade.getCost())) {
|
if (economy.hasBalance(player, upgrade.getCost())) {
|
||||||
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
|
nInv.addItem(nInv.createItem(CompatibleMaterial.SPAWNER.getItem(),
|
||||||
ChatColor.translateAlternateColorCodes('&',
|
ChatColor.translateAlternateColorCodes('&',
|
||||||
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
|
configLoad.getString("Menu.Upgrade.Item.Spawner.Displayname")),
|
||||||
|
@ -282,7 +282,7 @@ public class PlayerData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void save() {
|
public synchronized void save() {
|
||||||
transactions = BankManager.getInstance().getTransactionList(getPlayerUUID());
|
transactions = plugin.getBankManager().getTransactionList(getPlayerUUID());
|
||||||
Config config = getConfig();
|
Config config = getConfig();
|
||||||
FileConfiguration configLoad = config.getFileConfiguration();
|
FileConfiguration configLoad = config.getFileConfiguration();
|
||||||
configLoad.set("Statistics.Island.Playtime", getPlaytime());
|
configLoad.set("Statistics.Island.Playtime", getPlaytime());
|
||||||
|
@ -8,6 +8,9 @@ Command:
|
|||||||
Sound:
|
Sound:
|
||||||
# When disabled all sounds will be disabled.
|
# When disabled all sounds will be disabled.
|
||||||
Enable: true
|
Enable: true
|
||||||
|
Economy:
|
||||||
|
# Possible managers: Default, Vault, PlayerPoints and Reserve
|
||||||
|
Manager: Default
|
||||||
Island:
|
Island:
|
||||||
Performance:
|
Performance:
|
||||||
# Chunk loading per tick affecting operations like island deletion, scan and biome changing.
|
# Chunk loading per tick affecting operations like island deletion, scan and biome changing.
|
||||||
|
@ -5,8 +5,8 @@ api-version: 1.13
|
|||||||
description: A unique SkyBlock plugin
|
description: A unique SkyBlock plugin
|
||||||
author: Songoda
|
author: Songoda
|
||||||
authors: [Fabrimat]
|
authors: [Fabrimat]
|
||||||
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, LeaderHeads,
|
softdepend: [HolographicDisplays, Holograms, CMI, PlaceholderAPI, MVdWPlaceholderAPI, Vault, Reserve, PlayerPoints,
|
||||||
EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector]
|
LeaderHeads, EpicSpawners, UltimateStacker, WorldEdit, Residence, CoreProtect, CMIEInjector]
|
||||||
loadbefore: [Multiverse-Core, ProtocolLib]
|
loadbefore: [Multiverse-Core, ProtocolLib]
|
||||||
commands:
|
commands:
|
||||||
island:
|
island:
|
||||||
|
Loading…
Reference in New Issue
Block a user