diff --git a/common/src/main/java/com/viaversion/viaversion/dump/VersionInfo.java b/common/src/main/java/com/viaversion/viaversion/dump/VersionInfo.java index 3a6a03bbd..65651ee84 100644 --- a/common/src/main/java/com/viaversion/viaversion/dump/VersionInfo.java +++ b/common/src/main/java/com/viaversion/viaversion/dump/VersionInfo.java @@ -17,25 +17,31 @@ */ package com.viaversion.viaversion.dump; +import com.viaversion.viaversion.api.protocol.version.VersionType; import java.util.Set; public class VersionInfo { private final String javaVersion; private final String operatingSystem; - private final String serverProtocol; - private final Set enabledProtocols; + private final VersionType versionType; + private final int serverProtocol; + private final String serverVersion; + private final Set enabledVersions; private final String platformName; private final String platformVersion; private final String pluginVersion; private final String implementationVersion; private final Set subPlatforms; - public VersionInfo(String javaVersion, String operatingSystem, String serverProtocol, Set enabledProtocols, - String platformName, String platformVersion, String pluginVersion, String implementationVersion, Set subPlatforms) { + public VersionInfo(String javaVersion, String operatingSystem, VersionType versionType, int serverProtocol, String serverVersion, + Set enabledVersions, String platformName, String platformVersion, String pluginVersion, String implementationVersion, + Set subPlatforms) { this.javaVersion = javaVersion; this.operatingSystem = operatingSystem; this.serverProtocol = serverProtocol; - this.enabledProtocols = enabledProtocols; + this.versionType = versionType; + this.serverVersion = serverVersion; + this.enabledVersions = enabledVersions; this.platformName = platformName; this.platformVersion = platformVersion; this.pluginVersion = pluginVersion; @@ -51,12 +57,20 @@ public class VersionInfo { return operatingSystem; } - public String getServerProtocol() { + public VersionType getVersionType() { + return versionType; + } + + public int getServerProtocol() { return serverProtocol; } - public Set getEnabledProtocols() { - return enabledProtocols; + public String getServerVersion() { + return serverVersion; + } + + public Set getEnabledVersions() { + return enabledVersions; } public String getPlatformName() { diff --git a/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java b/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java index 90fa07b4b..14909a6fa 100644 --- a/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java +++ b/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java @@ -23,6 +23,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.platform.ViaPlatform; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.dump.DumpTemplate; import com.viaversion.viaversion.dump.VersionInfo; @@ -56,33 +57,37 @@ public final class DumpUtil { * @return completable future that completes with the url of the dump */ public static CompletableFuture postDump(@Nullable final UUID playerToSample) { + final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); + final ViaPlatform platform = Via.getPlatform(); final VersionInfo version = new VersionInfo( System.getProperty("java.version"), System.getProperty("os.name"), - Via.getAPI().getServerVersion().lowestSupportedProtocolVersion().toString(), + protocolVersion.getVersionType(), + protocolVersion.getVersion(), + protocolVersion.getName(), Via.getManager().getProtocolManager().getSupportedVersions().stream().map(ProtocolVersion::toString).collect(Collectors.toCollection(LinkedHashSet::new)), - Via.getPlatform().getPlatformName(), - Via.getPlatform().getPlatformVersion(), - Via.getPlatform().getPluginVersion(), + platform.getPlatformName(), + platform.getPlatformVersion(), + platform.getPluginVersion(), com.viaversion.viaversion.util.VersionInfo.getImplementationVersion(), Via.getManager().getSubPlatforms() ); final Map configuration = ((Config) Via.getConfig()).getValues(); - final DumpTemplate template = new DumpTemplate(version, configuration, Via.getPlatform().getDump(), Via.getManager().getInjector().getDump(), getPlayerSample(playerToSample)); + final DumpTemplate template = new DumpTemplate(version, configuration, platform.getDump(), Via.getManager().getInjector().getDump(), getPlayerSample(playerToSample)); final CompletableFuture result = new CompletableFuture<>(); - Via.getPlatform().runAsync(() -> { + platform.runAsync(() -> { final HttpURLConnection con; try { con = (HttpURLConnection) new URL("https://dump.viaversion.com/documents").openConnection(); } catch (final IOException e) { - Via.getPlatform().getLogger().log(Level.SEVERE, "Error when opening connection to ViaVersion dump service", e); + platform.getLogger().log(Level.SEVERE, "Error when opening connection to ViaVersion dump service", e); result.completeExceptionally(new DumpException(DumpErrorType.CONNECTION, e)); return; } try { con.setRequestProperty("Content-Type", "application/json"); - con.addRequestProperty("User-Agent", "ViaVersion-" + Via.getPlatform().getPlatformName() + "/" + version.getPluginVersion()); + con.addRequestProperty("User-Agent", "ViaVersion-" + platform.getPlatformName() + "/" + version.getPluginVersion()); con.setRequestMethod("POST"); con.setDoOutput(true); @@ -107,7 +112,7 @@ public final class DumpUtil { result.complete(urlForId(output.get("key").getAsString())); } catch (final Exception e) { - Via.getPlatform().getLogger().log(Level.SEVERE, "Error when posting ViaVersion dump", e); + platform.getLogger().log(Level.SEVERE, "Error when posting ViaVersion dump", e); result.completeExceptionally(new DumpException(DumpErrorType.POST, e)); printFailureInfo(con); } diff --git a/common/src/main/resources/assets/viaversion/data/mappings-1.20to1.19.4.nbt b/common/src/main/resources/assets/viaversion/data/mappings-1.20to1.19.4.nbt deleted file mode 100644 index 965e792cf..000000000 Binary files a/common/src/main/resources/assets/viaversion/data/mappings-1.20to1.19.4.nbt and /dev/null differ