Advertisement
MiniRoger123

Untitled

Oct 27th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. @EventHandler(priority = EventPriority.HIGHEST)
  2. public void onPlayerCommandPreprocessEvent(PlayerCommandPreprocessEvent event) {
  3. boolean Command = plugin.getConfig().getBoolean("Actions.CommandDetector.enabled");
  4. if(Command == true) {
  5. Player p = event.getPlayer();
  6. if (!p.hasPermission("EpicBlocks.command.bypass")) {
  7. List<String> cmds = plugin.getConfig().getStringList("Actions.CommandDetector.Command-BlackList");
  8. for (String command : cmds) {
  9. if (event.getMessage().toLowerCase().startsWith("/" + command)) {
  10. String cant = plugin.getConfig().getString("message.error-command");
  11. String prefix = plugin.getConfig().getString("message.prefix-CommandDetector");
  12. cant.replace("&", "§");
  13. prefix.replace("&", "§");
  14. p.sendMessage(prefix + cant);
  15. String efe = plugin.getConfig().getString("sounds.blacklist");
  16. event.setCancelled(true);
  17. p.getWorld().playSound(p.getLocation(), Sound.valueOf(efe), 5, 1);
  18. }
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement