aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java6
-rw-r--r--bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java8
-rw-r--r--common/src/main/java/me/lucko/spark/common/CommandHandler.java3
-rw-r--r--sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java6
4 files changed, 21 insertions, 2 deletions
diff --git a/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java b/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
index cc774a3..8b3ed28 100644
--- a/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
+++ b/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
@@ -1,6 +1,7 @@
package me.lucko.spark.bukkit;
import me.lucko.spark.common.CommandHandler;
+import me.lucko.spark.profiler.ThreadDumper;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
@@ -24,6 +25,11 @@ public class SparkBukkitPlugin extends JavaPlugin {
protected void runAsync(Runnable r) {
getServer().getScheduler().runTaskAsynchronously(SparkBukkitPlugin.this, r);
}
+
+ @Override
+ protected ThreadDumper getDefaultThreadDumper() {
+ return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
+ }
};
@Override
diff --git a/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java b/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java
index c23e303..717497c 100644
--- a/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java
+++ b/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java
@@ -1,6 +1,7 @@
package me.lucko.spark.bungeecord;
import me.lucko.spark.common.CommandHandler;
+import me.lucko.spark.profiler.ThreadDumper;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
@@ -29,11 +30,16 @@ public class SparkBungeeCordPlugin extends Plugin {
protected void runAsync(Runnable r) {
getProxy().getScheduler().runAsync(SparkBungeeCordPlugin.this, r);
}
+
+ @Override
+ protected ThreadDumper getDefaultThreadDumper() {
+ return new ThreadDumper.All();
+ }
};
@Override
public void onEnable() {
- getProxy().getPluginManager().registerCommand(this, new Command("spark", null, "profiler") {
+ getProxy().getPluginManager().registerCommand(this, new Command("sparkbungee", null, "gprofiler") {
@Override
public void execute(CommandSender sender, String[] args) {
if (!sender.hasPermission("spark.profiler")) {
diff --git a/common/src/main/java/me/lucko/spark/common/CommandHandler.java b/common/src/main/java/me/lucko/spark/common/CommandHandler.java
index 8956fa8..e781404 100644
--- a/common/src/main/java/me/lucko/spark/common/CommandHandler.java
+++ b/common/src/main/java/me/lucko/spark/common/CommandHandler.java
@@ -54,6 +54,7 @@ public abstract class CommandHandler<T> {
protected abstract void sendMessage(T sender, String message);
protected abstract void sendLink(T sender, String url);
protected abstract void runAsync(Runnable r);
+ protected abstract ThreadDumper getDefaultThreadDumper();
private void sendPrefixedMessage(T sender, String message) {
sendMessage(sender, "&8[&fspark&8] &7" + message);
@@ -124,7 +125,7 @@ public abstract class CommandHandler<T> {
ThreadDumper threadDumper;
if (threadName == null) {
// use the server thread
- threadDumper = new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
+ threadDumper = getDefaultThreadDumper();
} else if (threadName.equals("*")) {
threadDumper = new ThreadDumper.All();
} else {
diff --git a/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java b/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java
index 92ecc43..cad19df 100644
--- a/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java
+++ b/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java
@@ -3,6 +3,7 @@ package me.lucko.spark.sponge;
import com.google.inject.Inject;
import me.lucko.spark.common.CommandHandler;
+import me.lucko.spark.profiler.ThreadDumper;
import me.lucko.spark.sponge.utils.PomData;
import org.spongepowered.api.Game;
@@ -63,6 +64,11 @@ public class SparkSpongePlugin implements CommandCallable {
protected void runAsync(Runnable r) {
asyncExecutor.execute(r);
}
+
+ @Override
+ protected ThreadDumper getDefaultThreadDumper() {
+ return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()});
+ }
};
@Inject