Added Floodgate to GeyserDump

This commit is contained in:
Tim203 2020-12-01 23:17:54 +01:00
parent deae3d566d
commit f7d2378845
No known key found for this signature in database
GPG Key ID: 064EE9F5BF7C3EE8
3 changed files with 53 additions and 21 deletions

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2019-2020 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;
public class FloodgateConfigHolder {
@Getter
@Setter
private static Object config;
}

View File

@ -34,8 +34,7 @@ import java.util.List;
@Getter
public class BootstrapDumpInfo {
private PlatformType platform;
private final PlatformType platform;
public BootstrapDumpInfo() {
this.platform = GeyserConnector.getInstance().getPlatformType();
@ -43,8 +42,7 @@ public class BootstrapDumpInfo {
@Getter
@AllArgsConstructor
public class PluginInfo {
public static class PluginInfo {
public boolean enabled;
public String name;
public String version;
@ -54,8 +52,7 @@ public class BootstrapDumpInfo {
@Getter
@AllArgsConstructor
public class ListenerInfo {
public static class ListenerInfo {
public String ip;
public int port;
}

View File

@ -38,6 +38,7 @@ import org.geysermc.connector.network.session.GeyserSession;
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 java.io.IOException;
import java.net.InetAddress;
@ -48,30 +49,31 @@ import java.util.Properties;
@Getter
public class DumpInfo {
@JsonIgnore
private static final long MEGABYTE = 1024L * 1024L;
private final DumpInfo.VersionInfo versionInfo;
private Properties gitInfo;
private final GeyserConfiguration config;
private Object2IntMap<DeviceOs> userPlatforms;
private RamInfo ramInfo;
private final Object floodgateConfig;
private final Object2IntMap<DeviceOs> userPlatforms;
private final RamInfo ramInfo;
private final BootstrapDumpInfo bootstrapInfo;
public DumpInfo() {
this.versionInfo = new DumpInfo.VersionInfo();
this.versionInfo = new VersionInfo();
try {
this.gitInfo = new Properties();
this.gitInfo.load(FileUtils.getResource("git.properties"));
} catch (IOException ignored) { }
} catch (IOException ignored) {
}
this.config = GeyserConnector.getInstance().getConfig();
this.floodgateConfig = FloodgateConfigHolder.getConfig();
this.ramInfo = new DumpInfo.RamInfo();
this.userPlatforms = new Object2IntOpenHashMap();
this.userPlatforms = new Object2IntOpenHashMap<>();
for (GeyserSession session : GeyserConnector.getInstance().getPlayers()) {
DeviceOs device = session.getClientData().getDeviceOs();
userPlatforms.put(device, userPlatforms.getOrDefault(device, 0) + 1);
@ -81,8 +83,7 @@ public class DumpInfo {
}
@Getter
public class VersionInfo {
public static class VersionInfo {
private final String name;
private final String version;
private final String javaVersion;
@ -97,7 +98,8 @@ public class DumpInfo {
this.name = GeyserConnector.NAME;
this.version = GeyserConnector.VERSION;
this.javaVersion = System.getProperty("java.version");
this.architecture = System.getProperty("os.arch"); // Usually gives Java architecture but still may be helpful.
// Usually gives Java architecture but still may be helpful.
this.architecture = System.getProperty("os.arch");
this.operatingSystem = System.getProperty("os.name");
this.operatingSystemVersion = System.getProperty("os.version");
@ -108,9 +110,8 @@ public class DumpInfo {
@Getter
public static class NetworkInfo {
private String internalIP;
private final boolean dockerCheck;
private String internalIP;
NetworkInfo() {
if (AsteriskSerializer.showSensitive) {
@ -123,7 +124,8 @@ public class DumpInfo {
try {
// Fallback to the normal way of getting the local IP
this.internalIP = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException ignored) { }
} catch (UnknownHostException ignored) {
}
}
} else {
// Sometimes the internal IP is the external IP...
@ -136,7 +138,6 @@ public class DumpInfo {
@Getter
public static class MCInfo {
private final String bedrockVersion;
private final int bedrockProtocol;
private final String javaVersion;
@ -152,7 +153,6 @@ public class DumpInfo {
@Getter
public static class RamInfo {
private final long free;
private final long total;
private final long max;