aboutsummaryrefslogtreecommitdiff
path: root/sponge/src/main/java
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 /sponge/src/main/java
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
Diffstat (limited to 'sponge/src/main/java')
-rw-r--r--sponge/src/main/java/me/lucko/spark/sponge/SparkSpongePlugin.java22
1 files changed, 20 insertions, 2 deletions
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