Skip to content

Commit d37957b

Browse files
committed
基础模板
1 parent 1d3d323 commit d37957b

File tree

20 files changed

+644
-0
lines changed

20 files changed

+644
-0
lines changed

build.gradle

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
3+
}
4+
5+
group 'me.scoretwo'
6+
version '0.11'
7+
8+
defaultTasks 'clean', 'build', 'test', 'jar'
9+
10+
repositories {
11+
mavenCentral()
12+
maven {url 'https://repo.codemc.org/repository/maven-public'}
13+
maven {url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'}
14+
maven {url 'https://oss.sonatype.org/content/repositories/snapshots'}
15+
maven {url 'https://repo.md-5.net/repository/public'}
16+
17+
maven {url 'https://repo.extendedclip.com/content/repositories/placeholderapi/'}
18+
}
19+
20+
dependencies {
21+
compile 'commons-io:commons-io:2.7'
22+
implementation "org.jetbrains.kotlin:kotlin-stdlib"
23+
implementation 'org.spigotmc:spigot-api:1.16.3-R0.1-SNAPSHOT'
24+
implementation 'net.md-5:bungeecord-api:1.16-R0.3'
25+
implementation 'me.clip:placeholderapi:2.10.9'
26+
}
27+
28+
processResources {
29+
from(sourceSets.main.resources.srcDirs) {
30+
include 'plugin.yml'
31+
expand(
32+
'name': project.name,
33+
'main': project.group + "." + project.name.toLowerCase() + ".bukkit.BukkitSection",
34+
'version': project.version,
35+
)
36+
}
37+
from(sourceSets.main.resources.srcDirs) {
38+
include 'bungee.yml'
39+
expand(
40+
'name': project.name,
41+
'main': project.group + "." + project.name.toLowerCase() + ".bungee.BungeeSection",
42+
'version': project.version,
43+
)
44+
}
45+
}

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kotlin.code.style=official

gradlew

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 104 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rootProject.name = 'FastScript'
2+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package me.scoretwo.fastscript
2+
3+
import me.scoretwo.fastscript.api.plugin.FastScriptMain
4+
import me.scoretwo.fastscript.api.script.ScriptManager
5+
import java.io.File
6+
7+
class FastScript(val dataFolder: File, private val classLoader: ClassLoader) {
8+
9+
val scriptManager = ScriptManager()
10+
11+
fun initInternalScripts() {
12+
13+
}
14+
15+
companion object {
16+
var instance: FastScript? = null
17+
18+
fun setBootstrap(main: FastScriptMain) {
19+
if (instance != null) {
20+
throw UnsupportedOperationException("Cannot redefine instance")
21+
}
22+
23+
instance = FastScript(main.getDataFolder(), main.getPluginClassLoader())
24+
}
25+
}
26+
27+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package me.scoretwo.fastscript.api.plugin
2+
3+
import com.sun.xml.internal.ws.util.StreamUtils
4+
import me.scoretwo.fastscript.utils.FileUtils
5+
import java.io.File
6+
import java.io.InputStream
7+
8+
interface FastScriptMain {
9+
10+
fun getDataFolder(): File
11+
12+
fun getPluginClassLoader(): ClassLoader
13+
14+
fun saveDefaultResource(target: File, inputStream: InputStream) {
15+
if (target.exists()) {
16+
saveResource(target, inputStream)
17+
}
18+
}
19+
20+
fun saveResource(target: File, inputStream: InputStream) {
21+
FileUtils.save(target, inputStream)
22+
}
23+
24+
}

0 commit comments

Comments
 (0)