Skip to content

Commit 9b3ce48

Browse files
committed
Merge remote-tracking branch 'origin/master' into mc1.20
2 parents d627492 + 08e48b2 commit 9b3ce48

File tree

61 files changed

+1079
-890
lines changed

Some content is hidden

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

61 files changed

+1079
-890
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: CI
22

33
on:
44
push:
@@ -12,37 +12,62 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15+
16+
test:
17+
name: "Tests"
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v5
22+
with:
23+
submodules: recursive
24+
fetch-depth: 0 # needed for versioning
25+
- name: Set up Java
26+
uses: actions/setup-java@v5
27+
with:
28+
distribution: 'temurin'
29+
java-version: 21
30+
cache: 'gradle'
31+
- name: Tests
32+
run: ./gradlew spotlessCheck test --stacktrace
33+
1534
build:
35+
name: "Build"
1636
runs-on: ubuntu-latest
1737
steps:
18-
- uses: actions/checkout@v4
38+
- name: Checkout
39+
uses: actions/checkout@v5
1940
with:
2041
submodules: recursive
2142
fetch-depth: 0 # needed for versioning
2243
- name: Set up Java
23-
uses: actions/setup-java@v4
44+
uses: actions/setup-java@v5
2445
with:
2546
distribution: 'temurin'
2647
java-version: |
2748
21
2849
17
2950
cache: 'gradle'
3051
- name: Build with Gradle
31-
run: ./gradlew spotlessCheck test release --stacktrace
32-
- uses: actions/upload-artifact@v4
52+
run: ./gradlew release --stacktrace
53+
- name: Upload Artifacts
54+
uses: actions/upload-artifact@v4
3355
with:
3456
name: artifacts
3557
path: build/release/*
3658

3759
docker:
60+
name: Deploy Docker Build
3861
runs-on: ubuntu-latest
3962
needs: build
4063
steps:
41-
- uses: actions/checkout@v4
64+
- name: Checkout
65+
uses: actions/checkout@v5
4266
with:
4367
submodules: recursive
4468
fetch-depth: 0
45-
- uses: actions/download-artifact@v4
69+
- name: Download Artifacts
70+
uses: actions/download-artifact@v5
4671
with:
4772
name: artifacts
4873
path: build/release
@@ -54,7 +79,7 @@ jobs:
5479
password: ${{ secrets.GITHUB_TOKEN }}
5580
- name: Set up Docker Buildx
5681
uses: docker/setup-buildx-action@v3
57-
- name: Docker metadata
82+
- name: Docker Metadata
5883
id: metadata
5984
uses: docker/metadata-action@v5
6085
with:
@@ -68,7 +93,7 @@ jobs:
6893
type=match,pattern=v\d+,group=0,enable=${{ startsWith(github.ref, 'refs/tags/') }}
6994
flavor: |
7095
latest=false
71-
- name: Build and push
96+
- name: Build and Push
7297
uses: docker/build-push-action@v5
7398
with:
7499
context: .

.github/workflows/translation-checker.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check translations
1+
name: Check Translations
22

33
on:
44
push:
@@ -10,15 +10,17 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
deploy:
13+
run:
14+
name: Check Translations
1415
runs-on: ubuntu-latest
1516
steps:
1617
- name: Checkout
17-
uses: actions/checkout@v4
18-
- uses: actions/setup-node@v4
18+
uses: actions/checkout@v5
19+
- name: Install Node
20+
uses: actions/setup-node@v5
1921
with:
2022
node-version: 20
21-
- name: Install deps
23+
- name: Install Dependencies
2224
working-directory: .github/translation-checker
2325
run: npm ci
2426
- name: Run Translation Checker

api

buildSrc/src/main/kotlin/bluemap.base.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repositories {
1515
maven ("https://repo.bluecolored.de/snapshots") {
1616
content { includeGroupByRegex ("de\\.bluecolored.*") }
1717
}
18-
maven ("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
18+
maven ("https://hub.spigotmc.org/nexus/content/repositories/snapshots") {
1919
content { includeGroup ("org.spigotmc") }
2020
}
2121

@@ -27,8 +27,10 @@ repositories {
2727

2828
mavenCentral()
2929
maven ("https://libraries.minecraft.net")
30+
maven ("https://repo.papermc.io/repository/maven-public")
31+
maven ( "https://maven.fabricmc.net" )
32+
maven ( "https://maven.neoforged.net/releases" )
3033
maven ( "https://maven.minecraftforge.net" )
31-
maven ("https://repo.papermc.io/repository/maven-public/")
3234
}
3335

3436
tasks.withType(JavaCompile::class).configureEach {

buildSrc/src/main/kotlin/bluemap.implementation.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id ( "bluemap.base" )
3-
id ( "io.github.goooler.shadow" )
3+
id ( "com.gradleup.shadow" )
44
}
55

66
tasks.shadowJar {

buildSrc/src/main/kotlin/curseforge.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import com.matthewprenger.cursegradle.CurseProject
2-
import gradle.kotlin.dsl.accessors._30aa10cce2eda716151152e22de91a4c.curseforge
2+
import gradle.kotlin.dsl.accessors._94345610689fa610403700b47edcf23c.curseforge
33
import org.gradle.api.Action
44
import org.gradle.api.Project
55
import org.gradle.kotlin.dsl.closureOf

common/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,7 @@ public synchronized Map<String, BmMap> getOrLoadMaps(Predicate<String> filter) t
153153
try {
154154
loadMap(entry.getKey(), entry.getValue());
155155
} catch (ConfigurationException ex) {
156-
Logger.global.logWarning(ex.getFormattedExplanation());
157-
Throwable cause = ex.getRootCause();
158-
if (cause != null) {
159-
Logger.global.logError("Detailed error:", ex);
160-
}
156+
ex.printLog(Logger.global);
161157
}
162158
}
163159
return Collections.unmodifiableMap(maps);

common/src/main/java/de/bluecolored/bluemap/common/web/http/SelectionConsumer.java renamed to common/src/main/java/de/bluecolored/bluemap/common/addons/Addon.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
package de.bluecolored.bluemap.common.web.http;
25+
package de.bluecolored.bluemap.common.addons;
2626

27-
import java.nio.channels.SelectionKey;
28-
import java.util.function.Consumer;
27+
import lombok.Getter;
28+
import lombok.RequiredArgsConstructor;
2929

30-
public interface SelectionConsumer extends Consumer<SelectionKey> {}
30+
import java.nio.file.Path;
31+
32+
@RequiredArgsConstructor
33+
@Getter
34+
public class Addon {
35+
36+
private final AddonInfo addonInfo;
37+
private final Path jarFile;
38+
39+
}

common/src/main/java/de/bluecolored/bluemap/common/addons/AddonInfo.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,59 @@
2424
*/
2525
package de.bluecolored.bluemap.common.addons;
2626

27+
import com.google.gson.FieldNamingPolicy;
28+
import com.google.gson.Gson;
29+
import com.google.gson.GsonBuilder;
30+
import de.bluecolored.bluemap.common.config.ConfigurationException;
2731
import lombok.Getter;
32+
import org.jetbrains.annotations.Nullable;
2833

34+
import java.io.IOException;
35+
import java.io.Reader;
36+
import java.nio.charset.StandardCharsets;
37+
import java.nio.file.FileSystem;
38+
import java.nio.file.FileSystems;
39+
import java.nio.file.Files;
40+
import java.nio.file.Path;
41+
import java.util.Set;
42+
43+
@SuppressWarnings({"FieldMayBeFinal", "unused"})
2944
@Getter
3045
public class AddonInfo {
3146
public static final String ADDON_INFO_FILE = "bluemap.addon.json";
3247

48+
private static final Gson GSON = new GsonBuilder()
49+
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES)
50+
.create();
51+
3352
private String id;
3453
private String entrypoint;
54+
private Set<String> dependencies = Set.of();
55+
private Set<String> softDependencies = Set.of();
56+
57+
public static @Nullable AddonInfo load(Path addonJarFile) throws ConfigurationException {
58+
try (FileSystem fileSystem = FileSystems.newFileSystem(addonJarFile, (ClassLoader) null)) {
59+
for (Path root : fileSystem.getRootDirectories()) {
60+
Path addonInfoFile = root.resolve(ADDON_INFO_FILE);
61+
if (!Files.exists(addonInfoFile)) continue;
62+
63+
try (Reader reader = Files.newBufferedReader(addonInfoFile, StandardCharsets.UTF_8)) {
64+
AddonInfo addonInfo = GSON.fromJson(reader, AddonInfo.class);
65+
66+
if (addonInfo.getId() == null)
67+
throw new ConfigurationException("'id' is missing");
68+
69+
if (addonInfo.getEntrypoint() == null)
70+
throw new ConfigurationException("'entrypoint' is missing");
71+
72+
return addonInfo;
73+
}
74+
}
75+
} catch (IOException e) {
76+
throw new ConfigurationException("There was an exception trying to access the file.", e);
77+
}
78+
79+
return null;
80+
}
3581

3682
}

0 commit comments

Comments
 (0)