diff options
author | Luck <git@lucko.me> | 2018-10-15 18:07:29 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2018-10-15 18:07:29 +0100 |
commit | 91775dd2ecc3f3e70dd422f68cf6d06e74db5d49 (patch) | |
tree | a598f6860667cb25b6d5c69301730015d4797f4b /spark-bukkit | |
parent | 648167064ad2064fc5ab77fb57b347253ac9d468 (diff) | |
download | spark-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-bukkit')
-rw-r--r-- | spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java index a11eaf4..122ebf1 100644 --- a/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java +++ b/spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java @@ -20,7 +20,7 @@ package me.lucko.spark.bukkit; -import me.lucko.spark.common.CommandHandler; +import me.lucko.spark.common.SparkPlatform; import me.lucko.spark.sampler.ThreadDumper; import me.lucko.spark.sampler.TickCounter; @@ -32,7 +32,7 @@ import org.bukkit.plugin.java.JavaPlugin; public class SparkBukkitPlugin extends JavaPlugin { - private final CommandHandler<CommandSender> commandHandler = new CommandHandler<CommandSender>() { + private final SparkPlatform<CommandSender> sparkPlatform = new SparkPlatform<CommandSender>() { private String colorize(String message) { return ChatColor.translateAlternateColorCodes('&', message); @@ -48,44 +48,44 @@ public class SparkBukkitPlugin extends JavaPlugin { } @Override - protected String getVersion() { + public String getVersion() { return SparkBukkitPlugin.this.getDescription().getVersion(); } @Override - protected String getLabel() { + public String getLabel() { return "spark"; } @Override - protected void sendMessage(CommandSender sender, String message) { + public void sendMessage(CommandSender sender, String message) { sender.sendMessage(colorize(message)); } @Override - protected void sendMessage(String message) { + public void sendMessage(String message) { String msg = colorize(message); broadcast(msg); } @Override - protected void sendLink(String url) { + public void sendLink(String url) { String msg = colorize("&7" + url); broadcast(msg); } @Override - protected void runAsync(Runnable r) { + public void runAsync(Runnable r) { getServer().getScheduler().runTaskAsynchronously(SparkBukkitPlugin.this, r); } @Override - protected ThreadDumper getDefaultThreadDumper() { + public ThreadDumper getDefaultThreadDumper() { return new ThreadDumper.Specific(new long[]{Thread.currentThread().getId()}); } @Override - protected TickCounter newTickCounter() { + public TickCounter newTickCounter() { return new BukkitTickCounter(SparkBukkitPlugin.this); } }; @@ -97,7 +97,7 @@ public class SparkBukkitPlugin extends JavaPlugin { return true; } - this.commandHandler.handleCommand(sender, args); + this.sparkPlatform.executeCommand(sender, args); return true; } } |