mirror of
https://github.com/5vl/BetterSpigotAPI.git
synced 2025-05-23 22:07:03 +00:00
added getYml method
This commit is contained in:
parent
9cc9426a68
commit
6b3f7a24ef
@ -1,5 +1,6 @@
|
||||
package me.fivevl.betterspigot
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
@ -13,8 +14,17 @@ object BetterData {
|
||||
*/
|
||||
fun createDefaultYml(fileName: String) {
|
||||
val dataFolder = BetterSpigot.instance.dataFolder
|
||||
if (!dataFolder.exists()) dataFolder.mkdir()
|
||||
if (!dataFolder.exists()) dataFolder.mkdirs()
|
||||
val file = File(dataFolder, fileName)
|
||||
if (!file.exists()) BetterSpigot.instance.getResource(fileName)?.copyTo(file.outputStream())
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the custom yml file from the data folder
|
||||
* @param fileName The name of the file to get
|
||||
* @return The YamlConfiguration of the file
|
||||
*/
|
||||
fun getYml(fileName: String): YamlConfiguration {
|
||||
return YamlConfiguration.loadConfiguration(File(BetterSpigot.instance.dataFolder, fileName))
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user