@Override public void run() { PlayerGroup registeredGroup = worldMapInstance.getRegisteredGroup(); if (registeredGroup == null) { if (worldMapInstance.playersCount() == 0) { destroyInstance(worldMapInstance); return; } Iterator<Player> playerIterator = worldMapInstance.playerIterator(); int mapId = worldMapInstance.getMapId(); while (playerIterator.hasNext()) { Player player = playerIterator.next(); if (player.isOnline() && player.getWorldId() == mapId) { return; } } destroyInstance(worldMapInstance); } else if (registeredGroup.size() == 0) { destroyInstance(worldMapInstance); } }
public void registerGroup(PlayerGroup group) { registeredGroup = group; register(group.getGroupId()); }