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

Commit 48042b2

Browse files
committed
api(config): default で NPE が出るバグを修正
1 parent 2aa27a3 commit 48042b2

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ repositories {
177177
}
178178
179179
dependencies {
180-
api('com.github.sya-ri:EasySpigotAPI:1.3.1') {
180+
api('com.github.sya-ri:EasySpigotAPI:1.3.2') {
181181
exclude group: 'org.spigotmc', module: 'spigot-api'
182182
}
183183
}
@@ -191,7 +191,7 @@ repositories {
191191
}
192192

193193
dependencies {
194-
api("com.github.sya-ri:EasySpigotAPI:1.3.1") {
194+
api("com.github.sya-ri:EasySpigotAPI:1.3.2") {
195195
exclude(group = "org.spigotmc", module = "spigot-api")
196196
}
197197
}
@@ -217,7 +217,7 @@ configurations {
217217
}
218218
219219
dependencies {
220-
shadowApi('com.github.sya-ri:EasySpigotAPI:1.3.1') {
220+
shadowApi('com.github.sya-ri:EasySpigotAPI:1.3.2') {
221221
exclude group: 'org.spigotmc', module: 'spigot-api'
222222
}
223223
}
@@ -242,7 +242,7 @@ repositories {
242242
}
243243

244244
dependencies {
245-
shadowApi("com.github.sya-ri:EasySpigotAPI:1.3.1") {
245+
shadowApi("com.github.sya-ri:EasySpigotAPI:1.3.2") {
246246
exclude(group = "org.spigotmc", module = "spigot-api")
247247
}
248248
}

api/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repositories {
1111
}
1212

1313
group = "com.github.sya-ri.spigot.api"
14-
version = "1.3.1"
14+
version = "1.3.2"
1515

1616
bukkit {
1717
name = "EasySpigotAPI"

api/src/main/kotlin/com/github/syari/spigot/api/config/CustomConfig.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,21 @@ class CustomConfig internal constructor(
3333
val config: YamlConfiguration
3434

3535
init {
36-
try {
37-
file.parentFile.mkdirs()
38-
file.createNewFile()
39-
if (default.isNotEmpty()) {
40-
default.forEach { (key, value) ->
41-
setUnsafe(key, value)
42-
}
43-
save()
36+
if (file.exists().not()) {
37+
try {
38+
file.parentFile.mkdirs()
39+
file.createNewFile()
40+
} catch (ex: IOException) {
41+
throw IOException("$filePath の作成に失敗しました")
4442
}
45-
} catch (ex: IOException) {
46-
plugin.logger.severe("$filePath の作成に失敗しました")
4743
}
4844
config = YamlConfiguration.loadConfiguration(file)
45+
if (default.isNotEmpty()) {
46+
default.forEach { (key, value) ->
47+
setUnsafe(key, value)
48+
}
49+
save()
50+
}
4951
}
5052

5153
/**

0 commit comments

Comments
 (0)