diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fbff2aa..d5627eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,10 +17,10 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up JDK 17 - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: 17 distribution: 'temurin' @@ -28,25 +28,24 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 - - name: Build Client Artifacts - run: gradle client:build client:buildV8 - - - name: Build Server Artifact - run: gradle server:build + - name: Build Artifacts + run: gradle build - name: Upload Client Artifacts to Actions - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: "${{ github.event.repository.name }}-client" path: client/build/libs/${{ github.event.repository.name }}-client*.jar if-no-files-found: error + archive: false - name: Upload Server Artifact to Actions - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: "${{ github.event.repository.name }}-server" path: server/build/libs/${{ github.event.repository.name }}-server.jar if-no-files-found: error + archive: false - name: Publish Artifacts if: ${{ github.event_name == 'release' }} diff --git a/.gitignore b/.gitignore index f205293..cb03442 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,5 @@ gradle-app.setting # End of https://www.toptal.com/developers/gitignore/api/eclipse,gradle,java +### Custom ### +.idea/ \ No newline at end of file diff --git a/api/src/com/xpdustry/claj/api/ClajPingerManager.java b/api/src/com/xpdustry/claj/api/ClajPingerManager.java index 5fd8c65..fa2c326 100644 --- a/api/src/com/xpdustry/claj/api/ClajPingerManager.java +++ b/api/src/com/xpdustry/claj/api/ClajPingerManager.java @@ -222,7 +222,7 @@ public void joinRoom(ClajLink link, short password, Runnable success, Cons success, Cons failed) { submit((pinger, finished) -> { pinger.pingHost(ip, port, i -> { diff --git a/api/src/com/xpdustry/claj/api/net/ProxyClient.java b/api/src/com/xpdustry/claj/api/net/ProxyClient.java index 7bffcf6..c155066 100644 --- a/api/src/com/xpdustry/claj/api/net/ProxyClient.java +++ b/api/src/com/xpdustry/claj/api/net/ProxyClient.java @@ -39,7 +39,7 @@ * - Packet reception must be done manually.
* - Notifying methods must be called ({@link #conConnected}, {@link #conDisconnected}, {@link #conReceived} and * {@link #conIdle}).
- * - Packet making methods must be defined ({@link #makeWrapPacket} and {@link #makeClosePacket}). + * - Packet making methods must be defined ({@link #makeConWrapPacket} and {@link #makeConClosePacket(int, DcReason)}). */ public abstract class ProxyClient extends Client { public static int defaultTimeout = 5000; //ms diff --git a/build.gradle b/build.gradle index bf031e4..9350b05 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,11 @@ import com.xpdustry.toxopid.spec.ModMetadata +import com.xpdustry.toxopid.task.MindustryExec +import com.xpdustry.toxopid.extension.TaskExtensions import com.xpdustry.toxopid.spec.ModPlatform -import java.nio.charset.StandardCharsets -import java.nio.file.Files -import java.util.regex.Pattern plugins { id "java" - id "com.xpdustry.toxopid" version "4.1.2" + id "com.xpdustry.toxopid" version "4.2.0" id "net.kyori.indra.publishing" version "3.1.3" } @@ -55,6 +54,11 @@ allprojects { // Temporary: added record desugarization. See: https://github.com/xpdustry/jabel annotationProcessor rootProject.files("libs/jabel.jar") //"com.github.Anuken:jabel:0.9.0" } + + java { + withJavadocJar() + withSourcesJar() + } } project(":common") { @@ -105,47 +109,24 @@ project(":client") { } } } - + // Includes android dex build.dependsOn mergeJar - // Make compatible with Mindustry v8. Will just replace 'minGameVersion' in mod.hjson. - task buildV8(type: Jar, dependsOn: [mergeJar]) { - def modHjsonText = rootProject.file("mod.hjson").getText("UTF-8") - def mv8Match = (modHjsonText =~ /(?m)^\s*minGameVersionV8\s*:\s*"([^"]+)"/) - def v8MinGameVersion = mv8Match.find() ? mv8Match.group(1) : null - if (v8MinGameVersion == null) throw new Exception("mod.hjson is missing 'minGameVersionV8'.") - - archiveFileName = "${metadata.name}-${project.name}-v8.jar" - - // Start from the jar produced by mergeJar, but drop its mod.hjson entry. - from({ zipTree(mergeJar.archiveFile.get().asFile) }, { exclude "mod.hjson" }) - - // Add a filtered mod.hjson at the root of the jar. - from(rootDir) { - include "mod.hjson" - //includeEmptyDirs = false - filter { - if (it == null) return null - if (it ==~ /^\s*minGameVersionV8\s*:.*$/) return null - if (it ==~ /^\s*minGameVersion\s*:.*$/) return "minGameVersion: \"${v8MinGameVersion}\"" - return it - } - } + tasks.runMindustryDesktop { + mods.from(mergeJar) + } - doLast { - copy { - from buildV8 - into rootDir - } - } + tasks.register("runMindustryDesktop2", MindustryExec) { + mods.from(mergeJar) + TaskExtensions.configureDesktop(it) } } project(":server") { ext.mainClassName = "com.xpdustry.claj.server.Main" toxopid.platforms = [ModPlatform.SERVER] - toxopid.compileVersion = "v154" + toxopid.compileVersion = "v157" dependencies { implementation project(":common") @@ -185,9 +166,7 @@ project(":server") { } } -build.dependsOn "client:buildV8" -task buildAll(type: Jar, dependsOn: ["client:build", "client:buildV8", "server:build"]) {} - +task buildAll(type: Jar, dependsOn: ["client:build", "server:build"]) {} // Publishing signing { @@ -201,7 +180,7 @@ indra { target(8) minimumToolchain(8) } - + gpl3OnlyLicense() publishReleasesTo("xpdustry", "https://maven.xpdustry.com/releases") @@ -213,10 +192,6 @@ indra { } configurePublications { - from components.java - artifact sourcesJar - artifact javadocJar - pom { organization { name = "Xpdustry" @@ -234,13 +209,3 @@ indra { } } } - -// I want these to only be included when publishing, not all the time... -task javadocJar(type: Jar, dependsOn: 'javadoc') { - from javadoc.destinationDir - archiveClassifier = 'javadoc' -} -task sourcesJar(type: Jar, dependsOn: 'classes') { - from sourceSets.main.allSource - archiveClassifier = 'sources' -} \ No newline at end of file diff --git a/client/src/com/xpdustry/claj/client/dialogs/CreateRoomDialog.java b/client/src/com/xpdustry/claj/client/dialogs/CreateRoomDialog.java index 03a9ff1..57e4d39 100644 --- a/client/src/com/xpdustry/claj/client/dialogs/CreateRoomDialog.java +++ b/client/src/com/xpdustry/claj/client/dialogs/CreateRoomDialog.java @@ -47,8 +47,9 @@ public class CreateRoomDialog extends BaseDialog { - /** {@link Styles#togglet} but {@link TextButtonStyle#checked} is {@link Tex#buttonOver} - * instead of {@link Tex#buttonDown}. */ + /** {@link Styles#togglet} but {@link TextButtonStyle#checked} is "{Tex#buttonOver}" + * instead of "{Tex#buttonDown}". */ + // TODO Fix links to Tex#buttonDown and Tex#buttonOver public static final TextButtonStyle fixedToglet = new TextButtonStyle(Styles.togglet); static { fixedToglet.checked = fixedToglet.over; } diff --git a/common/src/com/xpdustry/claj/common/net/stream/StreamBuilder.java b/common/src/com/xpdustry/claj/common/net/stream/StreamBuilder.java index 324c7a1..e3b7377 100644 --- a/common/src/com/xpdustry/claj/common/net/stream/StreamBuilder.java +++ b/common/src/com/xpdustry/claj/common/net/stream/StreamBuilder.java @@ -30,8 +30,8 @@ import com.xpdustry.claj.common.ClajNet; import com.xpdustry.claj.common.packets.Packet; - -/** {@link mindustry.net.Streamable.StreamBuilder}. */ +// TODO Fix link +/** {mindustry.net.Streamable.StreamBuilder}. */ public class StreamBuilder { public final int id; public final byte type; diff --git a/common/src/com/xpdustry/claj/common/net/stream/StreamChunk.java b/common/src/com/xpdustry/claj/common/net/stream/StreamChunk.java index 4715042..9c5ac52 100644 --- a/common/src/com/xpdustry/claj/common/net/stream/StreamChunk.java +++ b/common/src/com/xpdustry/claj/common/net/stream/StreamChunk.java @@ -22,8 +22,8 @@ import arc.util.io.ByteBufferInput; import arc.util.io.ByteBufferOutput; - -/** {@link mindustry.net.Packets.StreamChunk}. */ +// TODO Fix link +/** {mindustry.net.Packets.StreamChunk}. */ public class StreamChunk implements StreamPacket { public int id; public boolean last; diff --git a/common/src/com/xpdustry/claj/common/net/stream/StreamHead.java b/common/src/com/xpdustry/claj/common/net/stream/StreamHead.java index 4fd2cce..a60cbed 100644 --- a/common/src/com/xpdustry/claj/common/net/stream/StreamHead.java +++ b/common/src/com/xpdustry/claj/common/net/stream/StreamHead.java @@ -22,8 +22,8 @@ import arc.util.io.ByteBufferInput; import arc.util.io.ByteBufferOutput; - -/** {@link mindustry.net.Packets.StreamBegin}. */ +// TODO Fix link +/** {mindustry.net.Packets.StreamBegin}. */ public class StreamHead implements StreamPacket { private static int lastid; diff --git a/common/src/com/xpdustry/claj/common/net/stream/StreamSender.java b/common/src/com/xpdustry/claj/common/net/stream/StreamSender.java index b65d1e9..cca3f8b 100644 --- a/common/src/com/xpdustry/claj/common/net/stream/StreamSender.java +++ b/common/src/com/xpdustry/claj/common/net/stream/StreamSender.java @@ -29,9 +29,9 @@ import com.xpdustry.claj.common.packets.Packet; import com.xpdustry.claj.common.util.ByteArrayBufferOutput; - +// TODO Fix link /** - * {@link mindustry.net.ArcNetProvider.ArcConnection#sendStream(mindustry.net.Streamable)}. + * {mindustry.net.ArcNetProvider.ArcConnection#sendStream(mindustry.net.Streamable)}. *

* Note: {@link StreamHead} and {@link StreamChunk} must be registered in {@link ClajNet}. */ diff --git a/common/src/com/xpdustry/claj/common/packets/RoomListPacket.java b/common/src/com/xpdustry/claj/common/packets/RoomListPacket.java index ec5c7d2..8fcb791 100644 --- a/common/src/com/xpdustry/claj/common/packets/RoomListPacket.java +++ b/common/src/com/xpdustry/claj/common/packets/RoomListPacket.java @@ -26,8 +26,8 @@ import arc.util.io.ByteBufferInput; import arc.util.io.ByteBufferOutput; - -/** Can be a huge packet, should be sent with {@link StreamSender} instead. */ +// TODO Fix link +/** Can be a huge packet, should be sent with {StreamSender} instead. */ public class RoomListPacket extends DelayedPacket { public final LongMap states = new LongMap<>(); public final ObjectSet protectedRooms = new ObjectSet<>(32); diff --git a/common/src/com/xpdustry/claj/common/util/Strings.java b/common/src/com/xpdustry/claj/common/util/Strings.java index 18cdec5..b9021cc 100644 --- a/common/src/com/xpdustry/claj/common/util/Strings.java +++ b/common/src/com/xpdustry/claj/common/util/Strings.java @@ -213,8 +213,8 @@ public static boolean isVersionAtLeast(String currentVersion, String newVersion) * Compare if the {@code newVersion} is greater than the {@code currentVersion}, e.g. "v146" > "124.1".
* {@code maxDepth} limits the number of comparisons of version segments, allowing sub-versions to be ignored. * (default is 0) - * - * @apiNote can handle dots and dashes in the version and makes very fast comparison.
+ *

+ * Note: can handle dots and dashes in the version and makes very fast comparison.
* Also ignores non-int parts. (e.g. {@code "v1.2-rc36"}, the {@code "rc36"} part will be ignored) */ public static boolean isVersionAtLeast(String currentVersion, String newVersion, int maxDepth) { diff --git a/mod.hjson b/mod.hjson index c67cfe0..8b0459b 100644 --- a/mod.hjson +++ b/mod.hjson @@ -11,8 +11,7 @@ CLaJ (Copy Link and Join) allows you to play with your friends, just by creating [lightgray]Note: To install the mod for Mindustry v8, click 'View Releases' instead of 'Install' and install the latest version named 'CLaJ for Mindustry V8'.[] ''' version: "2.4" -minGameVersion: "146" -minGameVersionV8: "154" // Will be renamed to 'minGameVersion' if using the 'client:buildV8' gradle task +minGameVersion: "157" java: true hidden: true repo: xpdustry/claj diff --git a/server/src/com/xpdustry/claj/server/ClajRoom.java b/server/src/com/xpdustry/claj/server/ClajRoom.java index 8a622a5..9e13bd4 100644 --- a/server/src/com/xpdustry/claj/server/ClajRoom.java +++ b/server/src/com/xpdustry/claj/server/ClajRoom.java @@ -39,9 +39,10 @@ public class ClajRoom implements NetListener { /** The room id. */ public final long id; + // TODO Fix link /** * The room id encoded in an url-safe base64 string. - * @see com.xpdustry.claj.api.ClajLink + * "@see com.xpdustry.claj.api.ClajLink" */ public final String sid; /** The host connection of this room. */ diff --git a/server/src/com/xpdustry/claj/server/plugin/Plugins.java b/server/src/com/xpdustry/claj/server/plugin/Plugins.java index 6fb8b76..77ac45c 100644 --- a/server/src/com/xpdustry/claj/server/plugin/Plugins.java +++ b/server/src/com/xpdustry/claj/server/plugin/Plugins.java @@ -39,8 +39,8 @@ import com.xpdustry.claj.server.util.JarLoader; import com.xpdustry.claj.server.util.JsonSettings; - -/** Simplified {@link mindustry.mod.Mods} that only handles plugins. */ +// TODO Fix link +/** Simplified {mindustry.mod.Mods} that only handles plugins. */ public class Plugins implements ApplicationListener { private static final String[] metaFiles = {"plugin.json", "plugin.hjson"}; diff --git a/server/src/com/xpdustry/claj/server/util/JsonSettings.java b/server/src/com/xpdustry/claj/server/util/JsonSettings.java index 42efcd8..e914d90 100644 --- a/server/src/com/xpdustry/claj/server/util/JsonSettings.java +++ b/server/src/com/xpdustry/claj/server/util/JsonSettings.java @@ -338,7 +338,7 @@ public void put(String name, Class elementType, Object value) { put(name, elementType, null, value); } - /** @apiNote {@code keyType} is not supported and ignored. object keys are converted using {@link String#valueOf(Object)} */ + /** Note: {@code keyType} is not supported and ignored. object keys are converted using {@link String#valueOf(Object)} */ public synchronized void put(String name, Class elementType, Class keyType, Object value) { // Store primitive, null and JsonValue values directly instead of converting it to JsonValue if (value == null || isKnownType(value.getClass())) {