File tree Expand file tree Collapse file tree 5 files changed +29
-5
lines changed
src/main/kotlin/me/scoretwo/fastscript Expand file tree Collapse file tree 5 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ dependencies {
1616 compileOnly(" org.apache.commons:commons-lang3:3.10" )
1717 compileOnly(" com.google.code.gson:gson:2.8.6" )
1818 compileOnly(" org.slf4j:slf4j-log4j12:1.7.30" )
19+
20+ implementation(" org.jetbrains.kotlin:kotlin-script-util:${KotlinVersion .CURRENT } " )
21+ implementation(" org.jetbrains.kotlin:kotlin-compiler:${KotlinVersion .CURRENT } " )
22+ implementation(" commons-cli:commons-cli:1.4" )
23+
1924 implementation(" commons-io:commons-io:2.7" )
2025 implementation(" me.scoretwo:commons-syntaxes:${rootProject.extra.get(" commonsVersion" )} " )
2126 implementation(" me.scoretwo:commons-command:${rootProject.extra.get(" commonsVersion" )} " )
Original file line number Diff line number Diff line change 11package me.scoretwo.fastscript.api.expansion
22
3+ import me.scoretwo.fastscript.expansion.javascript.JavaScriptExpansion
4+ import me.scoretwo.fastscript.expansion.kotlinscript.KotlinScriptExpansion
5+
36class ExpansionManager {
47
58 val expansions = mutableSetOf<FastScriptExpansion >()
69
710 init {
8-
11+ register(KotlinScriptExpansion ())
12+ register(JavaScriptExpansion ())
913 }
1014
1115 fun register (expansion : FastScriptExpansion ) {
Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ interface ScriptDescription {
2323 section.getString(section.getLowerCaseNode(" version" )),
2424 section.getString(section.getLowerCaseNode(" description" )),
2525 if (section.isList(section.getLowerCaseNode(" authors" )))
26- section.getStringList(section.getLowerCaseNode(" authors" ))!!
26+ section.getStringList(section.getLowerCaseNode(" authors" ))
2727 else
28- mutableListOf (section[ section.getLowerCaseNode(" authors" )] )
28+ mutableListOf (section.getString( section.getLowerCaseNode(" authors" )) )
2929 )
3030
3131 fun parseDescription (
Original file line number Diff line number Diff line change @@ -3,12 +3,13 @@ package me.scoretwo.fastscript.api.script
33import me.scoretwo.fastscript.FastScript
44import me.scoretwo.fastscript.plugin
55import me.scoretwo.fastscript.settings
6+ import me.scoretwo.utils.bukkit.configuration.yaml.ConfigurationSection
67import me.scoretwo.utils.bukkit.configuration.yaml.patchs.getLowerCaseNode
78import java.io.File
89
910class ScriptManager {
1011
11- val defaultScriptPath = File (plugin.dataFolder, " scripts" )
12+ val folders = mutableListOf ( File (plugin.dataFolder, " scripts" ) )
1213
1314 val scripts = mutableMapOf<String , Script >()
1415
@@ -43,12 +44,17 @@ class ScriptManager {
4344 }
4445 }
4546
47+ fun isConfigScriptOption (section : ConfigurationSection ) =
48+ section.isString(section.getLowerCaseNode(" name" )) &&
49+ (section.isString(section.getLowerCaseNode(" version" )) || section.isInt(section.getLowerCaseNode(" version" ))) &&
50+ section.isString(section.getLowerCaseNode(" main" ))
51+
4652 fun selectScriptFiles (file : File ): MutableList <File > = mutableListOf<File >().let { files ->
4753 if (file.isDirectory) {
4854 file.listFiles()?.forEach {
4955 files.addAll(selectScriptFiles(it))
5056 }
51- } else if (file.name.endsWith(" .js " , true )) {
57+ } else if (file.name.endsWith(" .yml " , true )) {
5258 files.add(file)
5359 }
5460 files
Original file line number Diff line number Diff line change 1+ package me.scoretwo.fastscript.expansion.kotlinscript
2+
3+ import me.scoretwo.fastscript.expansion.typeengine.TypeEngineExpansion
4+
5+ class KotlinScriptExpansion : TypeEngineExpansion () {
6+ override val name = " KotlinScript"
7+ override val sign = " kts"
8+ override val fileSuffix = " kts"
9+ }
You can’t perform that action at this time.
0 commit comments