|
|
@ -17,7 +17,7 @@ import java.io.IOException |
|
|
|
import java.lang.IllegalArgumentException |
|
|
|
import java.lang.IllegalArgumentException |
|
|
|
import java.util.logging.Logger |
|
|
|
import java.util.logging.Logger |
|
|
|
|
|
|
|
|
|
|
|
class PortalDataStore (){ |
|
|
|
class PortalDataStore (val logger: Logger) { |
|
|
|
var saveDataTo: File? = null |
|
|
|
var saveDataTo: File? = null |
|
|
|
var useBackup: File? = null |
|
|
|
var useBackup: File? = null |
|
|
|
private val userColors: MutableMap<String, Material> = mutableMapOf() |
|
|
|
private val userColors: MutableMap<String, Material> = mutableMapOf() |
|
|
@ -99,6 +99,7 @@ class PortalDataStore (){ |
|
|
|
throw DeserializationException(cause = firstException ?: e) |
|
|
|
throw DeserializationException(cause = firstException ?: e) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("Saving data to $saveDataTo and using $useBackup as backup") |
|
|
|
this.saveDataTo = mainFile |
|
|
|
this.saveDataTo = mainFile |
|
|
|
this.useBackup = backupFile |
|
|
|
this.useBackup = backupFile |
|
|
|
} |
|
|
|
} |
|
|
@ -156,6 +157,7 @@ class PortalDataStore (){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun onAfterChanged() { |
|
|
|
fun onAfterChanged() { |
|
|
|
|
|
|
|
logger.info("Saving data to $saveDataTo and using $useBackup as backup...") |
|
|
|
val destination = saveDataTo ?: return |
|
|
|
val destination = saveDataTo ?: return |
|
|
|
val tempDestination = File.createTempFile("PortalSaveData", ".tmp.binproto") |
|
|
|
val tempDestination = File.createTempFile("PortalSaveData", ".tmp.binproto") |
|
|
|
val backupDestination = useBackup |
|
|
|
val backupDestination = useBackup |
|
|
|