@EventHandler(priority = EventPriority.LOWEST)
  public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
    if (event.isCancelled()) return;
    if (plugin.showcommands)
      log.info("[PLAYER_COMMAND] " + event.getPlayer().getName() + ": " + event.getMessage());
    if (PConfManager.getPValBoolean(event.getPlayer(), "muted")) {
      if (PConfManager.getPVal(event.getPlayer(), "mutetime") != null
          && !RUtils.isTimeStampValid(event.getPlayer(), "mutetime"))
        PConfManager.setPValBoolean(event.getPlayer(), false, "muted");
      for (String command : plugin.muteCmds) {
        if (!(event.getMessage().toLowerCase().startsWith(command.toLowerCase() + " ")
            || event.getMessage().equalsIgnoreCase(command.toLowerCase()))) continue;
        event.getPlayer().sendMessage(ChatColor.RED + "You are muted.");
        log.info(
            "[RoyalCommands] "
                + event.getPlayer().getName()
                + " tried to use that command, but is muted.");
        event.setCancelled(true);
      }
    }

    if (PConfManager.getPValBoolean(event.getPlayer(), "jailed")) {
      event.getPlayer().sendMessage(ChatColor.RED + "You are jailed.");
      log.info(
          "[RoyalCommands] "
              + event.getPlayer().getName()
              + " tried to use that command, but is jailed.");
      event.setCancelled(true);
    }
  }
 @EventHandler
 public void commandCooldown(PlayerCommandPreprocessEvent e) {
   if (e.isCancelled()) return;
   String command = e.getMessage().split(" ")[0].toLowerCase().substring(1);
   if (plugin.getCommand(command) != null) command = plugin.getCommand(command).getName();
   Player p = e.getPlayer();
   if (plugin.isAuthorized(p, "rcmds.exempt.cooldown.commands")) return;
   Long currentcd = PConfManager.getPValLong(p, "command_cooldowns." + command);
   if (currentcd != null) {
     if (currentcd <= new Date().getTime()) {
       setCooldown(command, p);
       return;
     }
     p.sendMessage(
         ChatColor.RED
             + "You can't use that command for"
             + ChatColor.GRAY
             + RUtils.formatDateDiff(currentcd)
             + ChatColor.RED
             + ".");
     e.setCancelled(true);
     return;
   }
   setCooldown(command, p);
 }