-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Will build your gradle project and archive the output jar files. | ||
name: Build and Archive Gradle Project | ||
|
||
# This action will run every time you push to the "main" branch. | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
jobs: | ||
build-and-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
- name: Checkout project sources | ||
uses: actions/checkout@v3 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
- name: Run build with Gradle Wrapper | ||
run: ./gradlew build | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-outputs | ||
path: build/libs/*.jar |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Will simply build your gradle project. | ||
name: Build Gradle Project | ||
|
||
# This action will run every time you push to the "dev" branch. | ||
on: | ||
push: | ||
branches: | ||
- "dev" | ||
|
||
jobs: | ||
build-project: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
- name: Checkout project sources | ||
uses: actions/checkout@v3 | ||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Make gradlew executable | ||
run: chmod +x ./gradlew | ||
- name: Run build with Gradle Wrapper | ||
run: ./gradlew build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import java.io.BufferedReader | ||
import java.io.InputStreamReader | ||
|
||
plugins { | ||
alias(libs.plugins.runPaper) | ||
alias(libs.plugins.paperweight) apply true | ||
alias(libs.plugins.kotlinJvm) apply true | ||
alias(libs.plugins.shadow) apply true | ||
|
||
`maven-publish` | ||
} | ||
|
||
runPaper.folia.registerTask() | ||
|
||
val id = findProperty("id").toString() | ||
val pluginName = findProperty("plugin_name") | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven("https://repo.papermc.io/repository/maven-public/") | ||
maven("https://maven.pvphub.me/releases") | ||
maven("https://repo.dmulloy2.net/repository/public/") | ||
maven("https://jitpack.io") | ||
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") | ||
} | ||
|
||
dependencies { | ||
paperweight.paperDevBundle(libs.versions.paperApi.get()) | ||
|
||
compileOnly(libs.ktgui) | ||
compileOnly(libs.placeholder.api) | ||
} | ||
|
||
tasks { | ||
base { | ||
archivesName = id | ||
} | ||
|
||
withType<ProcessResources> { | ||
val props = mapOf( | ||
"name" to pluginName, | ||
"main" to "${findProperty("group_name")}.${id}.${findProperty("plugin_main_class_name")}", | ||
"author" to findProperty("plugin_author"), | ||
"version" to if (findProperty("include_commit_hash") | ||
.toString().toBoolean() | ||
) "${rootProject.version}-commit-${getCurrentCommitHash()}" else rootProject.version.toString() | ||
) | ||
inputs.properties(props) | ||
filteringCharset = "UTF-8" | ||
filesMatching("plugin.yml") { | ||
expand(props) | ||
} | ||
} | ||
|
||
shadowJar { | ||
mergeServiceFiles() | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
assemble { | ||
dependsOn("reobfJar") | ||
} | ||
|
||
runServer { | ||
val mcVersion = libs.versions.paperApi.get().split("-")[0] | ||
minecraftVersion(mcVersion) | ||
|
||
downloadPlugins { | ||
hangar("ViaVersion", "5.0.1") | ||
hangar("ViaBackwards", "5.0.1") | ||
hangar("PlaceholderAPI", "2.11.6") | ||
} | ||
} | ||
} | ||
|
||
java { | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
|
||
sourceSets["main"].resources.srcDir("src/resources/") | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "pvphub-releases" | ||
url = uri("https://maven.pvphub.me/releases") | ||
credentials { | ||
username = System.getenv("PVPHUB_MAVEN_USERNAME") | ||
password = System.getenv("PVPHUB_MAVEN_SECRET") | ||
} | ||
} | ||
} | ||
publications { | ||
create<MavenPublication>(id) { | ||
from(components["java"]) | ||
groupId = group.toString() | ||
artifactId = id | ||
version = rootProject.version.toString() | ||
} | ||
} | ||
} | ||
|
||
fun getCurrentCommitHash(): String { | ||
val process = ProcessBuilder("git", "rev-parse", "HEAD").start() | ||
val reader = BufferedReader(InputStreamReader(process.inputStream)) | ||
val commitHash = reader.readLine() | ||
reader.close() | ||
process.waitFor() | ||
if (process.exitValue() == 0) { | ||
return commitHash?.substring(0, 7) ?: "" | ||
} else { | ||
throw IllegalStateException("Failed to retrieve the commit hash.") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
kotlin.code.style=official | ||
|
||
# Project configuration | ||
group_name = com.mattmx | ||
id = template | ||
version = 1.0 | ||
|
||
plugin_name = Template | ||
plugin_main_class_name = TemplatePlugin | ||
plugin_author = MattMX | ||
|
||
include_commit_hash = true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[versions] | ||
|
||
paperweight = "1.7.1" | ||
kotlin = "2.0.0" | ||
updateVersions = "0.51.0" | ||
shadow = "8.1.8" | ||
paperApi = "1.20.4-R0.1-SNAPSHOT" | ||
placeholderapi = "2.11.6" | ||
ktgui = "2.4.2-alpha" | ||
runPaper = "2.2.4" | ||
|
||
[libraries] | ||
|
||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } | ||
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } | ||
paper-api = { module = "io.papermc.paper:paper-api", version.ref = "paperApi" } | ||
placeholder-api = { module = "me.clip:placeholderapi", version.ref = "placeholderapi" } | ||
ktgui = { module = "com.mattmx:ktgui", version.ref = "ktgui" } | ||
|
||
[plugins] | ||
|
||
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } | ||
updateDeps = { id = "com.github.ben-manes.versions", version.ref = "updateVersions" } | ||
shadow = { id = "io.github.goooler.shadow", version.ref = "shadow" } | ||
paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "paperweight" } | ||
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |