aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-05-29 01:01:30 +0100
committerLuck <git@lucko.me>2018-05-29 01:01:30 +0100
commitbf72b1560340b48fc0958b3b2038ba13d49b7190 (patch)
treed3035fb87c625024144f1e5f4985c120b2fac030
parenta895841c1c9d8bc94651246d4645ede5b4d54d06 (diff)
downloadspark-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
-rw-r--r--bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java5
-rw-r--r--bukkit/src/main/resources/plugin.yml7
-rw-r--r--bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java11
-rw-r--r--bungeecord/src/main/resources/bungee.yml2
-rw-r--r--common/src/main/java/com/sk89q/warmroast/StackNode.java6
-rw-r--r--common/src/main/java/me/lucko/spark/common/CommandHandler.java4
-rw-r--r--sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java22
-rw-r--r--universal/pom.xml24
8 files changed, 73 insertions, 8 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 0ddbce0..cc774a3 100644
--- a/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
+++ b/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java
@@ -16,6 +16,11 @@ public class SparkBukkitPlugin extends JavaPlugin {
}
@Override
+ protected void sendLink(CommandSender sender, String url) {
+ sendMessage(sender, "&7" + url);
+ }
+
+ @Override
protected void runAsync(Runnable r) {
getServer().getScheduler().runTaskAsynchronously(SparkBukkitPlugin.this, r);
}
diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml
index a1e473e..1914e04 100644
--- a/bukkit/src/main/resources/plugin.yml
+++ b/bukkit/src/main/resources/plugin.yml
@@ -1,9 +1,10 @@
name: spark
-version: ${project.version}
+version: 1.0.2
description: ${project.description}
authors: [Luck, sk89q]
main: me.lucko.spark.bukkit.SparkBukkitPlugin
commands:
- profiler:
- description: Main plugin command \ No newline at end of file
+ spark:
+ description: Main plugin command
+ aliases: [profiler] \ No newline at end of file
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 2f43744..c23e303 100644
--- a/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java
+++ b/bungeecord/src/main/java/me/lucko/spark/bungeecord/SparkBungeeCordPlugin.java
@@ -4,6 +4,7 @@ import me.lucko.spark.common.CommandHandler;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
+import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.plugin.Plugin;
@@ -17,6 +18,14 @@ public class SparkBungeeCordPlugin extends Plugin {
}
@Override
+ protected void sendLink(CommandSender sender, String url) {
+ TextComponent component = new TextComponent(url);
+ component.setColor(ChatColor.GRAY);
+ component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
+ sender.sendMessage(component);
+ }
+
+ @Override
protected void runAsync(Runnable r) {
getProxy().getScheduler().runAsync(SparkBungeeCordPlugin.this, r);
}
@@ -24,7 +33,7 @@ public class SparkBungeeCordPlugin extends Plugin {
@Override
public void onEnable() {
- getProxy().getPluginManager().registerCommand(this, new Command("profiler", null) {
+ getProxy().getPluginManager().registerCommand(this, new Command("spark", null, "profiler") {
@Override
public void execute(CommandSender sender, String[] args) {
if (!sender.hasPermission("spark.profiler")) {
diff --git a/bungeecord/src/main/resources/bungee.yml b/bungeecord/src/main/resources/bungee.yml
index d5aede0..cfcac19 100644
--- a/bungeecord/src/main/resources/bungee.yml
+++ b/bungeecord/src/main/resources/bungee.yml
@@ -1,5 +1,5 @@
name: spark
-version: ${project.version}
+version: 1.0.2
description: ${project.description}
author: Luck, sk89q
main: me.lucko.spark.bungeecord.SparkBungeeCordPlugin
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();
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 b763549..92ecc43 100644
--- a/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java
+++ b/sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java
@@ -14,12 +14,16 @@ import org.spongepowered.api.event.game.state.GameStartedServerEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.scheduler.AsynchronousExecutor;
import org.spongepowered.api.scheduler.SpongeExecutorService;
+import org.spongepowered.api.text.LiteralText;
import org.spongepowered.api.text.Text;
+import org.spongepowered.api.text.action.TextActions;
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.serializer.TextSerializers;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -29,7 +33,7 @@ import javax.annotation.Nullable;
@Plugin(
id = "spark",
name = "spark",
- version = PomData.VERSION,
+ version = "1.0.2",
description = PomData.DESCRIPTION,
authors = {"Luck", "sk89q"}
)
@@ -42,6 +46,20 @@ public class SparkSpongePlugin implements CommandCallable {
}
@Override
+ protected void sendLink(CommandSource sender, String url) {
+ try {
+ LiteralText text = Text.builder(url)
+ .color(TextColors.GRAY)
+ .onClick(TextActions.openUrl(new URL(url)))
+ .build();
+
+ sender.sendMessage(text);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
protected void runAsync(Runnable r) {
asyncExecutor.execute(r);
}
@@ -56,7 +74,7 @@ public class SparkSpongePlugin implements CommandCallable {
@Listener
public void onServerStart(GameStartedServerEvent event) {
- game.getCommandManager().register(this, this, "profiler");
+ game.getCommandManager().register(this, this, "spark", "profiler");
}
@Override
diff --git a/universal/pom.xml b/universal/pom.xml
index ad6fb74..507df7b 100644
--- a/universal/pom.xml
+++ b/universal/pom.xml
@@ -47,6 +47,30 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>sign</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>me.lucko</groupId>