Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Include more vendor information and flags in Geyser dump
Dieser Commit ist enthalten in:
Ursprung
0e06a79e5f
Commit
a7aa255784
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
package org.geysermc.connector.command.defaults;
|
package org.geysermc.connector.command.defaults;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.util.DefaultIndenter;
|
||||||
|
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.geysermc.common.PlatformType;
|
import org.geysermc.common.PlatformType;
|
||||||
@ -79,10 +81,13 @@ public class DumpCommand extends GeyserCommand {
|
|||||||
AsteriskSerializer.showSensitive = showSensitive;
|
AsteriskSerializer.showSensitive = showSensitive;
|
||||||
|
|
||||||
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collecting", sender.getLocale()));
|
sender.sendMessage(LanguageUtils.getPlayerLocaleString("geyser.commands.dump.collecting", sender.getLocale()));
|
||||||
String dumpData = "";
|
String dumpData;
|
||||||
try {
|
try {
|
||||||
if (offlineDump) {
|
if (offlineDump) {
|
||||||
dumpData = MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(new DumpInfo(addLog));
|
DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
|
||||||
|
// Make arrays easier to read
|
||||||
|
prettyPrinter.indentArraysWith(new DefaultIndenter(" ", "\n"));
|
||||||
|
dumpData = MAPPER.writer(prettyPrinter).writeValueAsString(new DumpInfo(addLog));
|
||||||
} else {
|
} else {
|
||||||
dumpData = MAPPER.writeValueAsString(new DumpInfo(addLog));
|
dumpData = MAPPER.writeValueAsString(new DumpInfo(addLog));
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import com.github.steveice10.mc.protocol.MinecraftConstants;
|
|||||||
import com.google.common.hash.Hashing;
|
import com.google.common.hash.Hashing;
|
||||||
import com.google.common.io.ByteSource;
|
import com.google.common.io.ByteSource;
|
||||||
import com.google.common.io.Files;
|
import com.google.common.io.Files;
|
||||||
|
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -48,8 +49,13 @@ import org.geysermc.floodgate.util.FloodgateInfoHolder;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.*;
|
import java.lang.management.ManagementFactory;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.Socket;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -68,6 +74,7 @@ public class DumpInfo {
|
|||||||
private final RamInfo ramInfo;
|
private final RamInfo ramInfo;
|
||||||
private LogsInfo logsInfo;
|
private LogsInfo logsInfo;
|
||||||
private final BootstrapDumpInfo bootstrapInfo;
|
private final BootstrapDumpInfo bootstrapInfo;
|
||||||
|
private final FlagsInfo flagsInfo;
|
||||||
|
|
||||||
public DumpInfo(boolean addLog) {
|
public DumpInfo(boolean addLog) {
|
||||||
this.versionInfo = new VersionInfo();
|
this.versionInfo = new VersionInfo();
|
||||||
@ -113,12 +120,16 @@ public class DumpInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.bootstrapInfo = GeyserConnector.getInstance().getBootstrap().getDumpInfo();
|
this.bootstrapInfo = GeyserConnector.getInstance().getBootstrap().getDumpInfo();
|
||||||
|
|
||||||
|
this.flagsInfo = new FlagsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public static class VersionInfo {
|
public static class VersionInfo {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String version;
|
private final String version;
|
||||||
|
private final String javaName;
|
||||||
|
private final String javaVendor;
|
||||||
private final String javaVersion;
|
private final String javaVersion;
|
||||||
private final String architecture;
|
private final String architecture;
|
||||||
private final String operatingSystem;
|
private final String operatingSystem;
|
||||||
@ -130,7 +141,9 @@ public class DumpInfo {
|
|||||||
VersionInfo() {
|
VersionInfo() {
|
||||||
this.name = GeyserConnector.NAME;
|
this.name = GeyserConnector.NAME;
|
||||||
this.version = GeyserConnector.VERSION;
|
this.version = GeyserConnector.VERSION;
|
||||||
this.javaVersion = System.getProperty("java.version");
|
this.javaName = System.getProperty("java.vm.name");
|
||||||
|
this.javaVendor = System.getProperty("java.vendor");
|
||||||
|
this.javaVersion = ManagementFactory.getRuntimeMXBean().getVmVersion(); // Gives a little more to the version we can use over the system property
|
||||||
// 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.architecture = System.getProperty("os.arch");
|
||||||
this.operatingSystem = System.getProperty("os.name");
|
this.operatingSystem = System.getProperty("os.name");
|
||||||
@ -171,14 +184,16 @@ public class DumpInfo {
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public static class MCInfo {
|
public static class MCInfo {
|
||||||
private final String bedrockVersion;
|
private final List<String> bedrockVersions;
|
||||||
private final int bedrockProtocol;
|
private final List<Integer> bedrockProtocols;
|
||||||
|
private final int defaultBedrockProtocol;
|
||||||
private final String javaVersion;
|
private final String javaVersion;
|
||||||
private final int javaProtocol;
|
private final int javaProtocol;
|
||||||
|
|
||||||
MCInfo() {
|
MCInfo() {
|
||||||
this.bedrockVersion = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getMinecraftVersion();
|
this.bedrockVersions = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getMinecraftVersion).toList();
|
||||||
this.bedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
this.bedrockProtocols = BedrockProtocol.SUPPORTED_BEDROCK_CODECS.stream().map(BedrockPacketCodec::getProtocolVersion).toList();
|
||||||
|
this.defaultBedrockProtocol = BedrockProtocol.DEFAULT_BEDROCK_CODEC.getProtocolVersion();
|
||||||
this.javaVersion = MinecraftConstants.GAME_VERSION;
|
this.javaVersion = MinecraftConstants.GAME_VERSION;
|
||||||
this.javaProtocol = MinecraftConstants.PROTOCOL_VERSION;
|
this.javaProtocol = MinecraftConstants.PROTOCOL_VERSION;
|
||||||
}
|
}
|
||||||
@ -230,4 +245,16 @@ public class DumpInfo {
|
|||||||
this.max = Runtime.getRuntime().maxMemory() / MEGABYTE;
|
this.max = Runtime.getRuntime().maxMemory() / MEGABYTE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* E.G. `-Xmx1024M` - all runtime JVM flags on this machine
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public static class FlagsInfo {
|
||||||
|
private final List<String> flags;
|
||||||
|
|
||||||
|
FlagsInfo() {
|
||||||
|
this.flags = ManagementFactory.getRuntimeMXBean().getInputArguments();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren