diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java index 06417c4cf..24390a131 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/StaffServer.java @@ -13,6 +13,7 @@ import com.mojang.authlib.GameProfile; import mineplex.core.account.CoreClientManager; import mineplex.core.achievement.AchievementManager; +import mineplex.core.bonuses.BonusRepository; import mineplex.core.chat.Chat; import mineplex.core.command.CommandCenter; import mineplex.core.common.Constants; @@ -34,10 +35,10 @@ import mineplex.core.punish.Punish; import mineplex.core.recharge.Recharge; import mineplex.core.stats.StatsManager; import mineplex.core.status.ServerStatusManager; -import mineplex.core.twofactor.TwoFactorAuth; import mineplex.core.updater.FileUpdater; import mineplex.core.updater.Updater; import mineplex.staffServer.customerSupport.CustomerSupport; +import mineplex.staffServer.salespackage.SalesPackageManager; import static mineplex.core.Managers.require; @@ -68,6 +69,7 @@ public class StaffServer extends JavaPlugin EloManager eloManager = new EloManager(this, clientManager); StatsManager statsManager = new StatsManager(this, clientManager); InventoryManager inventoryManager = new InventoryManager(this, clientManager); + BonusRepository bonusRepository = new BonusRepository(this, null, donationManager); new Chat(this, null, clientManager, preferenceManager, new AchievementManager(statsManager, clientManager, donationManager, null, eloManager), serverStatusManager.getCurrentServerName()); new MemoryFix(this); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion(), GenericServer.HUB); @@ -76,7 +78,10 @@ public class StaffServer extends JavaPlugin require(DisguiseManager.class); PowerPlayClubRepository powerPlayRepo = new PowerPlayClubRepository(this, clientManager, donationManager); - new CustomerSupport(this, clientManager, donationManager, powerPlayRepo, inventoryManager); + + SalesPackageManager salesPackageManager = new SalesPackageManager(this, clientManager, donationManager, inventoryManager, statsManager, powerPlayRepo); + + new CustomerSupport(this, clientManager, donationManager, powerPlayRepo, inventoryManager, bonusRepository); //Updates getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java index c9ef692ec..856abb3c7 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/salespackage/SalesPackageManager.java @@ -11,7 +11,6 @@ import mineplex.core.inventory.InventoryManager; import mineplex.core.pet.repository.PetRepository; import mineplex.core.powerplayclub.PowerPlayClubRepository; import mineplex.core.stats.StatsManager; -import mineplex.staffServer.salespackage.command.DisplayPackageCommand; import mineplex.staffServer.salespackage.command.Sales; public class SalesPackageManager extends MiniPlugin @@ -53,7 +52,6 @@ public class SalesPackageManager extends MiniPlugin @Override public void addCommands() { - addCommand(new DisplayPackageCommand(this)); addCommand(new Sales(this)); } diff --git a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportShop.java b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportShop.java index cbcad2bfa..1e72c95a8 100644 --- a/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportShop.java +++ b/Plugins/Mineplex.StaffServer/src/mineplex/staffServer/ui/SupportShop.java @@ -11,6 +11,7 @@ import org.bukkit.entity.Player; import com.google.gson.Gson; import mineplex.core.account.CoreClient; +import mineplex.core.bonuses.BonusClientData; import mineplex.core.common.util.UtilServer; import mineplex.core.pet.PetClient; import mineplex.core.pet.repository.token.ClientPetTokenWrapper; @@ -26,6 +27,7 @@ public class SupportShop extends ShopBase private LinkedTemporaryItem> _bonusLog; private LinkedTemporaryItem _powerPlayData; private LinkedTemporaryItem _petClients; + private LinkedTemporaryItem _bonusData; public SupportShop(CustomerSupport plugin) { @@ -34,6 +36,7 @@ public class SupportShop extends ShopBase _bonusLog = new LinkedTemporaryItem<>(); _powerPlayData = new LinkedTemporaryItem<>(); _petClients = new LinkedTemporaryItem<>(); + _bonusData = new LinkedTemporaryItem<>(); } public void handleOpen(Player caller, CoreClient target) @@ -44,7 +47,9 @@ public class SupportShop extends ShopBase loadBonusLog(caller, target.getAccountId(), (bS) -> loadPowerPlay(caller, target.getAccountId(), (ppcS) -> loadPetClient(caller, target, (petS) -> - openPageAsync(caller, new SupportHomePage(getPlugin(), this, caller, target)) + loadBonusData(caller, target.getAccountId(), (bonusS) -> + openPageAsync(caller, new SupportHomePage(getPlugin(), this, caller, target)) + ) ) ) ); @@ -116,12 +121,29 @@ public class SupportShop extends ShopBase callback.accept(true); } + public void loadBonusData(Player caller, int accountId, Consumer callback) + { + getPlugin().getBonusRepository().getClientData(accountId, (data) -> + { + if (data == null) + { + callback.accept(false); + return; + } + + _bonusData.put(caller, accountId, data); + callback.accept(true); + }); + } + public Map> getBonusLog() { return _bonusLog.getPrimaryMap(); } public Map getPowerPlayData() { return _powerPlayData.getPrimaryMap(); } public Map getPetClients() { return _petClients.getPrimaryMap(); } + public Map getBonusData() { return _bonusData.getPrimaryMap(); } + @Override protected void closeShopForPlayer(Player player) {