From 85561633292550209a1461347f8446b54552b391 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 23 Jun 2020 12:27:34 +0100 Subject: Add n-cpus and heap usage to platform info --- .../java/me/lucko/spark/sponge/SpongePlatformInfo.java | 16 +++++++++++----- .../java/me/lucko/spark/sponge/SpongeSparkPlugin.java | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'spark-sponge/src/main/java/me/lucko') diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongePlatformInfo.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongePlatformInfo.java index be0e09d..6cad3cb 100644 --- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongePlatformInfo.java +++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongePlatformInfo.java @@ -20,11 +20,17 @@ package me.lucko.spark.sponge; -import me.lucko.spark.common.PlatformInfo; +import me.lucko.spark.common.platform.AbstractPlatformInfo; +import org.spongepowered.api.Game; import org.spongepowered.api.Platform; -import org.spongepowered.api.Sponge; -public class SpongePlatformInfo implements PlatformInfo { +public class SpongePlatformInfo extends AbstractPlatformInfo { + private final Game game; + + public SpongePlatformInfo(Game game) { + this.game = game; + } + @Override public Type getType() { return Type.SERVER; @@ -37,11 +43,11 @@ public class SpongePlatformInfo implements PlatformInfo { @Override public String getVersion() { - return Sponge.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getVersion().orElse("unknown"); + return this.game.getPlatform().getContainer(Platform.Component.IMPLEMENTATION).getVersion().orElse("unknown"); } @Override public String getMinecraftVersion() { - return Sponge.getPlatform().getMinecraftVersion().getName(); + return this.game.getPlatform().getMinecraftVersion().getName(); } } diff --git a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java index 0c61b0f..d2c842a 100644 --- a/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java +++ b/spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java @@ -23,7 +23,7 @@ package me.lucko.spark.sponge; import com.google.inject.Inject; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; -import me.lucko.spark.common.PlatformInfo; +import me.lucko.spark.common.platform.PlatformInfo; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.sampler.tick.TickHook; import org.spongepowered.api.Game; @@ -127,7 +127,7 @@ public class SpongeSparkPlugin implements SparkPlugin { @Override public PlatformInfo getPlatformInfo() { - return new SpongePlatformInfo(); + return new SpongePlatformInfo(this.game); } private static final class SparkCommand implements CommandCallable { -- cgit