diff options
author | MD <1917406+md678685@users.noreply.github.com> | 2020-06-23 12:02:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 12:02:43 +0100 |
commit | a2af3f8f7e3693f3e445d2998938bf448d47c35f (patch) | |
tree | 91f2f058fb114e96f121b9ee31a69dacb2f4e67f /spark-velocity/src/main/java | |
parent | 12918d40b17a15f0432f7ad85d8db60a87e7c5b8 (diff) | |
download | spark-a2af3f8f7e3693f3e445d2998938bf448d47c35f.tar.gz spark-a2af3f8f7e3693f3e445d2998938bf448d47c35f.tar.bz2 spark-a2af3f8f7e3693f3e445d2998938bf448d47c35f.zip |
Include platform info in sampler and heap summary data (#58)
Diffstat (limited to 'spark-velocity/src/main/java')
-rw-r--r-- | spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityPlatformInfo.java | 53 | ||||
-rw-r--r-- | spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java | 6 |
2 files changed, 59 insertions, 0 deletions
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityPlatformInfo.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityPlatformInfo.java new file mode 100644 index 0000000..81fa21c --- /dev/null +++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocityPlatformInfo.java @@ -0,0 +1,53 @@ +/* + * This file is part of spark. + * + * Copyright (c) lucko (Luck) <luck@lucko.me> + * Copyright (c) contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package me.lucko.spark.velocity; + +import com.velocitypowered.api.proxy.ProxyServer; +import me.lucko.spark.common.PlatformInfo; + +public class VelocityPlatformInfo implements PlatformInfo { + + private final ProxyServer proxy; + + public VelocityPlatformInfo(ProxyServer proxy) { + this.proxy = proxy; + } + + @Override + public Type getType() { + return Type.PROXY; + } + + @Override + public String getName() { + return "Velocity"; + } + + @Override + public String getVersion() { + return this.proxy.getVersion().getVersion(); + } + + @Override + public String getMinecraftVersion() { + return null; + } +} diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java index 4fe8c52..ba59ad4 100644 --- a/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java +++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/VelocitySparkPlugin.java @@ -32,6 +32,7 @@ import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.proxy.ProxyServer; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; +import me.lucko.spark.common.PlatformInfo; import org.checkerframework.checker.optional.qual.MaybePresent; import java.nio.file.Path; @@ -107,4 +108,9 @@ public class VelocitySparkPlugin implements SparkPlugin, Command { public void executeAsync(Runnable task) { this.proxy.getScheduler().buildTask(this, task).schedule(); } + + @Override + public PlatformInfo getPlatformInfo() { + return new VelocityPlatformInfo(this.proxy); + } } |