aboutsummaryrefslogtreecommitdiff
path: root/spark-velocity/src
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-10-15 18:07:29 +0100
committerLuck <git@lucko.me>2018-10-15 18:07:29 +0100
commit91775dd2ecc3f3e70dd422f68cf6d06e74db5d49 (patch)
treea598f6860667cb25b6d5c69301730015d4797f4b /spark-velocity/src
parent648167064ad2064fc5ab77fb57b347253ac9d468 (diff)
downloadspark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.tar.gz
spark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.tar.bz2
spark-91775dd2ecc3f3e70dd422f68cf6d06e74db5d49.zip
Start work on commands refactoring
Long term goals are: - tab completion - auto generate usage/info messages
Diffstat (limited to 'spark-velocity/src')
-rw-r--r--spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java b/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java
index 3d849c6..4cec138 100644
--- a/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java
+++ b/spark-velocity/src/main/java/me/lucko/spark/velocity/SparkVelocityPlugin.java
@@ -29,7 +29,7 @@ import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
-import me.lucko.spark.common.CommandHandler;
+import me.lucko.spark.common.SparkPlatform;
import me.lucko.spark.sampler.ThreadDumper;
import me.lucko.spark.sampler.TickCounter;
@@ -50,7 +50,7 @@ public class SparkVelocityPlugin {
private final ProxyServer proxy;
- private final CommandHandler<CommandSource> commandHandler = new CommandHandler<CommandSource>() {
+ private final SparkPlatform<CommandSource> sparkPlatform = new SparkPlatform<CommandSource>() {
@SuppressWarnings("deprecation")
private TextComponent colorize(String message) {
return ComponentSerializers.LEGACY.deserialize(message, '&');
@@ -66,27 +66,27 @@ public class SparkVelocityPlugin {
}
@Override
- protected String getVersion() {
+ public String getVersion() {
return SparkVelocityPlugin.class.getAnnotation(Plugin.class).version();
}
@Override
- protected String getLabel() {
+ public String getLabel() {
return "sparkvelocity";
}
@Override
- protected void sendMessage(CommandSource sender, String message) {
+ public void sendMessage(CommandSource sender, String message) {
sender.sendMessage(colorize(message));
}
@Override
- protected void sendMessage(String message) {
+ public void sendMessage(String message) {
broadcast(colorize(message));
}
@Override
- protected void sendLink(String url) {
+ public void sendLink(String url) {
TextComponent msg = TextComponent.builder(url)
.color(TextColor.GRAY)
.clickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url))
@@ -95,17 +95,17 @@ public class SparkVelocityPlugin {
}
@Override
- protected void runAsync(Runnable r) {
+ public void runAsync(Runnable r) {
SparkVelocityPlugin.this.proxy.getScheduler().buildTask(SparkVelocityPlugin.this, r).schedule();
}
@Override
- protected ThreadDumper getDefaultThreadDumper() {
+ public ThreadDumper getDefaultThreadDumper() {
return ThreadDumper.ALL;
}
@Override
- protected TickCounter newTickCounter() {
+ public TickCounter newTickCounter() {
throw new UnsupportedOperationException();
}
};
@@ -124,7 +124,7 @@ public class SparkVelocityPlugin {
return;
}
- SparkVelocityPlugin.this.commandHandler.handleCommand(sender, args);
+ SparkVelocityPlugin.this.sparkPlatform.executeCommand(sender, args);
}, "sparkvelocity", "vprofiler");
}
}