Fix HubManager, add failsafe for BoosterManager

This commit is contained in:
Shaun Bennett 2016-06-23 23:19:02 -07:00
parent fd843b88cb
commit def57e2c0b
2 changed files with 10 additions and 6 deletions

View File

@ -120,7 +120,6 @@ public class BoosterManager extends MiniPlugin
Map<String, List<Booster>> boosters = _repository.getBoosters();
long timeTaken = System.currentTimeMillis() - time;
runSync(() -> {
handleBoosterUpdate(boosters);
if (callback != null) callback.run(boosters);
});
@ -219,10 +218,15 @@ public class BoosterManager extends MiniPlugin
@EventHandler
public void tickBoosters(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
tickBoosterCache();
if (event.getType() == UpdateType.MIN_10)
{
// sync with API every 10 minutes, incase pubsub fails
getBoostersAsync(null);
}
else if (event.getType() == UpdateType.SEC)
{
tickBoosterCache();
}
}
/**

View File

@ -229,7 +229,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
FacebookManager facebookManager = new FacebookManager(plugin, clientManager, donationManager, inventoryManager);
_bonusManager = new BonusManager(plugin, clientManager, serverStatusManager, donationManager, pollManager , npcManager, hologramManager, statsManager, _inventoryManager, petManager, facebookManager, _gadgetManager, boosterManager);
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
_treasureManager = new TreasureManager(_plugin, clientManager, serverStatusManager, donationManager, _inventoryManager, petManager, _gadgetManager, _blockRestore, hologramManager, statsManager, _bonusManager.getRewardManager());
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager, boosterManager);