handleResponse(HttpClientResponse resp, ByteBufMono byteBufMono) {
27 | return byteBufMono.asString();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/http/UriBuilder.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.http;
2 |
3 | import java.net.URI;
4 | import lombok.Getter;
5 |
6 | public class UriBuilder {
7 |
8 | @Getter
9 | private final String baseUrl;
10 |
11 | protected UriBuilder(String baseUrl) {
12 | this.baseUrl = baseUrl;
13 | }
14 |
15 | public static UriBuilder withBaseUrl(String baseUrl) {
16 | return new UriBuilder(baseUrl);
17 | }
18 |
19 | @SuppressWarnings("unused")
20 | public static UriBuilder withNoBaseUrl() {
21 | return new UriBuilder("");
22 | }
23 |
24 | public URI resolve(String path, Object... values) {
25 | return Uris.populateToUri(baseUrl + path, values);
26 | }
27 |
28 | public URI resolve(String path, Uris.QueryParameters queryParameters, Object... values) {
29 | return Uris.populateToUri(baseUrl + path, queryParameters, values);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/http/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * This package provides wrappers of Reactor Netty
3 | * to simplify common retrieval patterns such as
4 | *
5 | * - parsing response JSON into Java objects
6 | * - retrieving a file into a known output name with handling of up to date checks
7 | * - retrieving a file without prior knowledge of the resulting filename
8 | *
9 | * Examples:
10 | * {@code
11 | * Fetch.fetch(URI.create(...))
12 | * .toDirectory(dest)
13 | * .skipUpToDate(true)
14 | * .assemble()
15 | * .block()
16 | * }
17 | */
18 | package me.itzg.helpers.http;
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/json/ObjectMappers.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.json;
2 |
3 | import com.fasterxml.jackson.databind.DeserializationFeature;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import com.fasterxml.jackson.databind.SerializationFeature;
6 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
7 |
8 | public class ObjectMappers {
9 | private static final ObjectMapper DEFAULT = new ObjectMapper()
10 | .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
11 | .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
12 | .registerModule(new JavaTimeModule());
13 |
14 | public static ObjectMapper defaultMapper() {
15 | return DEFAULT;
16 | }
17 |
18 | private ObjectMappers() {
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/logger/CustomHighlight.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.logger;
2 |
3 | import ch.qos.logback.classic.Level;
4 | import ch.qos.logback.classic.spi.ILoggingEvent;
5 | import ch.qos.logback.core.pattern.color.ANSIConstants;
6 | import ch.qos.logback.core.pattern.color.ForegroundCompositeConverterBase;
7 |
8 | public class CustomHighlight extends ForegroundCompositeConverterBase {
9 |
10 | @Override
11 | protected String getForegroundColorCode(ILoggingEvent event) {
12 | Level level = event.getLevel();
13 | switch (level.toInt()) {
14 | case Level.ERROR_INT:
15 | return ANSIConstants.BOLD + ANSIConstants.RED_FG; // same as default color scheme
16 | case Level.WARN_INT:
17 | return ANSIConstants.YELLOW_FG;// same as default color scheme
18 | case Level.INFO_INT:
19 | default:
20 | return ANSIConstants.DEFAULT_FG;
21 | }
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/lombok.config:
--------------------------------------------------------------------------------
1 | config.stopbubbling=true
2 | lombok.accessors.chain=true
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ExcludeIncludesContent.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import com.fasterxml.jackson.annotation.JsonPropertyDescription;
4 | import com.kjetland.jackson.jsonSchema.annotations.JsonSchemaTitle;
5 | import java.util.Map;
6 | import java.util.Set;
7 | import lombok.Data;
8 |
9 | /**
10 | * Similar to {@link me.itzg.helpers.curseforge.ExcludeIncludesContent}, but trimmed down to match
11 | * supported functionality
12 | */
13 | @JsonSchemaTitle("Mods Exclude File Content")
14 | @Data
15 | public class ExcludeIncludesContent {
16 |
17 | @JsonPropertyDescription("Mods/files by slug|id to exclude for all modpacks")
18 | private Set globalExcludes;
19 | @JsonPropertyDescription("Mods by slug|id to force include for all modpacks")
20 | private Set globalForceIncludes;
21 |
22 | @JsonPropertyDescription("Specific exclude/includes by modpack slug")
23 | private Map modpacks;
24 |
25 | @Data
26 | public static class ExcludeIncludes {
27 | @JsonPropertyDescription("Mods by slug|id to exclude for this modpack")
28 | private Set excludes;
29 | @JsonPropertyDescription("Mods by slug|id to force include for this modpack")
30 | private Set forceIncludes;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/FetchedPack.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.nio.file.Path;
4 | import lombok.Value;
5 |
6 | @Value
7 | public class FetchedPack {
8 | Path mrPackFile;
9 |
10 | String projectSlug;
11 |
12 | String versionId;
13 |
14 | /**
15 | * Human-readable version
16 | */
17 | String versionNumber;
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/FilePackFetcher.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.io.IOException;
4 | import java.nio.file.Files;
5 | import java.nio.file.Path;
6 | import java.nio.file.Paths;
7 | import java.nio.file.attribute.FileTime;
8 | import lombok.extern.slf4j.Slf4j;
9 | import me.itzg.helpers.errors.InvalidParameterException;
10 | import reactor.core.publisher.Mono;
11 |
12 | @Slf4j
13 | public class FilePackFetcher implements ModrinthPackFetcher {
14 |
15 | private final ProjectRef projectRef;
16 |
17 | public FilePackFetcher(ProjectRef projectRef) {
18 | if (!projectRef.isFileUri()) {
19 | throw new IllegalArgumentException("Requires a projectRef with a file URI");
20 | }
21 | this.projectRef = projectRef;
22 | }
23 |
24 | @Override
25 | public Mono fetchModpack(ModrinthModpackManifest prevManifest) {
26 | final Path file = Paths.get(projectRef.getProjectUri());
27 | if (!Files.exists(file)) {
28 | throw new InvalidParameterException("Local modpack file does not exist: " + file);
29 | }
30 |
31 | return Mono.just(
32 | new FetchedPack(file, projectRef.getIdOrSlug(), deriveVersionId(), "local")
33 | );
34 | }
35 |
36 | private String deriveVersionId() {
37 | final Path file = Paths.get(projectRef.getProjectUri());
38 |
39 | try {
40 | final FileTime fileTime = Files.getLastModifiedTime(file);
41 | return fileTime.toString();
42 | } catch (IOException e) {
43 | log.warn("Unable to retrieve modified file time", e);
44 | return "unknown";
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/Installation.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.nio.file.Path;
4 | import java.util.List;
5 | import lombok.Data;
6 | import me.itzg.helpers.modrinth.model.ModpackIndex;
7 |
8 | @Data
9 | public class Installation {
10 |
11 | ModpackIndex index;
12 | List files;
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/LegacyModrinthManifest.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.time.Instant;
4 | import java.util.Set;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.extern.jackson.Jacksonized;
8 |
9 | @Data
10 | @Builder
11 | @Jacksonized
12 | public class LegacyModrinthManifest {
13 |
14 | public static final String FILENAME = ".modrinth-files.manifest";
15 |
16 | Instant timestamp;
17 |
18 | Set files;
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/Loader.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import lombok.Getter;
4 |
5 | @Getter
6 | public enum Loader {
7 | fabric("mods", null),
8 | quilt("mods", fabric),
9 | forge("mods", null),
10 | neoforge("mods", forge),
11 | bukkit("plugins", null),
12 | spigot("plugins", null),
13 | paper("plugins", spigot),
14 | pufferfish("plugins", paper),
15 | leaf("plugins", paper),
16 | purpur("plugins", paper),
17 | bungeecord("plugins", null),
18 | velocity("plugins", null),
19 | datapack(null, null);
20 |
21 | private final String type;
22 | private final Loader compatibleWith;
23 |
24 | Loader(String type, Loader compatibleWith) {
25 | this.type = type;
26 | this.compatibleWith = compatibleWith;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ModpackLoader.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | /**
4 | * Valid loader values for modpacks
5 | */
6 | public enum ModpackLoader {
7 | fabric,
8 | forge,
9 | quilt,
10 | neoforge;
11 |
12 | public Loader asLoader() {
13 | return Loader.valueOf(this.name());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ModrinthHttpPackFetcher.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.net.URI;
4 | import java.nio.charset.StandardCharsets;
5 | import java.nio.file.Path;
6 | import java.util.Base64;
7 | import lombok.extern.slf4j.Slf4j;
8 | import reactor.core.publisher.Mono;
9 |
10 | @Slf4j
11 | public class ModrinthHttpPackFetcher implements ModrinthPackFetcher {
12 | private final ModrinthApiClient apiClient;
13 | private final Path destFilePath;
14 | private final URI modpackUri;
15 |
16 | ModrinthHttpPackFetcher(ModrinthApiClient apiClient, Path basePath, URI uri) {
17 | this.apiClient = apiClient;
18 | this.destFilePath = basePath.resolve("modpack.mrpack");
19 | this.modpackUri = uri;
20 | }
21 |
22 | @Override
23 | public Mono fetchModpack(ModrinthModpackManifest prevManifest) {
24 | return apiClient.downloadFileFromUrl(
25 | destFilePath, modpackUri,
26 | (uri, file, contentSizeBytes) ->
27 | log.info("Downloaded {}", destFilePath)
28 | )
29 | .map(mrPackFile -> new FetchedPack(mrPackFile, "custom", deriveVersionId(), deriveVersionName()));
30 | }
31 |
32 | private String deriveVersionName() {
33 | final int lastSlash = modpackUri.getPath().lastIndexOf('/');
34 | return lastSlash > 0 ? modpackUri.getPath().substring(lastSlash + 1)
35 | : "unknown";
36 | }
37 |
38 | private String deriveVersionId() {
39 | return Base64.getUrlEncoder().encodeToString(modpackUri.toString().getBytes(StandardCharsets.UTF_8));
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ModrinthManifest.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.util.List;
4 | import lombok.Getter;
5 | import lombok.experimental.SuperBuilder;
6 | import lombok.extern.jackson.Jacksonized;
7 | import me.itzg.helpers.files.BaseManifest;
8 |
9 | @SuperBuilder
10 | @Getter
11 | @Jacksonized
12 | public class ModrinthManifest extends BaseManifest {
13 |
14 | public static final String ID = "modrinth";
15 |
16 | List projects;
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ModrinthModpackManifest.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.util.Map;
4 | import lombok.Getter;
5 | import lombok.experimental.SuperBuilder;
6 | import lombok.extern.jackson.Jacksonized;
7 | import me.itzg.helpers.files.BaseManifest;
8 | import me.itzg.helpers.modrinth.model.DependencyId;
9 |
10 | @SuperBuilder
11 | @Getter
12 | @Jacksonized
13 | public class ModrinthModpackManifest extends BaseManifest {
14 | public static final String ID = "modrinth-modpack";
15 |
16 | private String projectSlug;
17 | private String versionId;
18 |
19 | private Map dependencies;
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ModrinthPackFetcher.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import reactor.core.publisher.Mono;
4 |
5 | public interface ModrinthPackFetcher {
6 |
7 | /**
8 | * @return the fetched modpack or empty if the requested modpack was already up-to-date
9 | */
10 | Mono fetchModpack(ModrinthModpackManifest prevManifest);
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/NoApplicableVersionsException.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import java.util.List;
4 | import java.util.stream.Collectors;
5 | import lombok.Getter;
6 | import lombok.ToString;
7 | import me.itzg.helpers.modrinth.model.Project;
8 | import me.itzg.helpers.modrinth.model.Version;
9 | import me.itzg.helpers.modrinth.model.VersionType;
10 |
11 | @Getter
12 | @ToString
13 | public class NoApplicableVersionsException extends RuntimeException {
14 |
15 | private final Project project;
16 | private final List versions;
17 | private final VersionType versionType;
18 |
19 | public NoApplicableVersionsException(Project project, List versions, VersionType versionType) {
20 | super(
21 | String.format("No candidate versions of '%s' [%s] matched versionType=%s",
22 | project.getTitle(),
23 | versions.stream().map(version -> version.getVersionNumber() + "=" + version.getVersionType())
24 | .collect(Collectors.joining(", ")),
25 | versionType
26 | )
27 | );
28 |
29 | this.project = project;
30 | this.versions = versions;
31 | this.versionType = versionType;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/NoFilesAvailableException.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import lombok.Getter;
4 | import lombok.ToString;
5 | import me.itzg.helpers.modrinth.model.Project;
6 | import org.jetbrains.annotations.Nullable;
7 |
8 | @Getter
9 | @ToString
10 | public class NoFilesAvailableException extends RuntimeException {
11 |
12 | private final Project project;
13 | private final Loader loader;
14 | private final String gameVersion;
15 |
16 | public NoFilesAvailableException(Project project, @Nullable Loader loader, String gameVersion) {
17 | super(String.format("No files are available for the project '%s' for loader %s and Minecraft version %s",
18 | project.getTitle(), loader, gameVersion
19 | ));
20 |
21 | this.project = project;
22 | this.loader = loader;
23 | this.gameVersion = gameVersion;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/ResolvedProject.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth;
2 |
3 | import lombok.Data;
4 | import lombok.RequiredArgsConstructor;
5 | import me.itzg.helpers.modrinth.model.Project;
6 |
7 | @RequiredArgsConstructor
8 | @Data
9 | public class ResolvedProject {
10 | final private ProjectRef projectRef;
11 | final private Project project;
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/Constants.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public class Constants {
4 |
5 | public static final String LOADER_DATAPACK = "datapack";
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/DependencyId.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public enum DependencyId {
6 | minecraft,
7 | forge,
8 | @JsonProperty("fabric-loader")
9 | fabricLoader,
10 | @JsonProperty("quilt-loader")
11 | quiltLoader,
12 | neoforge
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/DependencyType.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum DependencyType {
4 | required,
5 | optional,
6 | incompatible,
7 | embedded
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/Env.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum Env {
4 | client,
5 | server
6 | }
7 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/EnvType.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum EnvType {
4 | required,
5 | optional,
6 | unsupported
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/ModpackIndex.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import lombok.Data;
4 |
5 | import java.net.URI;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * See spec
11 | */
12 | @Data
13 | public class ModpackIndex {
14 | int formatVersion;
15 | String game;
16 | String versionId;
17 | String name;
18 | String summary;
19 | List files;
20 | Map dependencies;
21 |
22 | @Data
23 | public static class ModpackFile {
24 | String path;
25 | Map hashes;
26 | Map env;
27 | List downloads;
28 | long fileSize;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/Project.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import lombok.Data;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Spec
11 | */
12 | @Data
13 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
14 | public class Project {
15 | String slug;
16 |
17 | String id;
18 |
19 | String title;
20 |
21 | ProjectType projectType;
22 |
23 | ServerSide serverSide;
24 |
25 | List versions;
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/ProjectType.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum ProjectType {
4 | mod,
5 | modpack,
6 | resourcepack,
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/ServerSide.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum ServerSide {
4 | required,
5 | optional,
6 | unsupported,
7 | /**
8 | * Not a documented value, but dynmap project was responding with this.
9 | */
10 | unknown
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/Version.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import java.time.Instant;
6 | import java.util.List;
7 | import lombok.Data;
8 |
9 | @Data
10 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
11 | public class Version {
12 |
13 | private String id;
14 |
15 | private String projectId;
16 |
17 | private String name;
18 |
19 | private Instant datePublished;
20 |
21 | private String versionNumber;
22 |
23 | private VersionType versionType;
24 |
25 | private List files;
26 |
27 | private List dependencies;
28 |
29 | private List gameVersions;
30 |
31 | private List loaders;
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/VersionDependency.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.Data;
5 |
6 | @Data
7 | public class VersionDependency {
8 | @JsonProperty("version_id")
9 | String versionId;
10 |
11 | @JsonProperty("project_id")
12 | String projectId;
13 |
14 | @JsonProperty("dependency_type")
15 | DependencyType dependencyType;
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/VersionFile.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | import java.util.Map;
4 | import lombok.Data;
5 |
6 | /**
7 | * Refer to files
of getversion
8 | */
9 | @Data
10 | public class VersionFile {
11 |
12 | /**
13 | * key is either sha512 or sha1
14 | */
15 | Map hashes;
16 |
17 | String url;
18 |
19 | String filename;
20 |
21 | boolean primary;
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/modrinth/model/VersionType.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.modrinth.model;
2 |
3 | public enum VersionType {
4 | release,
5 | beta,
6 | alpha;
7 |
8 | public boolean sufficientFor(VersionType levelRequired) {
9 | return this.ordinal() <= levelRequired.ordinal();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/mvn/MavenMetadata.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.mvn;
2 |
3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
5 | import java.util.List;
6 | import lombok.Data;
7 |
8 | @Data
9 | public class MavenMetadata {
10 |
11 | String groupId;
12 | String artifactId;
13 | Versioning versioning;
14 |
15 | @JsonIgnoreProperties(ignoreUnknown = true)
16 | @Data
17 | public static class Versioning {
18 | String latest;
19 | String release;
20 | @JacksonXmlElementWrapper(localName = "versions")
21 | List version;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/PaperManifest.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper;
2 |
3 | import java.net.URI;
4 | import lombok.Getter;
5 | import lombok.experimental.SuperBuilder;
6 | import lombok.extern.jackson.Jacksonized;
7 | import me.itzg.helpers.files.BaseManifest;
8 |
9 | @Getter
10 | @SuperBuilder
11 | @Jacksonized
12 | public class PaperManifest extends BaseManifest {
13 |
14 | public static final String ID = "papermc";
15 |
16 | String minecraftVersion;
17 |
18 | String project;
19 |
20 | int build;
21 |
22 | URI customDownloadUrl;
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/BuildInfo.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import java.util.Map;
6 | import lombok.Data;
7 |
8 | @Data
9 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
10 | public class BuildInfo {
11 | int build;
12 | ReleaseChannel channel;
13 | Map downloads;
14 |
15 | @Data
16 | public static class DownloadInfo {
17 | String name;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/ProjectInfo.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import java.util.List;
6 | import lombok.Data;
7 |
8 | @Data
9 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
10 | public class ProjectInfo {
11 | List versions;
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/ReleaseChannel.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public enum ReleaseChannel {
6 | @JsonProperty("default")
7 | DEFAULT,
8 | @JsonProperty("experimental")
9 | EXPERIMENTAL;
10 |
11 | @Override
12 | public String toString() {
13 | return name().toLowerCase();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/VersionBuilds.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import java.util.List;
6 | import lombok.Data;
7 |
8 | /**
9 | * Response from version-builds-controller
10 | */
11 | @Data
12 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
13 | public class VersionBuilds {
14 | String version;
15 | List builds;
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/VersionInfo.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import java.util.List;
6 | import lombok.Data;
7 |
8 | @Data
9 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
10 | public class VersionInfo {
11 | List builds;
12 | }
13 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/paper/model/VersionMeta.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.paper.model;
2 |
3 | import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4 | import com.fasterxml.jackson.databind.annotation.JsonNaming;
5 | import lombok.Data;
6 |
7 | /**
8 | * Represents version.json content from server jar
9 | */
10 | @Data
11 | @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
12 | public class VersionMeta {
13 | String id;
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/me/itzg/helpers/patch/FileFormat.java:
--------------------------------------------------------------------------------
1 | package me.itzg.helpers.patch;
2 |
3 | import com.fasterxml.jackson.core.type.TypeReference;
4 | import java.io.IOException;
5 | import java.util.Map;
6 |
7 | public interface FileFormat {
8 | TypeReference