ThreadPool . scheduleAtFixedRate ( ( ) -> { List inactivePlayerNames = new ArrayList <> ( ) ; // Collect names of inactive players for ( TvTEventTeams team : _teams ) { for ( String playerName : team . getParticipatedPlayerNames ( ) ) { if ( isPlayerAFK ( playerName ) ) { inactivePlayerNames . add ( playerName ) ; } } } // Remove inactive players for ( String playerName : inactivePlayerNames ) { removeParticipant ( playerName ) ; Player playerInstance = World . getInstance ( ) . getPlayer ( playerName ) ; if ( playerInstance != null ) { playerInstance . sendMessage ( "You have been removed from the TvT event due to inactivity." ) ; new TvTEventTeleport ( playerInstance , Config . TVT_EVENT_BACK_COORDINATES , false , false ) ; _afkPlayers . remove ( playerName ) ; } } } , 60000 , 60000 ) ; // This runs every 60 seconds
ScheduledFuture
stopFight
_afkPlayers = new HashSet<>();