Skip to content

Commit 92f0faa

Browse files
authored
feat: added fabric support (#998)
1 parent 2eb8f0b commit 92f0faa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2453
-152
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ jobs:
1616
matrix:
1717
include:
1818
- storageType: mariadb
19-
java: 8
20-
- storageType: h2
21-
java: 8
22-
- storageType: mariadb
23-
java: 11
24-
- storageType: h2
25-
java: 11
19+
java: 21
20+
# - storageType: h2 # disabled for now due to memory issues
21+
# java: 21
2622

2723
steps:
2824
- uses: actions/checkout@v2
@@ -38,14 +34,21 @@ jobs:
3834
- name: Setup Gradle
3935
uses: gradle/gradle-build-action@v2
4036

37+
- uses: actions/cache@v4
38+
with:
39+
path: |
40+
.gradle/loom-cache
41+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}
42+
restore-keys: ${{ runner.os }}-gradle-${{ matrix.java }}-
43+
4144
- name: Execute Gradle build
4245
env:
4346
STORAGE_TYPE: ${{ matrix.storageType }}
4447
run: ./gradlew build --info
4548

4649
- name: Publish to Maven Central
4750
# only publish once
48-
if: github.ref == 'refs/heads/master' && matrix.java == '8' && matrix.storageType == 'h2'
51+
if: github.ref == 'refs/heads/master' && matrix.java == '21' && matrix.storageType == 'mariadb'
4952
env:
5053
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
5154
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</p>
2121
<p align="center">
2222
<a aria-label="Tests status" href="https://github.com/BanManagement/BanManager/actions/workflows/build.yml">
23-
<img alt="" src="https://img.shields.io/github/workflow/status/BanManagement/BanManager/Java%20CI?label=Tests&style=for-the-badge&labelColor=000000">
23+
<img alt="" src="https://img.shields.io/github/actions/workflow/status/BanManagement/BanManager/build.yml?branch=master&label=Tests&style=for-the-badge&labelColor=000000">
2424
</a>
2525
<a aria-label="Join the community on Discord" href="https://discord.gg/59bsgZB">
2626
<img alt="" src="https://img.shields.io/discord/664808009393766401?label=Support&style=for-the-badge&labelColor=000000&color=7289da">
@@ -38,7 +38,7 @@
3838
To learn more about configuration, usage and features of BanManager, take a look at [the website](https://banmanagement.com/docs/banmanager/configuration) or view [the website demo](https://demo.banmanagement.com).
3939

4040
## Requirements
41-
- Java 8+
41+
- Java 8+ (JDK21+ required to build from source)
4242
- CraftBukkit/Spigot/Paper, BungeeCord or Sponge for Minecraft 1.7.2+
4343
- Optionally [MySQL or MariaDB](https://banmanagement.com/docs/banmanager/install#setup-shared-database-optional)
4444

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ logger.lifecycle("""
1111
""")
1212

1313
plugins {
14-
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
15-
id("io.freefair.aggregate-javadoc") version "6.3.0"
14+
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
15+
id("io.freefair.aggregate-javadoc") version "8.11"
1616
}
1717

1818
nexusPublishing {

buildSrc/build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ repositories {
1010
name = "sponge"
1111
url = uri("https://repo.spongepowered.org/repository/maven-public/")
1212
}
13+
maven {
14+
name = "Fabric"
15+
url = uri("https://maven.fabricmc.net/")
16+
}
1317
}
1418

1519
dependencies {
1620
implementation(gradleApi())
17-
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
18-
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0")
19-
implementation("org.spongepowered:spongegradle-plugin-development:2.0.0")
20-
}
21+
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.0.0-beta4")
22+
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:5.2.5")
23+
implementation("org.spongepowered:spongegradle-plugin-development:2.3.0")
24+
implementation("fabric-loom:fabric-loom.gradle.plugin:1.9-SNAPSHOT")
25+
}

buildSrc/src/main/kotlin/CommonConfig.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ fun Project.applyCommonConfiguration() {
1414
}
1515

1616
dependencies {
17-
"compileOnly"("org.projectlombok:lombok:1.18.22")
18-
"annotationProcessor"("org.projectlombok:lombok:1.18.22")
17+
"compileOnly"("org.projectlombok:lombok:1.18.36")
18+
"annotationProcessor"("org.projectlombok:lombok:1.18.36")
1919

20-
"testCompileOnly"("org.projectlombok:lombok:1.18.22")
21-
"testAnnotationProcessor"("org.projectlombok:lombok:1.18.22")
20+
"testCompileOnly"("org.projectlombok:lombok:1.18.36")
21+
"testAnnotationProcessor"("org.projectlombok:lombok:1.18.36")
2222
}
2323

2424
configurations.all {

buildSrc/src/main/kotlin/LibsConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun Project.applyLibrariesConfiguration() {
2525
apply(plugin = "java-base")
2626
apply(plugin = "maven-publish")
2727
apply(plugin = "signing")
28-
apply(plugin = "com.github.johnrengelman.shadow")
28+
apply(plugin = "com.gradleup.shadow")
2929

3030
repositories {
3131
mavenCentral()

buildSrc/src/main/kotlin/PlatformConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
4242
}
4343

4444
fun Project.applyShadowConfiguration() {
45-
apply(plugin = "com.github.johnrengelman.shadow")
45+
apply(plugin = "com.gradleup.shadow")
4646
tasks.named<ShadowJar>("shadowJar") {
4747
archiveClassifier.set("dist")
4848
dependencies {

bukkit/build.gradle.kts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ tasks.named<ShadowJar>("shadowJar") {
116116
dependencies {
117117
include(dependency(":BanManagerCommon"))
118118
include(dependency(":BanManagerLibs"))
119-
relocate("org.bstats", "me.confuser.banmanager.common.bstats") {
120-
include(dependency("org.bstats:"))
121-
}
122-
relocate("org.slf4j", "me.confuser.banmanager.common.slf4j") {
123-
include(dependency("org.slf4j:"))
124-
}
119+
120+
include(dependency("org.bstats:.*:.*"))
121+
include(dependency("org.slf4j:.*:.*"))
122+
123+
relocate("org.bstats", "me.confuser.banmanager.common.bstats")
124+
relocate("org.slf4j", "me.confuser.banmanager.common.slf4j")
125125
}
126126

127127
exclude("GradleStart**")
@@ -132,8 +132,12 @@ tasks.named<ShadowJar>("shadowJar") {
132132
exclude("org/intellij/**")
133133
exclude("org/jetbrains/**")
134134
exclude("bungeecord.yml")
135+
exclude("velocity.yml")
135136

136-
minimize()
137+
minimize {
138+
exclude(dependency("org.bstats:.*:.*"))
139+
exclude(dependency("org.slf4j:.*:.*"))
140+
}
137141
}
138142

139143
tasks.named("assemble").configure {

bungee/build.gradle.kts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ tasks.named<ShadowJar>("shadowJar") {
9494
dependencies {
9595
include(dependency(":BanManagerCommon"))
9696
include(dependency(":BanManagerLibs"))
97-
relocate("org.bstats", "me.confuser.banmanager.common.bstats") {
98-
include(dependency("org.bstats:"))
99-
}
97+
include(dependency("org.bstats:.*:.*"))
98+
99+
relocate("org.bstats", "me.confuser.banmanager.common.bstats")
100100
}
101101
exclude("GradleStart**")
102102
exclude(".cache");
@@ -105,8 +105,11 @@ tasks.named<ShadowJar>("shadowJar") {
105105
exclude("META-INF/maven/**")
106106
exclude("org/intellij/**")
107107
exclude("org/jetbrains/**")
108+
exclude("velocity.yml")
108109

109-
minimize()
110+
minimize {
111+
exclude(dependency("org.bstats:.*:.*"))
112+
}
110113
}
111114

112115
tasks.named("assemble").configure {

common/src/main/java/me/confuser/banmanager/common/BanManagerPlugin.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,19 @@ public final void enable() throws Exception {
211211
results2.close();
212212
}
213213

214-
try {
215-
metrics.submitStorageType(config.getLocalDb().getStorageType());
216-
metrics.submitDiscordMode(discordConfig.isHooksEnabled());
217-
metrics.submitGeoMode(geoIpConfig.isEnabled());
218-
metrics.submitGlobalMode(config.getGlobalDb().isEnabled());
219-
metrics.submitOnlineMode(config.isOnlineMode());
220-
if (storageVersion != null) {
221-
metrics.submitStorageVersion(storageVersion);
214+
if (metrics != null) {
215+
try {
216+
metrics.submitStorageType(config.getLocalDb().getStorageType());
217+
metrics.submitDiscordMode(discordConfig.isHooksEnabled());
218+
metrics.submitGeoMode(geoIpConfig.isEnabled());
219+
metrics.submitGlobalMode(config.getGlobalDb().isEnabled());
220+
metrics.submitOnlineMode(config.isOnlineMode());
221+
if (storageVersion != null) {
222+
metrics.submitStorageVersion(storageVersion);
223+
}
224+
} catch (Exception e) {
225+
logger.warning("Failed to submit stats, ignoring");
222226
}
223-
} catch (Exception e) {
224-
logger.warning("Failed to submit stats, ignoring");
225227
}
226228
}
227229

0 commit comments

Comments
 (0)