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

View File

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