Reset timer when no players are online

This commit is contained in:
Shaun Bennett 2015-06-23 16:37:49 -05:00
parent 009f8a6764
commit 76a1f2b1f0
2 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,8 @@ package mineplex.game.clans;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_7_R4.MinecraftServer;

View File

@ -105,10 +105,17 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
if (event.getType() != UpdateType.SEC)
return;
if (_events.size() == 0 && System.currentTimeMillis() > _nextEventStart && UtilServer.getPlayers().length > 0)
if (_events.size() == 0 && System.currentTimeMillis() > _nextEventStart)
{
Bukkit.broadcastMessage("Starting new event from random...");
startRandomEvent();
if (UtilServer.getPlayers().length > 0)
{
Bukkit.broadcastMessage("Starting new event from random...");
startRandomEvent();
}
else
{
_nextEventStart = generateNextEventTime();
}
}
}