Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 30 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,73 @@
name: Build plugin
on: [pull_request, push]
on: [ pull_request, push ]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
distribution: [temurin]
java-version: ["21"]
os: [ ubuntu-latest ]
distribution: [ temurin ]
java-version: [ "25" ]

runs-on: ${{ matrix.os }}
if: "!startsWith(github.event.head_commit.message, '[ci-skip]')"

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: "Setup JDK (${{ matrix.distribution }} ${{ matrix.java-version }})"
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: "${{ matrix.distribution }}"
java-version: "${{ matrix.java-version }}"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/actions/setup-gradle@v6

- name: Execute Gradle build
run: ./gradlew --no-daemon --stacktrace

- name: "Upload the Java ${{ matrix.java-version }} plugin JAR"
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: "! Quests-JDK${{ matrix.java-version }}"
path: |
build/libs/*.jar
!build/libs/*-downgraded-*.jar
if-no-files-found: error

- name: Upload the downgraded Java 8 plugin JAR
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Quests-JDK1.8 (use at your own risk)
path: build/libs/*-downgraded-8-shaded.jar
if-no-files-found: error

- name: Upload the downgraded Java 11 plugin JAR
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Quests-JDK11 (use at your own risk)
path: build/libs/*-downgraded-11-shaded.jar
if-no-files-found: error

- name: Upload the downgraded Java 16 plugin JAR
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Quests-JDK16 (use at your own risk)
path: build/libs/*-downgraded-16-shaded.jar
if-no-files-found: error

- name: Upload the downgraded Java 17 plugin JAR
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: Quests-JDK17 (use at your own risk)
path: build/libs/*-downgraded-17-shaded.jar
if-no-files-found: error

- name: Upload the downgraded Java 21 plugin JAR
uses: actions/upload-artifact@v7
with:
name: Quests-JDK21 (use at your own risk)
path: build/libs/*-downgraded-21-shaded.jar
if-no-files-found: error
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## 💾 Downloads / Building
The latest release version of Quests can be found [here](https://quests.leonardobishop.com/download.html).
The latest build of Quests (development version) can be found on [GitHub](https://github.com/LMBishop/Quests/actions).
The latest build of Quests (development version) can be found on [GitHub](https://github.com/LMBishop/Quests/actions?query=workflow%3A%22Build+plugin%22+event%3Apush+branch%3Amaster).

Alternatively, you can build Quests via Gradle. Release versions of Quests are built using **Gradle**, targeting **Java 17**. You can change the target version in ``build.gradle``.
* Ensure Java is installed on your machine
Expand Down
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import xyz.wagyourtail.jvmdg.gradle.task.DowngradeJar
import xyz.wagyourtail.jvmdg.gradle.task.ShadeJar
import org.gradle.jvm.toolchain.JavaLanguageVersion

plugins {
java
Expand All @@ -15,7 +16,7 @@ allprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
languageVersion = JavaLanguageVersion.of(25)
}
}
}
Expand All @@ -24,7 +25,7 @@ subprojects {
tasks.withType<JavaCompile> {
options.compilerArgs = listOf("-Xlint:deprecation", "-Xlint:unchecked")
options.encoding = Charsets.UTF_8.name()
options.release = 21
options.release = 25
}

tasks.withType<Javadoc> {
Expand Down Expand Up @@ -89,7 +90,10 @@ val javaVersions = listOf(
JavaVersion.VERSION_16,

// from 1.18 to 1.20.4
JavaVersion.VERSION_17
JavaVersion.VERSION_17,

// from 1.20.5 to 1.21.11
JavaVersion.VERSION_21
)

for (javaVersion in javaVersions) {
Expand Down
14 changes: 11 additions & 3 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ repositories {
// PlaceholderAPI
maven("https://repo.extendedclip.com/releases")
// ItemsAdder, SCore, ShopGUIPlus, Slimefun4, Vault
maven("https://jitpack.io/")
maven("https://jitpack.io/") {
content {
includeGroup("com.github.LoneDev6")
includeGroup("com.github.Ssomar-Developement")
includeGroup("com.github.brcdev-minecraft")
includeGroup("com.github.Slimefun")
includeGroup("com.github.MilkBowl")
}
}
// PlayerPoints
maven("https://repo.rosewooddev.io/repository/public/")
// SuperiorSkyblock2
Expand All @@ -71,7 +79,7 @@ dependencies {
compileOnlyProject(":common")

// Paper
compileOnlyServer("io.papermc.paper:paper-api:1.21.11-pre3-R0.1-SNAPSHOT")
compileOnlyServer("io.papermc.paper:paper-api:26.1.1.build.29-alpha")

// ASkyBlock
compileOnlyPlugin("com.wasteofplastic:askyblock:3.0.9.4")
Expand Down Expand Up @@ -134,7 +142,7 @@ dependencies {
// uSkyBlock TODO fix whenever repo is up
//compileOnlyPlugin("ovh.uskyblock:uSkyBlock-API:2.8.9")
// Vault
compileOnlyPlugin("com.github.MilkBowl:VaultAPI:1.7.1")
compileOnlyPlugin("com.github.MilkBowl:VaultAPI:1.7")
// VotingPlugin
compileOnlyPlugin("com.bencodez:votingplugin:6.18.4")
// WildStacker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,66 @@
import org.jspecify.annotations.Nullable;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

@SuppressWarnings("ClassCanBeRecord")
@NullMarked
public final class Version implements Comparable<Version> {

private static final int MIN_INT_PART_VALUE = 0;

private enum CustomPart {
BUILD("build");

private final String name;
private final int value;

CustomPart(final String name) {
this.name = name;
this.value = Integer.MIN_VALUE + this.ordinal(); // only unsigned ints are used in numeric version parts

//noinspection ConstantValue
if (this.value >= MIN_INT_PART_VALUE) {
throw new IllegalStateException("custom part value must be negative");
}
}

public String getName() {
return this.name;
}

public int getValue() {
return this.value;
}

private static final Map<String, CustomPart> byNameMap;
private static final Map<Integer, CustomPart> byValueMap;

static {
final Map<String, CustomPart> mutByNameMap = new HashMap<>();
final Map<Integer, CustomPart> mutByValueMap = new HashMap<>();

for (final CustomPart part : values()) {
mutByNameMap.put(part.name, part);
mutByValueMap.put(part.value, part);
}

byNameMap = Collections.unmodifiableMap(mutByNameMap);
byValueMap = Collections.unmodifiableMap(mutByValueMap);
}

public static @Nullable CustomPart getByName(final String name) {
return byNameMap.get(name);
}

public static @Nullable CustomPart getByValue(final int value) {
return byValueMap.get(value);
}
}

public static final Version V1_8 = new Version(1, 8);
public static final Version V1_9 = new Version(1, 9);
public static final Version V1_11 = new Version(1, 11);
Expand Down Expand Up @@ -131,7 +185,19 @@ public String toString() {
final StringBuilder builder = new StringBuilder();

for (int i = 0; i < this.versionParts.length; i++) {
builder.append(this.versionParts[i]);
final int versionPart = this.versionParts[i];

if (versionPart >= MIN_INT_PART_VALUE) {
builder.append(versionPart);
} else {
final CustomPart customPart = CustomPart.getByValue(versionPart);

if (customPart != null) {
builder.append(customPart.getName());
} else {
throw new IllegalStateException("Failed to serialize (" + versionPart + ") version part");
}
}

if (i != this.versionParts.length - 1) {
builder.append('.');
Expand Down Expand Up @@ -170,12 +236,17 @@ public static Version fromString(final String str) throws IllegalArgumentExcepti

for (int i = 0; i < stringVersionParts.length; i++) {
final String stringVersionPart = stringVersionParts[i];
final CustomPart customPart = CustomPart.getByName(stringVersionPart);
final int versionPart;

try {
versionPart = Integer.parseUnsignedInt(stringVersionPart);
} catch (final NumberFormatException e) {
throw new IllegalArgumentException("Unparsable version part: '" + stringVersionPart + "'");
if (customPart != null) {
versionPart = customPart.getValue();
} else {
try {
versionPart = Integer.parseUnsignedInt(stringVersionPart);
} catch (final NumberFormatException e) {
throw new IllegalArgumentException("Unparsable version part: '" + stringVersionPart + "'");
}
}

versionParts[i] = versionPart;
Expand Down
Loading