summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/command/SimpleCommandMap.java1
-rw-r--r--src/main/java/org/bukkit/command/defaults/BanListCommand.java37
2 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 5965e4d7..5fa0f07a 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -42,6 +42,7 @@ public class SimpleCommandMap implements CommandMap {
fallbackCommands.add(new HelpCommand());
fallbackCommands.add(new ExpCommand());
fallbackCommands.add(new ToggleDownfallCommand());
+ fallbackCommands.add(new BanListCommand());
}
public SimpleCommandMap(final Server server) {
diff --git a/src/main/java/org/bukkit/command/defaults/BanListCommand.java b/src/main/java/org/bukkit/command/defaults/BanListCommand.java
new file mode 100644
index 00000000..b844faed
--- /dev/null
+++ b/src/main/java/org/bukkit/command/defaults/BanListCommand.java
@@ -0,0 +1,37 @@
+package org.bukkit.command.defaults;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.CommandSender;
+
+public class BanListCommand extends VanillaCommand {
+ public BanListCommand() {
+ super("banlist");
+ this.description = "View all players banned from this server";
+ this.usageMessage = "/banlist";
+ this.setPermission("bukkit.command.ban.list");
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String currentAlias, String[] args) {
+ if (!testPermission(sender)) return true;
+
+ StringBuilder message = new StringBuilder().append(ChatColor.GRAY).append("Ban list:");
+
+ int count = 0;
+ for (OfflinePlayer p : Bukkit.getServer().getBannedPlayers()){
+ if (count++ > 0) {
+ message.append(", ");
+ }
+ message.append(p.getName());
+ }
+ sender.sendMessage(message.toString());
+ return true;
+ }
+
+ @Override
+ public boolean matches(String input) {
+ return input.startsWith("banlist ") || input.equalsIgnoreCase("banlist");
+ }
+}