1
0
Fork 0

Log information about savepoint

main
Mari 4 years ago
parent 0be70c607f
commit 2ba589c355
  1. 2
      src/main/kotlin/net/deliciousreya/minecraftportal/MinecraftPortalPlugin.kt
  2. 4
      src/main/kotlin/net/deliciousreya/minecraftportal/model/PortalDataStore.kt

@ -29,7 +29,7 @@ import java.lang.IllegalStateException
class MinecraftPortalPlugin() : JavaPlugin(), Listener class MinecraftPortalPlugin() : JavaPlugin(), Listener
{ {
val portals: PortalDataStore = PortalDataStore() val portals: PortalDataStore = PortalDataStore(logger)
override fun onEnable() { override fun onEnable() {
super.onEnable() super.onEnable()

@ -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

Loading…
Cancel
Save