Fixed bug with custom tag fix :P

Fixed bug with server group up time check in servermonitor.
This commit is contained in:
Jonathan Williams 2014-09-25 23:27:08 -07:00
parent 91ca7fa6c6
commit 8bca23f0ba
3 changed files with 7 additions and 6 deletions

View File

@ -60,6 +60,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
public void playerQuit(PlayerQuitEvent event) public void playerQuit(PlayerQuitEvent event)
{ {
_entityMap.remove(event.getPlayer()); _entityMap.remove(event.getPlayer());
_loggedIn.remove(event.getPlayer());
} }
@EventHandler @EventHandler
@ -68,14 +69,14 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.SEC)
return; return;
for (Iterator<Player> iterator = _entityMap.keySet().iterator(); iterator.hasNext();) for (Iterator<Player> iterator = _loggedIn.keySet().iterator(); iterator.hasNext();)
{ {
Player player = iterator.next(); Player player = iterator.next();
if (!_loggedIn.containsKey(player) || (System.currentTimeMillis() - _loggedIn.get(player) > 5000 && !player.isOnline())) if (System.currentTimeMillis() - _loggedIn.get(player) > 5000 && !player.isOnline())
{ {
iterator.remove(); iterator.remove();
_loggedIn.remove(player); _entityMap.remove(player);
System.out.println("Found broken player in CustomTagFix.... '" + player.getName() + "'"); System.out.println("Found broken player in CustomTagFix.... '" + player.getName() + "'");
} }
} }
@ -91,7 +92,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler
Player owner = packetInfo.getPlayer(); Player owner = packetInfo.getPlayer();
PacketVerifier verifier = packetInfo.getVerifier(); PacketVerifier verifier = packetInfo.getVerifier();
if (UtilPlayer.is1_8(owner)) if (owner.isOnline() && UtilPlayer.is1_8(owner))
{ {
if (owner.isOnline() && !_entityMap.containsKey(owner)) if (owner.isOnline() && !_entityMap.containsKey(owner))
{ {

View File

@ -234,7 +234,7 @@ public class ServerGroup
for (MinecraftServer server : _servers) for (MinecraftServer server : _servers)
{ {
if (server.isEmpty() && server.getUptime() <= 150) // Only return empty servers that have been online for >150 seconds if (server.isEmpty() && server.getUptime() >= 150) // Only return empty servers that have been online for >150 seconds
{ {
emptyServers.add(server); emptyServers.add(server);
} }