From 632f84fcf837c6619201e32554e111e609b19aff Mon Sep 17 00:00:00 2001 From: Konicai <71294714+Konicai@users.noreply.github.com> Date: Sun, 6 Jun 2021 10:59:47 -0400 Subject: [PATCH] Merge pull request #2095 * Add floodgate git properties to dump * Merge remote-tracking branch 'upstream/floodgate-2.0' into floodgate-2.0 * Modify the dump to not break anything * name changes to floodgate info in dump * small adjustment to DumpInfo.java * Merge remote-tracking branch 'upstream/floodgate-2.0' into floodgate-2.0 * remove duplicate import statements * Update mappings --- .../util/FloodgateGitPropertiesHolder.java | 36 +++++++++++++++++++ .../org/geysermc/connector/dump/DumpInfo.java | 33 +++++++++++------ connector/src/main/resources/mappings | 2 +- 3 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 common/src/main/java/org/geysermc/floodgate/util/FloodgateGitPropertiesHolder.java diff --git a/common/src/main/java/org/geysermc/floodgate/util/FloodgateGitPropertiesHolder.java b/common/src/main/java/org/geysermc/floodgate/util/FloodgateGitPropertiesHolder.java new file mode 100644 index 000000000..5f157aceb --- /dev/null +++ b/common/src/main/java/org/geysermc/floodgate/util/FloodgateGitPropertiesHolder.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2019-2021 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Geyser + */ + +package org.geysermc.floodgate.util; + +import lombok.Getter; +import lombok.Setter; +import java.util.Properties; + +public class FloodgateGitPropertiesHolder { + @Getter + @Setter + private static Properties gitProperties; +} diff --git a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java index f381bd510..f83598469 100644 --- a/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java +++ b/connector/src/main/java/org/geysermc/connector/dump/DumpInfo.java @@ -43,6 +43,7 @@ import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.FileUtils; import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.FloodgateConfigHolder; +import org.geysermc.floodgate.util.FloodgateGitPropertiesHolder; import java.io.File; import java.io.IOException; @@ -60,9 +61,9 @@ public class DumpInfo { private final DumpInfo.VersionInfo versionInfo; private Properties gitInfo; private final GeyserConfiguration config; - private final Object floodgateConfig; - private final HashInfo hashInfo; + private final Floodgate floodgate; private final Object2IntMap userPlatforms; + private final HashInfo hashInfo; private final RamInfo ramInfo; private final BootstrapDumpInfo bootstrapInfo; @@ -76,7 +77,7 @@ public class DumpInfo { } this.config = GeyserConnector.getInstance().getConfig(); - this.floodgateConfig = FloodgateConfigHolder.getConfig(); + this.floodgate = new Floodgate(); String md5Hash = "unknown"; String sha256Hash = "unknown"; @@ -95,7 +96,6 @@ public class DumpInfo { e.printStackTrace(); } } - this.hashInfo = new HashInfo(md5Hash, sha256Hash); this.ramInfo = new DumpInfo.RamInfo(); @@ -135,13 +135,6 @@ public class DumpInfo { } } - @AllArgsConstructor - @Getter - public static class HashInfo { - private final String md5Hash; - private final String sha256Hash; - } - @Getter public static class NetworkInfo { private final boolean dockerCheck; @@ -185,6 +178,24 @@ public class DumpInfo { } } + @Getter + public static class Floodgate { + private final Properties gitInfo; + private final Object config; + + Floodgate() { + this.gitInfo = FloodgateGitPropertiesHolder.getGitProperties(); + this.config = FloodgateConfigHolder.getConfig(); + } + } + + @AllArgsConstructor + @Getter + public static class HashInfo { + private final String md5Hash; + private final String sha256Hash; + } + @Getter public static class RamInfo { private final long free; diff --git a/connector/src/main/resources/mappings b/connector/src/main/resources/mappings index 53e13b7a0..c846b8200 160000 --- a/connector/src/main/resources/mappings +++ b/connector/src/main/resources/mappings @@ -1 +1 @@ -Subproject commit 53e13b7a0d2ea14df71ed0c9582d29a9b4fb4453 +Subproject commit c846b8200eb8ebb37207666f7eddb83f2b636c37