aboutsummaryrefslogtreecommitdiff
path: root/spark-bukkit/src/main/java
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-10-15 22:00:05 +0100
committerLuck <git@lucko.me>2018-10-15 22:00:05 +0100
commit8e25dac340a07f7a57a13bdde53b0605779ea920 (patch)
tree3f034154fe8630f6cbf5648c9d2cb6b1426b9efe /spark-bukkit/src/main/java
parent91775dd2ecc3f3e70dd422f68cf6d06e74db5d49 (diff)
downloadspark-8e25dac340a07f7a57a13bdde53b0605779ea920.tar.gz
spark-8e25dac340a07f7a57a13bdde53b0605779ea920.tar.bz2
spark-8e25dac340a07f7a57a13bdde53b0605779ea920.zip
Implement tab completion, update readme
Diffstat (limited to 'spark-bukkit/src/main/java')
-rw-r--r--spark-bukkit/src/main/java/me/lucko/spark/bukkit/SparkBukkitPlugin.java15
1 files changed, 13 insertions, 2 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 122ebf1..aebf9a7 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
@@ -30,6 +30,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
+import java.util.Collections;
+import java.util.List;
+
public class SparkBukkitPlugin extends JavaPlugin {
private final SparkPlatform<CommandSender> sparkPlatform = new SparkPlatform<CommandSender>() {
@@ -41,7 +44,7 @@ public class SparkBukkitPlugin extends JavaPlugin {
private void broadcast(String msg) {
getServer().getConsoleSender().sendMessage(msg);
for (Player player : getServer().getOnlinePlayers()) {
- if (player.hasPermission("spark.profiler")) {
+ if (player.hasPermission("spark")) {
player.sendMessage(msg);
}
}
@@ -92,7 +95,7 @@ public class SparkBukkitPlugin extends JavaPlugin {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (!sender.hasPermission("spark.profiler")) {
+ if (!sender.hasPermission("spark")) {
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
return true;
}
@@ -100,4 +103,12 @@ public class SparkBukkitPlugin extends JavaPlugin {
this.sparkPlatform.executeCommand(sender, args);
return true;
}
+
+ @Override
+ public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
+ if (!sender.hasPermission("spark")) {
+ return Collections.emptyList();
+ }
+ return this.sparkPlatform.tabCompleteCommand(sender, args);
+ }
}