Advertisement
agentsix1

nothing to see here 2

May 13th, 2017
38,945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.77 KB | None | 0 0
  1. //---- Detect Custom Chat - This was added to allow custom commands with custom chats! - Added v0.8.2
  2.     @EventHandler
  3.     public void detectCustomChat(PlayerCommandPreprocessEvent e) {
  4.         Player p = e.getPlayer();
  5.        
  6.         if (p.hasPermission("vippluschat.allowchat")) {
  7.            
  8.             try {
  9.                 String[] cmd = e.getMessage().split(" ");
  10.                 int chatID = detectChatID(cmd[0].replace("/", ""));
  11.                 if (chatID > -1 & p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  12.                         String msg = "";
  13.                         for(int i = 0; i < cmd.length; i++){
  14.                             if (i != 0) {
  15.                                 String fmsg = cmd[i] + " ";
  16.                                 msg = msg + fmsg;
  17.                             }
  18.                         }
  19.                         e.setCancelled(true);
  20.                         if (serverAntiSwear(chatID)) {
  21.                              msg = antiswearServerCheck(msg, chatID);
  22.                                 if (msg.equalsIgnoreCase("ERROR: 1337 - Banned Message")) {
  23.                                     pMessage(getConfig().getString("Messages.antiswear-banned").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), e.getPlayer());
  24.                                 } else {
  25.                                     sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  26.                                 }
  27.                         } else {
  28.                             sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  29.                         }
  30.                 }
  31.             } catch (ArrayIndexOutOfBoundsException catcherror) {
  32.                 int chatID = detectChatID(e.getMessage().replace("/", ""));
  33.                 if (chatID > -1) {
  34.                     if (p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  35.                         e.setCancelled(true);
  36.                     }
  37.                 }
  38.             }
  39.         }
  40.        
  41.     }
  42.     //---- End Detect Custom Chat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement