diff options
author | Luck <git@lucko.me> | 2018-05-26 22:52:58 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2018-05-27 00:02:02 +0100 |
commit | 429eeb35876576d861404cd199b6e9763fc4e5b0 (patch) | |
tree | 624e1c05433e8ab5775a0177ecf5d5982de54805 /bukkit/src/main | |
parent | 3fe5e5517b1c529d95cf9f43fd8420c66db0092a (diff) | |
download | spark-429eeb35876576d861404cd199b6e9763fc4e5b0.tar.gz spark-429eeb35876576d861404cd199b6e9763fc4e5b0.tar.bz2 spark-429eeb35876576d861404cd199b6e9763fc4e5b0.zip |
Initial commit for spark
Diffstat (limited to 'bukkit/src/main')
-rw-r--r-- | bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java | 34 | ||||
-rw-r--r-- | bukkit/src/main/resources/plugin.yml | 9 |
2 files changed, 43 insertions, 0 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 new file mode 100644 index 0000000..0ddbce0 --- /dev/null +++ b/bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java @@ -0,0 +1,34 @@ +package me.lucko.spark.bukkit; + +import me.lucko.spark.common.CommandHandler; + +import org.bukkit.ChatColor; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.plugin.java.JavaPlugin; + +public class SparkBukkitPlugin extends JavaPlugin { + + private final CommandHandler<CommandSender> commandHandler = new CommandHandler<CommandSender>() { + @Override + protected void sendMessage(CommandSender sender, String message) { + sender.sendMessage(ChatColor.translateAlternateColorCodes('&', message)); + } + + @Override + protected void runAsync(Runnable r) { + getServer().getScheduler().runTaskAsynchronously(SparkBukkitPlugin.this, r); + } + }; + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!sender.hasPermission("spark.profiler")) { + sender.sendMessage(ChatColor.RED + "You do not have permission to use this command."); + return true; + } + + this.commandHandler.handleCommand(sender, args); + return true; + } +} diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml new file mode 100644 index 0000000..a1e473e --- /dev/null +++ b/bukkit/src/main/resources/plugin.yml @@ -0,0 +1,9 @@ +name: spark +version: ${project.version} +description: ${project.description} +authors: [Luck, sk89q] +main: me.lucko.spark.bukkit.SparkBukkitPlugin + +commands: + profiler: + description: Main plugin command
\ No newline at end of file |