package protocolsupport.listeners;

import java.util.HashSet;
import java.util.Set;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;

public class ReloadCommandBlocker implements Listener {

	private final Set<String> blacklist = new HashSet<>();

	public ReloadCommandBlocker() {
		blacklist.add("/reload");
		blacklist.add("/reload confirm");
		blacklist.add("/rl");
		blacklist.add("/rl confirm");
		blacklist.add("/bukkit:reload");
		blacklist.add("/bukkit:reload confirm");
		blacklist.add("/bukkit:rl");
		blacklist.add("/bukkit:rl confirm");
	}

	@EventHandler
	public void onCommand(PlayerCommandPreprocessEvent event) {
		if (event.getPlayer().hasPermission("bukkit.command.reload") && blacklist.contains(event.getMessage().toLowerCase())) {
			event.setCancelled(true);
			event.getPlayer().sendMessage("The reload command has been disabled by ProtocolSupport");
		}
	}

}

@@ -78,16 +78,45 @@
 l.Set;%0A%0A
+import org.bukkit.ChatColor;%0A
 import o
@@ -239,16 +239,67 @@
 ssEvent;
+%0Aimport org.bukkit.event.server.ServerCommandEvent;
 %0A%0Apublic
@@ -409,40 +409,9 @@
 ();%0A
-%0A%09public ReloadCommandBlocker() 
+%09
 %7B%0A%09%09
@@ -421,25 +421,24 @@
 cklist.add(%22
-/
 reload%22);%0A%09%09
@@ -452,17 +452,16 @@
 st.add(%22
-/
 reload c
@@ -487,17 +487,16 @@
 st.add(%22
-/
 rl%22);%0A%09%09
@@ -510,17 +510,16 @@
 st.add(%22
-/
 rl confi
@@ -533,33 +533,32 @@
 %09blacklist.add(%22
-/
 bukkit:reload%22);
@@ -567,33 +567,32 @@
 %09blacklist.add(%22
-/
 bukkit:reload co
@@ -609,33 +609,32 @@
 %09blacklist.add(%22
-/
 bukkit:rl%22);%0A%09%09b
@@ -651,9 +651,8 @@
 dd(%22
-/
 bukk
@@ -754,123 +754,517 @@
 %7B%0A%09%09
-if (event.getPlayer().hasPermission(%22bukkit.command.reload%22) && blacklist.contains(event.getMessage().toLowerCase()
+String command = event.getMessage().toLowerCase();%0A%09%09if (command.startsWith(%22/%22) && blacklist.contains(command.substring(1))) %7B%0A%09%09%09event.setCancelled(true);%0A%09%09%09event.getPlayer().sendMessage(ChatColor.DARK_RED + %22The reload command has been disabled by ProtocolSupport%22);%0A%09%09%7D%0A%09%7D%0A%0A%09@EventHandler%0A%09public void onConsoleCommand(ServerCommandEvent event) %7B%0A%09%09String command = event.getCommand().toLowerCase();%0A%09%09if (command.startsWith(%22/%22)) %7B%0A%09%09%09command = command.substring(1);%0A%09%09%7D%0A%09%09if (blacklist.contains(command
 )) %7B
@@ -1297,36 +1297,36 @@
 e);%0A%09%09%09event.get
-Play
+Send
 er().sendMessage
@@ -1326,16 +1326,37 @@
 Message(
+ChatColor.DARK_RED + 
 %22The rel

Improve reload command blocker