Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {
- boolean Command = plugin.getConfig().getBoolean("Actions.CommandDetector.enabled");
- if(Command == true) {
- Player p = event.getPlayer();
- if (!p.hasPermission("EpicBlocks.command.bypass")) {
- List<String> cmds = plugin.getConfig().getStringList("Actions.CommandDetector.Command-BlackList");
- for (String command : cmds) {
- if (event.getMessage().toLowerCase().startsWith("/" + command)) {
- String cant = plugin.getConfig().getString("message.error-command");
- String prefix = plugin.getConfig().getString("message.prefix-CommandDetector");
- cant.replace("&", "§");
- prefix.replace("&", "§");
- p.sendMessage(prefix + cant);
- String efe = plugin.getConfig().getString("sounds.blacklist");
- event.setCancelled(true);
- p.getWorld().playSound(p.getLocation(), Sound.valueOf(efe), 5, 1);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement