diff options
author | Luck <git@lucko.me> | 2018-05-29 01:01:30 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2018-05-29 01:01:30 +0100 |
commit | bf72b1560340b48fc0958b3b2038ba13d49b7190 (patch) | |
tree | d3035fb87c625024144f1e5f4985c120b2fac030 /common/src/main | |
parent | a895841c1c9d8bc94651246d4645ede5b4d54d06 (diff) | |
download | spark-bf72b1560340b48fc0958b3b2038ba13d49b7190.tar.gz spark-bf72b1560340b48fc0958b3b2038ba13d49b7190.tar.bz2 spark-bf72b1560340b48fc0958b3b2038ba13d49b7190.zip |
Multiple fixes
* Fixed an issue which prevented links from being “clickable”
* Added a /spark alias
* Added a max stack depth limit to fix issues with rendering
Diffstat (limited to 'common/src/main')
-rw-r--r-- | common/src/main/java/com/sk89q/warmroast/StackNode.java | 6 | ||||
-rw-r--r-- | common/src/main/java/me/lucko/spark/common/CommandHandler.java | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/common/src/main/java/com/sk89q/warmroast/StackNode.java b/common/src/main/java/com/sk89q/warmroast/StackNode.java index f077309..8fd0661 100644 --- a/common/src/main/java/com/sk89q/warmroast/StackNode.java +++ b/common/src/main/java/com/sk89q/warmroast/StackNode.java @@ -36,6 +36,8 @@ import java.util.Map; */ public class StackNode implements Comparable<StackNode> { + private static final int MAX_STACK_DEPTH = 300; + /** * The name of this node */ @@ -87,6 +89,10 @@ public class StackNode implements Comparable<StackNode> { private void log(StackTraceElement[] elements, int skip, long time) { accumulateTime(time); + + if (skip >= MAX_STACK_DEPTH) { + return; + } if (elements.length - skip == 0) { return; 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 c015cb3..52cdbe1 100644 --- a/common/src/main/java/me/lucko/spark/common/CommandHandler.java +++ b/common/src/main/java/me/lucko/spark/common/CommandHandler.java @@ -51,6 +51,7 @@ public abstract class CommandHandler<T> { // abstract methods implemented by each platform protected abstract void sendMessage(T sender, String message); + protected abstract void sendLink(T sender, String url); protected abstract void runAsync(Runnable r); private void sendPrefixedMessage(T sender, String message) { @@ -231,7 +232,8 @@ public abstract class CommandHandler<T> { JsonObject output = sampler.formOutput(); try { String pasteId = Bytebin.postContent(output); - sendPrefixedMessage(sender, "&bSampling results: &7" + VIEWER_URL + pasteId); + sendPrefixedMessage(sender, "&bSampling results:"); + sendLink(sender, VIEWER_URL + pasteId); } catch (IOException e) { sendPrefixedMessage(sender, "&cAn error occurred whilst uploading the results."); e.printStackTrace(); |