From bf72b1560340b48fc0958b3b2038ba13d49b7190 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 29 May 2018 01:01:30 +0100 Subject: Multiple fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed an issue which prevented links from being “clickable” * Added a /spark alias * Added a max stack depth limit to fix issues with rendering --- common/src/main/java/com/sk89q/warmroast/StackNode.java | 6 ++++++ common/src/main/java/me/lucko/spark/common/CommandHandler.java | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'common/src/main/java') 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 { + private static final int MAX_STACK_DEPTH = 300; + /** * The name of this node */ @@ -87,6 +89,10 @@ public class StackNode implements Comparable { 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 { // 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 { 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(); -- cgit