Buggy code:
public class InactivityCheckTask extends BukkitRunnable { private final GPPCities gpp ; public InactivityCheckTask ( GPPCities gpp ) { } @ Override public void run ( ) { gpp . log ( "Inactivity<seq2seq4repair_space>check<seq2seq4repair_space>task<seq2seq4repair_space>start!" ) ; long time = System . currentTimeMillis ( ) ; int removedCitizens = 0 ; int removedMayors = 0 ; int removedCities = 0 ; for ( City city : gpp . ds . citiesMap . values ( ) ) { ArrayList < Citizen > citizensLastPlayed = new ArrayList < Citizen > ( city . citizens . values ( ) ) ; Collections . sort ( citizensLastPlayed , Collections . reverseOrder ( new CitizenLastPlayedComparator ( ) ) ) ; ArrayList < Citizen > citizensJoinedOn = new ArrayList < Citizen > ( city . citizens . values ( ) ) ; Collections . sort ( citizensJoinedOn , new CitizenJoinedOnComparator ( ) ) ; for ( Citizen citizen : citizensLastPlayed ) { if ( ( citizen . getLastPlayedDays ( ) ) <= ( gpp . config . InactivityDays ) ) { break ; } boolean found = true ; if ( citizen . checkPerm ( Mayor ) ) { gpp . log ( ( ( ( "Removing<seq2seq4repair_space>mayor<seq2seq4repair_space>" + ( citizen . getName ( ) ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + ( city . name ) ) ) ; found = false ; for ( Citizen newMayor : citizensJoinedOn ) { if ( ( newMayor . getLastPlayedDays ( ) ) <= ( gpp . config . InactivityDays ) ) { if ( newMayor . checkPerm ( Assistant ) ) { found = true ; gpp . log ( ( ( ( "Assigning<seq2seq4repair_space>" + ( city . name ) ) + "<seq2seq4repair_space>mayor<seq2seq4repair_space>to<seq2seq4repair_space>" ) + ( newMayor . getName ( ) ) ) ) ; city . changeOwner ( newMayor . id ) ; removedMayors ++ ; break ; } } } if ( ! found ) { for ( Citizen newMayor : citizensJoinedOn ) { found = true ; gpp . log ( ( ( ( "Assigning<seq2seq4repair_space>" + ( city . name ) ) + "<seq2seq4repair_space>mayor<seq2seq4repair_space>to<seq2seq4repair_space>" ) + ( newMayor . getName ( ) ) ) ) ; city . changeOwner ( newMayor . id ) ; removedMayors ++ ; break ; } } if ( ! found ) { gpp . log ( ( "Removing<seq2seq4repair_space>city<seq2seq4repair_space>named<seq2seq4repair_space>" + ( city . name ) ) ) ; <START_BUG> gpp . ds . deleteCity ( city . claim . getID ( ) ) ; <END_BUG> removedCities ++ ; break ; } } else { gpp . log ( ( ( ( "Removing<seq2seq4repair_space>citizen<seq2seq4repair_space>" + ( citizen . getName ( ) ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>" ) + ( city . name ) ) ) ; } if ( found ) { city . removeCitizen ( citizen . id ) ; } removedCitizens ++ ; } } gpp . log ( ( ( "Inactivity<seq2seq4repair_space>check<seq2seq4repair_space>done<seq2seq4repair_space>in<seq2seq4repair_space>" + ( ( ( System . currentTimeMillis ( ) ) - time ) // 1000.0 ) ) + "<seq2seq4repair_space>seconds" ) ) ; if ( ( ( removedCitizens != 0 ) || ( removedMayors != 0 ) ) || ( removedCities != 0 ) ) { gpp . log ( ( ( ( ( ( ( "Removed<seq2seq4repair_space>" + removedCitizens ) + "<seq2seq4repair_space>citizens,<seq2seq4repair_space>" ) + removedMayors ) + "<seq2seq4repair_space>mayors,<seq2seq4repair_space>" ) + removedCities ) + "<seq2seq4repair_space>cities." ) ) ; } } }

Fix:
gpp . ds . deleteCity ( city ) ;