fixed ArithmeticException / 0 in ClansEnergyTracker.

This commit is contained in:
NewGarbo 2015-11-19 08:29:50 +00:00
parent 0a667afeb1
commit 6372dfd629
2 changed files with 7 additions and 4 deletions

View File

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

View File

@ -62,6 +62,7 @@ public class KingHill extends WorldEvent
_scoreMap = new HashMap<ClanInfo, CaptureData>();
_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!