aboutsummaryrefslogtreecommitdiff
path: root/spark-sponge/src
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2020-06-23 12:27:34 +0100
committerLuck <git@lucko.me>2020-06-23 12:27:34 +0100
commit85561633292550209a1461347f8446b54552b391 (patch)
treec5bf09a6a0a1bb0324f8e14ecda790184a183c2c /spark-sponge/src
parenta2af3f8f7e3693f3e445d2998938bf448d47c35f (diff)
downloadspark-85561633292550209a1461347f8446b54552b391.tar.gz
spark-85561633292550209a1461347f8446b54552b391.tar.bz2
spark-85561633292550209a1461347f8446b54552b391.zip
Add n-cpus and heap usage to platform info
Diffstat (limited to 'spark-sponge/src')
-rw-r--r--spark-sponge/src/main/java/me/lucko/spark/sponge/SpongePlatformInfo.java16
-rw-r--r--spark-sponge/src/main/java/me/lucko/spark/sponge/SpongeSparkPlugin.java4
2 files changed, 13 insertions, 7 deletions
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 {