use BonusRepository, readd salesmanager, add Rank Bonus log at bottom of the menu

This commit is contained in:
Spencer 2018-01-07 00:07:01 -05:00 committed by Alexander Meech
parent 5269a54001
commit 1fbd8031ed
3 changed files with 30 additions and 5 deletions

View File

@ -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);

View File

@ -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));
}

View File

@ -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<CustomerSupport>
private LinkedTemporaryItem<Integer, List<BonusEntry>> _bonusLog;
private LinkedTemporaryItem<Integer, PowerPlayData> _powerPlayData;
private LinkedTemporaryItem<Integer, PetClient> _petClients;
private LinkedTemporaryItem<Integer, BonusClientData> _bonusData;
public SupportShop(CustomerSupport plugin)
{
@ -34,6 +36,7 @@ public class SupportShop extends ShopBase<CustomerSupport>
_bonusLog = new LinkedTemporaryItem<>();
_powerPlayData = new LinkedTemporaryItem<>();
_petClients = new LinkedTemporaryItem<>();
_bonusData = new LinkedTemporaryItem<>();
}
public void handleOpen(Player caller, CoreClient target)
@ -44,9 +47,11 @@ public class SupportShop extends ShopBase<CustomerSupport>
loadBonusLog(caller, target.getAccountId(), (bS) ->
loadPowerPlay(caller, target.getAccountId(), (ppcS) ->
loadPetClient(caller, target, (petS) ->
loadBonusData(caller, target.getAccountId(), (bonusS) ->
openPageAsync(caller, new SupportHomePage(getPlugin(), this, caller, target))
)
)
)
);
}
@ -116,12 +121,29 @@ public class SupportShop extends ShopBase<CustomerSupport>
callback.accept(true);
}
public void loadBonusData(Player caller, int accountId, Consumer<Boolean> callback)
{
getPlugin().getBonusRepository().getClientData(accountId, (data) ->
{
if (data == null)
{
callback.accept(false);
return;
}
_bonusData.put(caller, accountId, data);
callback.accept(true);
});
}
public Map<Integer, List<BonusEntry>> getBonusLog() { return _bonusLog.getPrimaryMap(); }
public Map<Integer, PowerPlayData> getPowerPlayData() { return _powerPlayData.getPrimaryMap(); }
public Map<Integer, PetClient> getPetClients() { return _petClients.getPrimaryMap(); }
public Map<Integer, BonusClientData> getBonusData() { return _bonusData.getPrimaryMap(); }
@Override
protected void closeShopForPlayer(Player player)
{