From 6372dfd6290a69303b63e4ac04556de4408b8a2e Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Thu, 19 Nov 2015 08:29:50 +0000 Subject: [PATCH] fixed ArithmeticException / 0 in ClansEnergyTracker. --- .../src/mineplex/game/clans/clans/ClanEnergyTracker.java | 5 +++++ .../game/clans/clans/worldevent/kinghill/KingHill.java | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java index 7ead76740..d0a768617 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanEnergyTracker.java @@ -105,6 +105,11 @@ public class ClanEnergyTracker extends MiniPlugin private boolean displayFor(ClanInfo clan, UpdateType type) { + if (clan.getEnergyCostPerMinute() == 0) + { + return false; + } + long energyRemainingSeconds = (clan.getEnergy() / clan.getEnergyCostPerMinute()) * 60000L; switch (type) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java index 0b0c39d4f..d545b4c48 100755 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/kinghill/KingHill.java @@ -62,6 +62,7 @@ public class KingHill extends WorldEvent _scoreMap = new HashMap(); _hill = LOADED_HILLS.get(0); _nextLootDrop = System.currentTimeMillis() + getRandomRange(300000, 600000); + } @Override @@ -86,11 +87,8 @@ public class KingHill extends WorldEvent @Override protected void customTick() { - // uh who wrote this code? below code == [divide ticksRunning by 1, if - // remainder is 0 do tickHill()] - // if (getTicksRunning() % 1 == 0) - tickHill(); + if (System.currentTimeMillis() > _nextLootDrop) { // Drop Loot!