public static void cleanupTemporaryWorlds ( String currentWorld ) { List < WorldSummary > saveList ; ISaveFormat isaveformat = Minecraft . getMinecraft ( ) . getSaveLoader ( ) ; isaveformat . flushCache ( ) ; try { saveList = isaveformat . getSaveList ( ) ; } catch ( AnvilConverterException e ) { e . printStackTrace ( ) ; return ; } String searchString = tempMark + AddressHelper . getMissionControlPort ( ) + "_" ; for ( WorldSummary s : saveList ) { String folderName = s . getFileName ( ) ; if ( folderName . startsWith ( searchString ) && ! folderName . equals ( currentWorld ) ) { isaveformat . deleteWorldDirectory ( folderName ) ; } } }
Attempts to delete all Minecraft Worlds with TEMP_ in front of the name