@Override
	public void run() {
		for (Player player : Bukkit.getOnlinePlayers()) {
			if (!lastLocations.containsKey(player.getName())) {
				lastLocations.put(player.getName(), player.getLocation());
				continue;
			}
			
			Location lastLocation = lastLocations.get(player.getName());
			Location currentLocation = player.getLocation();
			
			int newValue = -1;
			boolean call = false;
			boolean isGoingAfk = false;
			
			if (compareLocations(currentLocation, lastLocation)) {
				
				
				if (secondsAfk.containsKey(player.getName())) {
					newValue = secondsAfk.get(player.getName()).intValue();
					newValue++;
				} else {
					newValue = 1;
				}
				
				secondsAfk.put(player.getName(), newValue);
				
				if (newValue == afkAfter) {
					call = true;
					isGoingAfk = true;
				}
			} else {
				if (secondsAfk.containsKey(player.getName())) {
					int oldValue = secondsAfk.get(player.getName());
					
					if (oldValue >= afkAfter) {
						//Player is going to move
						call = true;
						isGoingAfk = false;
					}
				}
				
				secondsAfk.remove(player.getName());
			}
			
			if (call) {
				PlayerAfkEvent event = new PlayerAfkEvent(player, isGoingAfk);
				Bukkit.getPluginManager().callEvent(event);
			}
			
			lastLocations.put(player.getName(), player.getLocation());
		}
	}