Skip to content

Commit 22bc089

Browse files
committed
Initial commit
0 parents  commit 22bc089

File tree

12 files changed

+477
-0
lines changed

12 files changed

+477
-0
lines changed

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Example user template template
3+
### Example user template
4+
5+
# IntelliJ project files
6+
.idea
7+
*.iml
8+
out
9+
gen
10+
### Gradle template
11+
.gradle
12+
**/build/
13+
debug
14+
!src/**/build/
15+
16+
# Ignore Gradle GUI config
17+
gradle-app.setting
18+
19+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
20+
!gradle-wrapper.jar
21+
22+
# Cache of project
23+
.gradletasknamecache
24+
25+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
26+
# gradle/wrapper/gradle-wrapper.properties
27+
28+
### Kotlin template
29+
# Compiled class file
30+
*.class
31+
32+
# Log file
33+
*.log
34+
35+
# BlueJ files
36+
*.ctxt
37+
38+
# Mobile Tools for Java (J2ME)
39+
.mtj.tmp/
40+
41+
# Package Files #
42+
*.jar
43+
*.war
44+
*.nar
45+
*.ear
46+
*.zip
47+
*.tar.gz
48+
*.rar
49+
50+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
51+
hs_err_pid*
52+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 NyCode
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Spigot Gradle Kotlin Template
2+
This is a template for creating a [Spigot Plugin](https://www.spigotmc.org/) with [Gradle](https://gradle.org) and the [Kotlin](https://kotlinlang.org) programming language.
3+
4+
## How to use
5+
1. Click **Use this template**.
6+
2. Clone your version.
7+
3. Open the Folder in IntelliJ IDEA
8+
4. Rename group in **build.gradle.kts**
9+
5. Rename project name in **settings.gradle.kts**
10+
11+
## License
12+
This template is licensed under the [MIT License](https://choosealicense.com/licenses/mit/)
13+
14+
Copyright (c) 2020 NyCode

build.gradle.kts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import org.apache.commons.io.output.ByteArrayOutputStream
2+
import org.apache.tools.ant.filters.FixCrLfFilter
3+
import org.apache.tools.ant.filters.ReplaceTokens
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5+
6+
plugins {
7+
kotlin("jvm") version "1.5.10"
8+
id("com.github.johnrengelman.shadow") version "7.0.0"
9+
id("com.github.gmazzo.buildconfig") version "3.0.0"
10+
}
11+
12+
group = "org.example"
13+
version = "1.0.0"
14+
15+
repositories {
16+
maven(url = "https://papermc.io/repo/repository/maven-public/")
17+
}
18+
19+
val minecraft_version: String by project
20+
21+
dependencies {
22+
// PaperMC Dependency
23+
compileOnly("com.destroystokyo.paper", "paper-api", "$minecraft_version-R0.1-SNAPSHOT")
24+
25+
// Add your dependencies here
26+
// Examples
27+
// implementation("io.ktor", "ktor-client", "1.4.0") // Would be shaded into the final jar
28+
// compileOnly("io.ktor", "ktor-client", "1.4.0") // Only used on compile time
29+
}
30+
31+
buildConfig {
32+
className("BuildConfig")
33+
packageName("$group.$name")
34+
val commit = getGitHash()
35+
val branch = getGitBranch()
36+
buildConfigField("String", "GIT_COMMIT", "\"$commit\"")
37+
buildConfigField("String", "GIT_BRANCH", "\"$branch\"")
38+
}
39+
40+
fun getGitHash(): String {
41+
val stdout = ByteArrayOutputStream()
42+
exec {
43+
commandLine( "git", "rev-parse", "--short", "HEAD")
44+
standardOutput = stdout
45+
}
46+
return stdout.toString("UTF-8").trim()
47+
}
48+
49+
fun getGitBranch(): String {
50+
val stdout = ByteArrayOutputStream()
51+
exec {
52+
commandLine( "git", "rev-parse", "--abbrev-ref", "HEAD")
53+
standardOutput = stdout
54+
}
55+
return stdout.toString("UTF-8").trim()
56+
}
57+
58+
tasks {
59+
processResources {
60+
filter(FixCrLfFilter::class)
61+
filter(ReplaceTokens::class, "tokens" to mapOf("version" to project.version))
62+
filteringCharset = "UTF-8"
63+
}
64+
jar {
65+
// Disabled, because we use the shadowJar task for building our jar
66+
enabled = false
67+
}
68+
build {
69+
dependsOn(shadowJar)
70+
}
71+
withType<KotlinCompile> {
72+
kotlinOptions {
73+
jvmTarget = "1.8"
74+
}
75+
}
76+
}

gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kotlin.code.style=official
2+
3+
# Change to your minecraft version
4+
minecraft_version=1.16.5

gradle/wrapper/gradle-wrapper.jar

57.5 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

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.

0 commit comments

Comments
 (0)