From def57e2c0bd1ca762d1d2f51450e17f046ddcf22 Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Thu, 23 Jun 2016 23:19:02 -0700 Subject: [PATCH] Fix HubManager, add failsafe for BoosterManager --- .../src/mineplex/core/boosters/BoosterManager.java | 14 +++++++++----- .../Mineplex.Hub/src/mineplex/hub/HubManager.java | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java index cf7ba078b..a8b79473f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/boosters/BoosterManager.java @@ -120,7 +120,6 @@ public class BoosterManager extends MiniPlugin Map> 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(); + } } /** diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index 276491f7c..62b398c5a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -229,7 +229,7 @@ public class HubManager extends MiniClientPlugin 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);