Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
Open
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
5 changes: 4 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id("java")
}

group = "org.example"
group = "me.combimagnetron"
version = "1.0-SNAPSHOT"

dependencies {
Expand All @@ -18,5 +18,8 @@ dependencies {
implementation("org.joml:joml:1.10.5")
implementation("org.jetbrains:annotations:24.0.0")
implementation("org.apache.pulsar:pulsar-client:3.0.0")
implementation("io.github.jglrxavpok.hephaistos:common:2.5.3")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.8.21")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21")
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,42 @@
public class ServiceBoundRequestInstanceBlueprintsMessage extends ServiceBoundMessage {
private final Identifier identifier;
private final String version;
private final Type type;

public ServiceBoundRequestInstanceBlueprintsMessage(Identifier identifier) {
super(2, null, null);
this.identifier = identifier;
this.version = "main";
this.version = "latest";
this.type = Type.RELEASE;
}

public ServiceBoundRequestInstanceBlueprintsMessage(Identifier identifier, Type type) {
super(2, null, null);
this.identifier = identifier;
this.version = "latest";
this.type = type;
}

public ServiceBoundRequestInstanceBlueprintsMessage(Identifier identifier, String version) {
super(2, null, null);
this.identifier = identifier;
this.version = version;
this.type = Type.RELEASE;
}

public ServiceBoundRequestInstanceBlueprintsMessage(Identifier identifier, String version, Type type) {
super(2, null, null);
this.identifier = identifier;
this.version = version;
this.type = type;
}

public ServiceBoundRequestInstanceBlueprintsMessage(byte[] bytes) {
super(bytes);
final String[] id = readString().split(":");
this.identifier = Identifier.of(id[0], id[1]);
this.version = readString();
this.type = Type.valueOf(readString());
}

@Override
Expand All @@ -39,6 +58,7 @@ public ServiceBoundRequestInstanceBlueprintsMessage(byte[] bytes) {
public void write() {
writeString(identifier.string());
writeString(version);
writeString(type.name());
}

public Identifier identifier() {
Expand All @@ -49,6 +69,14 @@ public String version() {
return this.version;
}

public Type type() {
return this.type;
}

public enum Type {
DEV, STAGING, RELEASE
}

public static class Response extends InstanceBoundMessage {
private final VersionCollection<InstanceBlueprint> versionCollection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ public byte[] toBytes() {
return byteArrayDataOutput.toByteArray();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public class VersionCollection<E> extends ArrayList<E> {

@SafeVarargs
public static <E> VersionCollection<E> of(E... es) {
VersionCollection<E> versionCollection = new VersionCollection<>();
versionCollection.addAll(List.of(es));
return versionCollection;
}

public E newest() {
return get(0);
}
Expand Down
Loading