Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
api(config): default で NPE が出るバグを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
sya-ri committed Feb 19, 2021
1 parent 2aa27a3 commit 48042b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ repositories {
}
dependencies {
api('com.github.sya-ri:EasySpigotAPI:1.3.1') {
api('com.github.sya-ri:EasySpigotAPI:1.3.2') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -191,7 +191,7 @@ repositories {
}

dependencies {
api("com.github.sya-ri:EasySpigotAPI:1.3.1") {
api("com.github.sya-ri:EasySpigotAPI:1.3.2") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand All @@ -217,7 +217,7 @@ configurations {
}
dependencies {
shadowApi('com.github.sya-ri:EasySpigotAPI:1.3.1') {
shadowApi('com.github.sya-ri:EasySpigotAPI:1.3.2') {
exclude group: 'org.spigotmc', module: 'spigot-api'
}
}
Expand All @@ -242,7 +242,7 @@ repositories {
}

dependencies {
shadowApi("com.github.sya-ri:EasySpigotAPI:1.3.1") {
shadowApi("com.github.sya-ri:EasySpigotAPI:1.3.2") {
exclude(group = "org.spigotmc", module = "spigot-api")
}
}
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

group = "com.github.sya-ri.spigot.api"
version = "1.3.1"
version = "1.3.2"

bukkit {
name = "EasySpigotAPI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ class CustomConfig internal constructor(
val config: YamlConfiguration

init {
try {
file.parentFile.mkdirs()
file.createNewFile()
if (default.isNotEmpty()) {
default.forEach { (key, value) ->
setUnsafe(key, value)
}
save()
if (file.exists().not()) {
try {
file.parentFile.mkdirs()
file.createNewFile()
} catch (ex: IOException) {
throw IOException("$filePath の作成に失敗しました")
}
} catch (ex: IOException) {
plugin.logger.severe("$filePath の作成に失敗しました")
}
config = YamlConfiguration.loadConfiguration(file)
if (default.isNotEmpty()) {
default.forEach { (key, value) ->
setUnsafe(key, value)
}
save()
}
}

/**
Expand Down

0 comments on commit 48042b2

Please sign in to comment.