1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2026-01-06 15:42:03 +00:00

Added platform fork to metrics. Improved MC version detector in Bungee

This commit is contained in:
Tim203
2022-04-02 16:27:04 +02:00
parent 8d52ffd28d
commit c10561d010
8 changed files with 57 additions and 6 deletions

View File

@@ -40,6 +40,8 @@ public abstract class PlatformUtils {
*/
public abstract String minecraftVersion();
public abstract String serverImplementationName();
public enum AuthType {
ONLINE,
PROXIED,

View File

@@ -96,7 +96,11 @@ public final class Metrics {
new SimplePie("floodgate_version", () -> Constants.VERSION)
);
metricsBase.addCustomChart(new SimplePie("platform", () -> implementationName));
metricsBase.addCustomChart(
new DrilldownPie("platform", () -> Collections.singletonMap(
implementationName,
Collections.singletonMap(platformUtils.serverImplementationName(), 1)
)));
metricsBase.addCustomChart(
new DrilldownPie("minecraft_version", () -> {

View File

@@ -269,6 +269,11 @@ public final class ReflectionUtils {
return (T) getValue(instance, getField(instance.getClass(), fieldName));
}
@Nullable
public static <T> T castedStaticValue(Field field) {
return getCastedValue(null, field);
}
/**
* Set the value of a field. This method make the field accessible and then sets the value.<br>
* This method doesn't throw an exception when failed, but it'll log the error to the console.