diff options
Diffstat (limited to 'bukkit/src')
-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 |