1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-06 15:41:50 +00:00

Indicate 1.21.112/1.21.113 support, track server platform types in bstats metrics

This commit is contained in:
onebeastchris
2025-10-12 13:28:40 +02:00
parent 8a6bb8e0ba
commit 826b4b4e48
11 changed files with 52 additions and 5 deletions

View File

@@ -149,6 +149,11 @@ public interface GeyserBootstrap {
return Paths.get("logs/latest.log");
}
/**
* @return the name of the server platform Geyser is running on.
*/
@NonNull String getServerPlatform();
/**
* Get an InputStream for the given resource path.
* Overridden on platforms that have different class loader properties.

View File

@@ -482,7 +482,18 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
metrics.addCustomChart(new Metrics.SingleLineChart("players", sessionManager::size));
// Prevent unwanted words best we can
metrics.addCustomChart(new Metrics.SimplePie("authMode", () -> config.getRemote().authType().toString().toLowerCase(Locale.ROOT)));
metrics.addCustomChart(new Metrics.SimplePie("platform", platformType::platformName));
Map<String, Map<String, Integer>> platformTypeMap = new HashMap<>();
Map<String, Integer> serverPlatform = new HashMap<>();
serverPlatform.put(bootstrap.getServerPlatform(), 1);
platformTypeMap.put(platformType().platformName(), serverPlatform);
metrics.addCustomChart(new Metrics.DrilldownPie("platform", () -> {
// By the end, we should return, for example:
// Geyser-Spigot => (Paper, 1)
return platformTypeMap;
}));
metrics.addCustomChart(new Metrics.SimplePie("defaultLocale", GeyserLocale::getDefaultLocale));
metrics.addCustomChart(new Metrics.SimplePie("version", () -> GeyserImpl.VERSION));
metrics.addCustomChart(new Metrics.SimplePie("javaHaProxyProtocol", () -> String.valueOf(config.getRemote().isUseProxyProtocol())));
@@ -520,7 +531,7 @@ public class GeyserImpl implements GeyserApi, EventRegistrar {
if (minecraftVersion != null) {
Map<String, Map<String, Integer>> versionMap = new HashMap<>();
Map<String, Integer> platformMap = new HashMap<>();
platformMap.put(platformType.platformName(), 1);
platformMap.put(bootstrap.getServerPlatform(), 1);
versionMap.put(minecraftVersion, platformMap);
metrics.addCustomChart(new Metrics.DrilldownPie("minecraftServerVersion", () -> {

View File

@@ -55,6 +55,7 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
@@ -87,7 +88,7 @@ public class DumpInfo {
this.cpuCount = Runtime.getRuntime().availableProcessors();
this.cpuName = CpuUtils.tryGetProcessorName();
this.systemLocale = Locale.getDefault();
this.systemEncoding = System.getProperty("file.encoding");
this.systemEncoding = Charset.defaultCharset().displayName();
this.gitInfo = new GitInfo(GeyserImpl.BUILD_NUMBER, GeyserImpl.COMMIT.substring(0, 7), GeyserImpl.COMMIT, GeyserImpl.BRANCH, GeyserImpl.REPOSITORY);

View File

@@ -86,7 +86,7 @@ public final class GameProtocol {
register(Bedrock_v818.CODEC, "1.21.90", "1.21.91", "1.21.92");
register(Bedrock_v819.CODEC, "1.21.93", "1.21.94");
register(Bedrock_v827.CODEC, "1.21.100", "1.21.101");
register(Bedrock_v844.CODEC, "1.21.111");
register(Bedrock_v844.CODEC, "1.21.111", "1.21.112", "1.21.113");
MinecraftVersion latestBedrock = SUPPORTED_BEDROCK_VERSIONS.get(SUPPORTED_BEDROCK_VERSIONS.size() - 1);
DEFAULT_BEDROCK_VERSION = latestBedrock.versionString();