@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(priority = EventPriority.HIGHEST)
 public void vipLogin(PlayerLoginEvent e) {
   if (e.getResult() != Result.KICK_FULL) return;
   if (!PConfManager.getPConfExists(e.getPlayer())) return;
   if (e.getPlayer().isBanned()) return;
   if (PConfManager.getPVal(e.getPlayer(), "vip") != null
       && PConfManager.getPValBoolean(e.getPlayer(), "vip")) e.allow();
 }
 @EventHandler(priority = EventPriority.HIGH)
 public void onPlayerMove(PlayerMoveEvent event) {
   if (event.isCancelled()) return;
   if (AFKUtils.isAfk(event.getPlayer())) {
     AFKUtils.unsetAfk(event.getPlayer());
     plugin.getServer().broadcastMessage(event.getPlayer().getName() + " is no longer AFK.");
     return;
   }
   if (PConfManager.getPValBoolean(event.getPlayer(), "frozen")) event.setCancelled(true);
 }
 @EventHandler(priority = EventPriority.HIGH)
 public void onTeleport(PlayerTeleportEvent e) {
   if (e.isCancelled()) return;
   if (PConfManager.getPValBoolean(e.getPlayer(), "jailed")) {
     e.getPlayer().sendMessage(ChatColor.RED + "You are jailed and may not teleport.");
     e.setCancelled(true);
     return;
   }
   if (CmdBack.backdb.containsKey(e.getPlayer()))
     if (CmdBack.backdb.get(e.getPlayer()).equals(e.getFrom())) return;
   CmdBack.backdb.put(e.getPlayer(), e.getFrom());
 }
 @EventHandler(priority = EventPriority.LOWEST)
 public void onPlayerInteract(PlayerInteractEvent event) {
   if (PConfManager.getPValBoolean(event.getPlayer(), "jailed")) event.setCancelled(true);
   Action act = event.getAction();
   if (act.equals(Action.PHYSICAL)) return;
   ItemStack id = event.getItem();
   if (id == null) return;
   int idn = id.getTypeId();
   if (idn == 0) return;
   List<String> cmds = PConfManager.getPValStringList(event.getPlayer(), "assign." + idn);
   if (cmds == null) return;
   for (String s : cmds) {
     if (s.toLowerCase().trim().startsWith("c:")) event.getPlayer().chat(s.trim().substring(2));
     else event.getPlayer().performCommand(s.trim());
   }
 }
 @EventHandler(priority = EventPriority.LOW)
 public void onPlayerChat(PlayerChatEvent event) {
   if (event.isCancelled()) return;
   if (AFKUtils.isAfk(event.getPlayer())) {
     AFKUtils.unsetAfk(event.getPlayer());
     plugin.getServer().broadcastMessage(event.getPlayer().getName() + " is no longer AFK.");
   }
   if (PConfManager.getPValBoolean(event.getPlayer(), "muted")) {
     if (PConfManager.getPVal(event.getPlayer(), "mutetime") != null
         && !RUtils.isTimeStampValid(event.getPlayer(), "mutetime"))
       PConfManager.setPValBoolean(event.getPlayer(), false, "muted");
     event.setFormat("");
     event.setCancelled(true);
     event.getPlayer().sendMessage(ChatColor.RED + "You are muted.");
     plugin.log.info(
         "[RoyalCommands] "
             + event.getPlayer().getName()
             + " tried to speak, but has been muted.");
   }
 }
 @EventHandler
 public void onPInt(PlayerInteractEvent event) {
   if (PConfManager.getPValBoolean(event.getPlayer(), "frozen")) event.setCancelled(true);
   if (plugin.buildPerm)
     if (!plugin.isAuthorized(event.getPlayer(), "rcmds.build")) event.setCancelled(true);
 }