From b1bdc139b48517a8bcc88888147f5f1a65b48f93 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 13 May 2019 12:51:54 +0100 Subject: Change the way CPU monitoring is performed --- .../main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'spark-bukkit') diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java index 6d0d96e..ad6fa56 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java @@ -23,11 +23,8 @@ package me.lucko.spark.bukkit; import me.lucko.spark.common.CommandSender; import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.common.SparkPlugin; -import me.lucko.spark.common.command.CommandResponseHandler; -import me.lucko.spark.common.monitor.tick.TpsCalculator; import me.lucko.spark.common.sampler.ThreadDumper; import me.lucko.spark.common.sampler.TickCounter; -import net.kyori.text.TextComponent; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -56,10 +53,13 @@ public class SparkBukkitPlugin extends JavaPlugin implements SparkPlugin { return true; } - CommandResponseHandler resp = new CommandResponseHandler(this.platform, new BukkitCommandSender(sender)); - TpsCalculator tpsCalculator = this.platform.getTpsCalculator(); - resp.replyPrefixed(TextComponent.of("TPS from last 5s, 10s, 1m, 5m, 15m:")); - resp.replyPrefixed(TextComponent.builder(" ").append(tpsCalculator.toFormattedComponent()).build()); + BukkitCommandSender s = new BukkitCommandSender(sender) { + @Override + public boolean hasPermission(String permission) { + return true; + } + }; + this.platform.executeCommand(s, new String[]{"tps"}); return true; }; CommandMapUtil.registerCommand(this, this.tpsCommand, "tps"); -- cgit