Advertisement
agentsix1

Public - VIP+ Chat v0.8.5 - Source - 1.7.9 - 1.14.x

May 19th, 2017
41,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 133.40 KB | None | 0 0
  1. package me.kronix.staffchat;
  2.  
  3.  
  4. import java.io.BufferedReader;
  5. import java.io.File;
  6. import java.io.FileInputStream;
  7. import java.io.FileNotFoundException;
  8. import java.io.IOException;
  9. import java.io.InputStream;
  10. import java.io.InputStreamReader;
  11. import java.io.Reader;
  12. import java.io.UnsupportedEncodingException;
  13. import java.net.MalformedURLException;
  14. import java.net.URL;
  15. import java.net.URLConnection;
  16. import java.util.ArrayList;
  17. import java.util.Arrays;
  18. import java.util.HashMap;
  19. import java.util.List;
  20. import java.util.logging.Level;
  21.  
  22. import org.apache.commons.lang.StringUtils;
  23. import org.bukkit.Bukkit;
  24. import org.bukkit.ChatColor;
  25. import org.bukkit.OfflinePlayer;
  26. import org.bukkit.command.Command;
  27. import org.bukkit.command.CommandSender;
  28. import org.bukkit.configuration.file.FileConfiguration;
  29. import org.bukkit.configuration.file.YamlConfiguration;
  30. import org.bukkit.entity.Player;
  31. import org.bukkit.event.EventHandler;
  32. import org.bukkit.event.Listener;
  33. import org.bukkit.event.player.AsyncPlayerChatEvent;
  34. import org.bukkit.event.player.PlayerCommandPreprocessEvent;
  35. import org.bukkit.event.player.PlayerJoinEvent;
  36. import org.bukkit.plugin.java.JavaPlugin;
  37.  
  38. /* List of commands - Added v0.8.2 - Updated v0.8.5 - 2/14/2017, 2/15/2017
  39.     /{chat} {message} - The chat command is defied with in the chat.yml config. This command allows you to chat in the chats --- v0.1
  40.     Permission:
  41.     - vippluschat.chat.{permission} - The permission is defined in the chat.yml
  42.     - vippluschat.chat.* - Gives you permission to all the chats
  43.     - vippluschat.allowchat - This is required on top of the permission used for the indivual chats.
  44.    
  45.     /vpc help - This allows the player to see any commands he can use with this plugin. --- (As bad as it sounds this was added v0.8.5....) v0.8.5
  46.     Permission:
  47.     - vippluschat.user.help
  48.    
  49.     /vpc pstatus | Optional 1: {blacklisted/ignored} | Optionatl 2: {chat} - This is used to check the players current status. He can see what he may be blacklisted or ignoring. He may also specify the chat if he wants. --- v0.8.5 - 2/23/2017
  50.     Permission:
  51.     - vippluschat.user.pstatus.blacklisted
  52.     - vippluschat.user.pstatus.ignored
  53.     - vippluschat.user.pstatus
  54.      
  55.     /vpc focus {chat} - Toggles a player in/out focus mode for the specified chat. --- v0.8.5 - 2/14/2017
  56.     Permission:
  57.     - vippluschat.chat.focus.{chat}
  58.     - vippluschat.chat.focus.*
  59.    
  60.     /vpc ignoreplayer {player/clear} | Optional: {+,add,rem,remove,del,delete,-,clear} - Allows a player to ignore another player inside chats. --- v0.8.5 2/27/2017
  61.     Permission:
  62.     - vippluschat.user.playerignore
  63.    
  64.     /vpc listplayers | Optional: {#} - Allows players to view the list of people they are ignoring in private chats --- v0.8.5 2/27/2017
  65.     Permission:
  66.     - vippluschat.user.playerignore.list
  67.    
  68.     /vpc toggleswear {chat} - Toggles the swear filter for this player for the speicified player --- v0.8.5
  69.     Permission:
  70.     - vippluschat.chat.filter.{chat}
  71.     - vippluschat.chat.filter.*
  72.     - vippluschat.chat.filter.toggle.{chat}
  73.     - vippluschat.chat.filter.toggle.*
  74.    
  75.     /vpc modifyswear {add,+,rem,del,remove,delete,clear} {chat/shared} {word} | Optional: {replacement word char max set in config} - Sets the word dictionary for this players dictionary. Which allows him to edit it --- v0.8.5
  76.     Permission:
  77.     - vippluschat.chat.filter.{chat}
  78.     - vippluschat.chat.filter.*
  79.     - vippluschat.chat.filter.modify.{chat}
  80.     - vippluschat.chat.filter.modify.*    
  81.    
  82.     /vpc listswear {chat/shared} - Lists all the words in the players dictionary of his swear filter --- v0.8.5
  83.     Permission:
  84.     - vippluschat.chat.filter.{chat}
  85.     - vippluschat.chat.filter.*
  86.     - vippluschat.chat.filter.list.{chat}
  87.     - vippluschat.chat.filter.list.*
  88.    
  89.     /vpc antiswear {chat} - Gives the player his basic info reguarding the player antiswear system --- v0.8.5
  90.     Permission:
  91.     - vippluschat.chat.filter.{chat}
  92.     - vippluschat.chat.filter.*
  93.     - vippluschat.chat.filter.stats.{chat}
  94.     - vippluschat.chat.filter.stats.*
  95.    
  96.     /vpc cic toggle - Allows you to toggle the state of Can Ignore Chats. --- v0.8.5
  97.     Permission:
  98.     - vippluschat.admin.cic-toggle
  99.    
  100.     /vpc ctic toggle - Allows you to toggle the state of Can talk in chats. --- v0.8.5
  101.     Permission:
  102.     - vippluschat.admin.ctic-toggle
  103.    
  104.     /vpc cvc toggle - Allows you to toggle the state of Can view Chats. --- v0.8.5
  105.     Permission:
  106.     - vippluschat.admin.cvc-toggle
  107.    
  108.     /vpc cic {add/remove} {chat} - Allows you to add or remove players from can ignore chats. --- v0.8.5
  109.     Permission:
  110.     - vippluschat.admin.cic-modify
  111.    
  112.     /vpc ctic {add/remove} {chat} - Allows you to add or remove players from can talk in chats. --- v0.8.5
  113.     Permission:
  114.     - vippluschat.admin.ctic-modify
  115.    
  116.     /vpc cvc {add/remove} {chat} - Allows you to add or remove players from can view chats. --- v0.8.5
  117.     Permission:
  118.     - vippluschat.admin.cvc-modify
  119.    
  120.     /vpc createchat - Enters the current player into create custom chat mode. Only one player can be in this mode at a time. How ever after the defined amout of time the player will be kicked from the mode. --- v0.8.5
  121.     Permission:
  122.     - vippluschat.admin.create-chat
  123.    
  124.     /vpc swear toggle {chat} - Enables/Disables the player/server swear filter for  the chat specified --- v0.8.5 2/27/2017 3/1/2017
  125.     Permission:
  126.     - vippluschat.admin
  127.     - vippluschat.admin.swear-toggle-server
  128.    
  129.     /vpc swear toggle {username} {chat} - Enables/Disables the players specified swear filter for  the chat specified --- v0.8.5
  130.     Permission:
  131.     - vippluschat.admin
  132.     - vippluschat.admin.swear-toggle-player
  133.    
  134.     /vpc swear {username} - Shows the toggle state of the player specified's swear filter. As well it will show the length of all the players swear dictionary. --- v0.8.5
  135.     Permission:
  136.     - vippluschat.admin
  137.     - vippluschat.admin.swear-info
  138.    
  139.     /vpc swear {add,+,-,del,delte,rem,remove,clear} {chat} {word} | Optional: {replacement word} - Allows you to modify the server swear directory that is specified. --- v0.8.5 3/1/2017
  140.     Permission:
  141.     - vippluschat.admin
  142.     - vippluschat.admin.swear-modify
  143.    
  144.     /vpc swear list {chat} - Shows the list of words in the chat specified's dictionary. --- v0.8.5
  145.     Permission:
  146.     - vippluschat.admin
  147.     - vippluschat.admin.swear-list
  148.    
  149.     /vpc add chat - Puts you into the add custom chat mode --- v0.8.5
  150.     Permission:
  151.     - vippluschat.admin
  152.     - vippluschat.admin.addchat
  153.        
  154.     /vpc checkver - Check the latest version of plugin and what the current release is
  155.     Permission:
  156.     - vippluschat.admin
  157.     - vippluschat.admin.checkversion
  158.    
  159.     /vpc reload - Reload the Chat.yml and Config.yml files
  160.     Permission:
  161.     - vippluschat.admin
  162.     - vippluschat.admin.reload
  163.    
  164.     /vpc {ignore/unignore} {chat} - Set your self to ignore/unignore the specified chat
  165.     Permission:
  166.     - vippluschat.chat.ignore
  167.    
  168.     /vpc ignored {chat} | optional: {show/#/all} - View the list of ignored users with in the chat specified
  169.     Permission:
  170.     - vippluschat.admin
  171.     - vippluschat.admin.ignored
  172.    
  173.     /vpc toggle {chat} - Enable/Disable the chat specified
  174.     Permission:
  175.     - vippluschat.admin
  176.     - vippluschat.admin.toggle
  177.     - vippluschat.toggle.{permission} - The permission is defined in the chat.yml
  178.    
  179.     /vpc blacklist {+/add/del/rem/delete/remove/-/clear} {username} - Add/remove/clear the User{s} to/from the blacklist
  180.     Permission:
  181.     - vippluschat.admin
  182.     - vippluschat.admin.blacklist
  183.    
  184.     /vpc {fui/forceunignore} {chat} {username} - Force the user to uningore the chat specified
  185.     Permission:
  186.     - vippluschat.admin
  187.     - vippluschat.admin.forceunignore
  188.    
  189.     /vpc blacklisted | Optional: {all/#/show} - View the blacklisted users
  190.     Permission:
  191.     - vippluschat.admin
  192.     - vippluschat.admin.blacklisted
  193.    
  194.     /vpc colors {chat} - The command allows you to see what colors are enabled for this command --- v0.8.2
  195.     Permission:
  196.     - vippluschat.admin
  197.     - vippluschat.admin.viewcolors
  198.    
  199.     /vpc colors toggle {chat} {color-code} - This will allow you to toggle the state of the color code entered --- v0.8.2
  200.     Permission:
  201.     - vippluschat.admin
  202.     - vippluschat.admin.togglecolors
  203.  
  204.  */
  205.  
  206.  
  207. public class StaffChat extends JavaPlugin implements Listener {
  208.     //---- This is used to easily grab the current version of the program - Added v0.8
  209. public String version = "v0.8.5";
  210. public HashMap<Player, String> focus = new HashMap<>();
  211. public final String blacklist_location = "\\"+"files"+"\\"+"blacklist.yml";
  212. public final String ignorelist_location = "\\"+"files"+"\\"+"ignorelist.yml";
  213. //---- End Version String
  214.     @Override
  215.     public void onEnable(){
  216.         Bukkit.getServer().getPluginManager().registerEvents(this, this);
  217.         checkOldConfgAndPort();
  218.         loadConfiguration();
  219.         loadChats();
  220.         loadOther();
  221.     }
  222.     //---- This is used to create the default config.yml and was added in v0.6
  223.     public void loadConfiguration(){
  224.         getConfig().options().copyDefaults(true);
  225.         saveConfig();  
  226.    
  227.     }
  228.     //---- End config.yml
  229.     //---- This is used to create the default chat.yml and was added in v0.8.2 to allow for custom chats and to clean up the original config.yml
  230.     public void loadChats(){
  231.         getCustomChats().options().copyDefaults(true);
  232.         saveCustomConfig();
  233.     }
  234.     //---- End Chat.yml
  235.    
  236.     @SuppressWarnings("deprecation")
  237.     public void loadOther() {
  238.         getOther(getConfig().getString("Other.focus.location")).options().copyDefaults(true);
  239.         saveOther(getConfig().getString("Other.focus.location"));
  240.          getOther(blacklist_location).options().copyDefaults(true);
  241.          saveOther(blacklist_location);
  242.          tcOther(blacklist_location, "b");
  243.          getOther(ignorelist_location).options().copyDefaults(true);
  244.          saveOther(ignorelist_location);
  245.          tcOther(ignorelist_location, "i");
  246.          int i = 0;
  247.          do {
  248.              if (getCustomChats().getBoolean(i + ".anti-swear.enabled")) {
  249.                  getOther(getCustomChats().getString(i + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(i + ".name"))).options().copyDefaults(true);
  250.                  saveOther(getCustomChats().getString(i + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(i + ".name")));
  251.                  tcOther(getCustomChats().getString(i + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(i + ".name")), "d");
  252.              }
  253.              i++;
  254.          } while (i < getCustomChats().getInt("Chat Count"));
  255.         for (Player p : Bukkit.getOnlinePlayers()) {
  256.             if (getOther(getConfig().getString("Other.focus.location")).contains(p.getUniqueId().toString())) {
  257.                 focus.put(p, getOther(getConfig().getString("Other.focus.location")).getString(p.getUniqueId().toString() + ".chat"));
  258.             }
  259.         }
  260.         checkPortOldBlacklistIgnore();
  261.        
  262.     }
  263.    
  264.     //---- Catches messages on the outbound for focus mode - v0.8.5
  265.     @EventHandler
  266.     public void onPlayerMessage(AsyncPlayerChatEvent e) {
  267.         if (inFocus(e.getPlayer())) {
  268.             e.setCancelled(true);
  269.             int chatID = detectChatID(focus.get(e.getPlayer()));
  270.             String msg = e.getMessage();
  271.             if (serverAntiSwear(chatID)) {
  272.                  msg = antiswearServerCheck(msg, chatID);
  273.                     if (msg.equalsIgnoreCase("ERROR: 1337 - Banned Message")) {
  274.                         pMessage(getConfig().getString("Messages.antiswear-banned").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), e.getPlayer());
  275.                     } else {
  276.                         sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  277.                     }
  278.             } else {
  279.                 sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  280.             }
  281.            
  282.         }
  283.     }
  284.    
  285.     //---- Catch messages on outbound
  286.    
  287.     //---- This is just a little code that I added so when I join the server I can view if you are using my plugin and if so what version - Added v0.8
  288.     @EventHandler
  289.     public void onPlayerJoin(PlayerJoinEvent e) {
  290.         Player p = (Player) e.getPlayer();
  291.         if (p.getUniqueId().toString().equalsIgnoreCase("87acd853-989b-496f-8eb0-9744f160bf15") && p.getName().equals("agentsix1")) { p.sendMessage(ct("&7Oh hey there. It appears this server is using your plugin!. The current version is &9" + version)); System.out.println("The plugin dev for VIP+ Chat has just joined your server! - agentsix1 (uuid: 87acd853-989b-496f-8eb0-9744f160bf15)");}
  292.         if (getOther(getConfig().getString("Other.focus.location")).contains(p.getUniqueId().toString())) {
  293.             focus.put(p, getOther(getConfig().getString("Other.focus.location")).getString(p.getUniqueId().toString() + ".chat"));
  294.         }
  295.     }
  296.     //---- End Do you own me?
  297.     //---- Detect Custom Chat - This was added to allow custom commands with custom chats! - Added v0.8.2
  298.     @EventHandler
  299.     public void detectCustomChat(PlayerCommandPreprocessEvent e) {
  300.         Player p = e.getPlayer();
  301.        
  302.         if (p.hasPermission("vippluschat.allowchat")) {
  303.            
  304.             try {
  305.                 String[] cmd = e.getMessage().split(" ");
  306.                 int chatID = detectChatID(cmd[0].replace("/", ""));
  307.                 if (chatID > -1 & p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  308.                         String msg = "";
  309.                         for(int i = 0; i < cmd.length; i++){
  310.                             if (i != 0) {
  311.                                 String fmsg = cmd[i] + " ";
  312.                                 msg = msg + fmsg;
  313.                             }
  314.                         }
  315.                         e.setCancelled(true);
  316.                         if (serverAntiSwear(chatID)) {
  317.                              msg = antiswearServerCheck(msg, chatID);
  318.                                 if (msg.equalsIgnoreCase("ERROR: 1337 - Banned Message")) {
  319.                                     pMessage(getConfig().getString("Messages.antiswear-banned").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), e.getPlayer());
  320.                                 } else {
  321.                                     sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  322.                                 }
  323.                         } else {
  324.                             sendMessages(msg, e.getPlayer(), "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  325.                         }
  326.                 }
  327.             } catch (ArrayIndexOutOfBoundsException catcherror) {
  328.                 int chatID = detectChatID(e.getMessage().replace("/", ""));
  329.                 if (chatID > -1) {
  330.                     if (p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  331.                         e.setCancelled(true);
  332.                     }
  333.                 }
  334.             }
  335.         }
  336.        
  337.     }
  338.     //---- End Detect Custom Chat
  339.     //---- In Focus Mode - v0.8.5 - 2/14/17
  340.     public boolean inFocus(Player p) {
  341.         if (focus.containsKey(p)) {
  342.             return true;
  343.         } else {
  344.             return false;
  345.         }
  346.     }
  347.     //---- End In Focus Mode   
  348.     //---- Detect Chat ID - This was added to detect what what chat you are trying to reach - Added v0.8.2
  349.     public int detectChatID(String j) {
  350.         int i = 0;
  351.         do {
  352.             if (getCustomChats().getString(i + ".name").toLowerCase().equalsIgnoreCase(j.toLowerCase())) {
  353.                 return i;
  354.             }
  355.             for ( String cmd : getCustomChats().getStringList(i + ".command")) {
  356.                 if (cmd.equalsIgnoreCase(j)) {
  357.                     return i;
  358.                 }
  359.             }
  360.         } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  361.         return -1;
  362.     }
  363.     //---- End Detect Chat ID
  364.    
  365.     public String pstatusGetChats(Player p, int chat) {
  366.         int i = 0;
  367.         String out = "";
  368.         List<Integer> permissions = new ArrayList<Integer>();
  369.         do {
  370.             if (p.hasPermission("vippluschat.chat.ignore") && (p.hasPermission("vippluschat.chat.*") || p.hasPermission("vippluschat.chat." + getCustomChats().getString(i + ".permission")))) {
  371.                 permissions.add(i);
  372.             }
  373.             i++;
  374.         } while (i < getCustomChats().getInt("Chat Count"));
  375.         if (permissions.size() > 0) {
  376.             for (int c : permissions) {
  377.                 if (chat != -1) {
  378.                     String stats = "&cfalse";
  379.                     if (inIgnorelist(p.getUniqueId().toString(), p.getName(), c)) { stats = "&atrue"; }
  380.                     if (chat == -2) {
  381.                        
  382.                         if (out.equalsIgnoreCase("")) {
  383.                             out = getConfig().getString("Messages.pstatus-ignored-items").replace("%CHAT_TAG%", getCustomChats().getString(c + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(c + ".name")).replace("%CHAT_ID%", c + "").replace("%STATUS%", stats).replace("%NL%", "\n");
  384.                         } else {
  385.                             out = out + getConfig().getString("Messages.pstatus-ignored-items").replace("%CHAT_TAG%", getCustomChats().getString(c + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(c + ".name")).replace("%CHAT_ID%", c + "").replace("%STATUS%", stats).replace("%NL%", "\n");
  386.                         }
  387.                     } else if (chat > -1){
  388.                         if (p.hasPermission("vippluschat.chat.ignore") && (p.hasPermission("vippluschat.chat.*") || p.hasPermission("vippluschat.chat." + getCustomChats().getString(chat + ".permission")))) {
  389.                             stats = "&cfalse";
  390.                             if (inIgnorelist(p.getUniqueId().toString(), p.getName(), chat)) { stats = "&atrue"; }
  391.                             if (out.equalsIgnoreCase("")) {
  392.                                 out = getConfig().getString("Messages.pstatus-ignored-items").replace("%CHAT_TAG%", getCustomChats().getString(chat + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chat + ".name")).replace("%CHAT_ID%", chat + "").replace("%STATUS%", stats).replace("%NL%", "\n");
  393.                             } else {
  394.                                 out = out + getConfig().getString("Messages.pstatus-ignored-items").replace("%CHAT_TAG%", getCustomChats().getString(chat + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chat + ".name")).replace("%CHAT_ID%", chat + "").replace("%STATUS%", stats);
  395.                             }
  396.                         } else {
  397.                             pMessage(getConfig().getString("Messages.no-permissions"), p);
  398.                             return "no";
  399.                         }
  400.                        
  401.                     }
  402.                 } else {
  403.                    
  404.                 }
  405.             }
  406.         }
  407.         return out;
  408.     }
  409.    
  410.     public String help(Player p, int page) {
  411.         String out = "";
  412.         switch (page) {
  413.         case 0:
  414.         case 1:
  415.             out = ""
  416.                     + "&6----- &cHelp Menu &6-----\n"
  417.                     + "&7/{chat} {message} &f- &6Allows you to send a message to the chat.\n"
  418.                     + "&7/vpc focus {chat} &f- &6Allows you to toggle your focus mode for the specified chat.\n"
  419.                     + "&7/vpc ignore {chat} &f- &6Allows you to ignore messages for the specified chat.\n"
  420.                     + "&7/vpc unignore {chat} &f- &6Allows you to unignore messages for the specified chat.\n"
  421.                     + "&7/vpc pstatus | Optional: {ignored/blacklisted} &f- &6Allows you to see the status for the specified chat.\n"
  422.                     + "&7/vpc ignoreplayer {player/clear} &f- &6Allows you to ignore messages from the player specified in all chats.\n"
  423.                     + "&7/vpc listplayers | Optional: {#} &f- &6Allows you to see who all you are ignoring.";
  424.             if (p.hasPermission("vippluschat.admin")) {
  425.                 out = out + ""
  426.                         + "\n&7/vpc help | Optional: {1-3} &f- &6Allows you to view other pages.";
  427.             }
  428.             break;
  429.         case 2:
  430.             if (p.hasPermission("vippluschat.admin")) {
  431.                 out = ""
  432.                         + "&6----- &cHelp Menu &6-----\n"
  433.                         + "&7/vpc checkver &f- &6Allows you to view the current version of the plugin as well as the lastest release version.\n"
  434.                         + "&7/vpc reload &f- &6Allows you to reload all of the config files.\n"
  435.                         + "&7/vpc ignored {chat} | Optional: {show/#/all} &f- &6Allows you to view the current list of people ingoring that chat.\n"
  436.                         + "&7/vpc blacklist {+/add/del/delete/rem/remove/clear/-} {username} &f- &6Allows you to modify the blacklist.\n"
  437.                         + "&7/vpc {fui/forceunignore} {chat} {username} &f- &6Allows you to force a player to unignore a chat.\n"
  438.                         + "&7/vpc blacklisted | Optional: {show/#/all} &f- &6Allows you to view the players currently blacklisted.\n"
  439.                         + "&7/vpc colors {chat} &f- &6Allows you to view the status of the color codes.\n"
  440.                         + "&7/vpc colors toggle {chat} {color-code} &f- &6Allows you to modify the status of the color codes.\n"
  441.                         + "&7/vpc help | Optional: {1-3} &f- &6Allows you to view other pages.";
  442.             } else {
  443.                 out = getConfig().getString("Messages.no-permissions");
  444.             }
  445.             break;
  446.         case 3:
  447.             if (p.hasPermission("vippluschat.admin")) {
  448.                 out = ""
  449.                         + "&6----- &cHelp Menu &6-----\n"
  450.                         + "&7/vpc swear toggle {chat} &f- &6Allows you to toggle the state of the anti swear.\n"
  451.                         + "&7/vpc swear {add,+,del,delete,rem,remove,clear} {chat} {word} | Optional: {replacemeent} &f- &6Allows you to modify the swear dictionary.\n"
  452.                         + "&7/vpc swear list {chat} &f- &6Allows you to view the current dictionary.\n"
  453.                         + "&7/vpc help | Optional: {1-3} &f- &6Allows you to view other pages.";
  454.             } else {
  455.                 out = getConfig().getString("Messages.no-permissions");
  456.             }
  457.             break;
  458.         default:
  459.             break;
  460.         }
  461.         return out;
  462.     }
  463.    
  464.     private String pstatusGetBlacklist(Player p) {
  465.         String out = "";
  466.         if (inBlacklist(p.getUniqueId().toString(), p.getName())) {
  467.             out = "&atrue";
  468.         } else {
  469.             out = "&cfalse";
  470.         }
  471.         return out;
  472.     }
  473.    
  474.     @SuppressWarnings("deprecation")
  475.     public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
  476.         if(sender instanceof Player) {
  477.             Player p = (Player) sender;
  478.             //---- Help Command v0.8.5 3/16/2017 - /vpc help | Optional: {#} --- v0.8.5
  479.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length > 0 && args.length < 3) {
  480.                 if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
  481.                     pMessage(help(p, 1), p);
  482.                 }
  483.                 if (args.length == 2 && args[0].equalsIgnoreCase("help")) {
  484.                     pMessage(help(p, Integer.parseInt(args[1])), p);
  485.                 }
  486.                
  487.             }
  488.             //---- End Help Command
  489.            
  490.             //---- View Swear Dictionary v0.8.5 3/1/2017 - /vpc swear list {chat}| Optional: {#} - Shows the list of words in the chat specified's dictionary. --- v0.8.5
  491.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 3 || args.length == 4)) {
  492.                 if (args[0].equalsIgnoreCase("swear") && args[1].equalsIgnoreCase("list")) {
  493.                     int chatID = detectChatID(args[2]);
  494.                     if (chatID != -1) {
  495.                         if (args.length == 3) {
  496.                             pMessage(showSwearListServer(1, chatID), p);
  497.                         } else if (args.length == 4 & StringUtils.isNumericSpace(args[3])) {
  498.                             pMessage(showSwearListServer(Integer.parseInt(args[3]), chatID), p);
  499.                         }
  500.                        
  501.                     }
  502.                 }
  503.             }
  504.             //---- End View Swear Dictionary
  505.            
  506.             //---- Toggle Swear - Added v0.8.5 2/27/2017 - /vpc swear toggle {chat} - Enables/Disables the server swear filter for  the chat specified --- v0.8.5
  507.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 3)) {
  508.                 if (args[0].equalsIgnoreCase("swear") && args[1].equalsIgnoreCase("toggle")) {
  509.                     if (p.hasPermission("vippluschat.admin.swear-toggle-server") || p.hasPermission("vippluschat.admin")) {
  510.                         int chatID = detectChatID(args[2]);
  511.                         if (chatID != -1) {
  512.                             String state = "";
  513.                             if (getCustomChats().getBoolean(chatID + ".anti-swear.server.enabled")) {
  514.                                 getCustomChats().set(chatID + ".anti-swear.server.enabled", false);
  515.                                 saveCustomConfig();
  516.                                 reloadChats();
  517.                                 state = "&cDisabled";
  518.                                 pMessage(getConfig().getString("Messages.antiswear-toggle").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%STATUS%", state).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  519.                             } else {
  520.                                 getCustomChats().set(chatID + ".anti-swear.server.enabled", true);
  521.                                 saveCustomConfig();
  522.                                 reloadChats();
  523.                                 state = "&aEnabled";
  524.                                 getOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name"))).options().copyDefaults(true);
  525.                                 saveOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")));
  526.                                 tcOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), "d");
  527.                                 pMessage(getConfig().getString("Messages.antiswear-toggle").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%STATUS%", state).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  528.                             }
  529.                            
  530.                         } else {
  531.                             pMessage(getConfig().getString("Messages.antiswear-chat-syntax").replace("%COMMAND%", "/vpc swear toggle {chat}"), p);
  532.                         }
  533.                     } else {
  534.                         pMessage(getConfig().getString("Messages.no-permissions"), p);
  535.                     }
  536.                 }
  537.             }
  538.             //---- End Toggle Swear
  539.            
  540.             //---- Modify Swear Dictionaries - Added v0.8.5 2/27/2017 - /vpc swear {add,+,-,del,delte,rem,remove,clear} {chat} {word} | Optional: {replacement word} - Allows you to modify the server swear directory that is specified. --- v0.8.5
  541.            
  542.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 4 || args.length == 5) ||args.length == 3 ) {
  543.                 if (args[0].equalsIgnoreCase("swear")) {
  544.                     if (p.hasPermission("vippluschat.admin.swear-modify") || p.hasPermission("vippluschat.admin")) {
  545.                         int chatID = detectChatID(args[2]);
  546.                         String loc = "";
  547.                         if (chatID != -1) {
  548.                             loc = getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name"));
  549.                         }
  550.                         switch (args[1]) {
  551.                         case "+":
  552.                         case "add":
  553.                             if (chatID != -1) {
  554.                                 /*
  555.                                  * Dictionary:
  556.                                  * - shit: - Replaces the word with nothing
  557.                                  * - bitch:linch - Replaces the word
  558.                                  * - %shit%:rip - Replaces the word containing
  559.                                  * - #shit#: - Blacks message containing
  560.                                  */
  561.                                
  562.                                 if (getOther(loc).getStringList("Dictionary").size() > 0) {
  563.                                     List<String> l = getOther(loc).getStringList("Dictionary");
  564.                                     if (args.length == 4) {
  565.                                         if (l.remove(args[3] + ":")) {
  566.                                             pMessage(getConfig().getString("Messages.antiswear-word-already").replace("%WORD%", args[3]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  567.                                         } else {
  568.                                             l.add(args[3] + ":");
  569.                                             ssOther(loc, "Dictionary", l);
  570.                                             pMessage(getConfig().getString("Messages.antiswear-word-add").replace("%WORD%", args[3]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  571.                                         }
  572.                                     } else if (args.length == 5){
  573.                                         if (l.remove(args[3] + ":" + args[4])) {
  574.                                             pMessage(getConfig().getString("Messages.antiswear-word-already").replace("%WORD%", args[3] + ":" + args[4]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  575.                                         } else {
  576.                                             l.add(args[3] + ":" + args[4]);
  577.                                             ssOther(loc, "Dictionary", l);
  578.                                             pMessage(getConfig().getString("Messages.antiswear-word-add").replace("%WORD%", args[3] + ":" + args[4]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  579.                                         }
  580.                                     }
  581.                                    
  582.                                 } else {
  583.                                     List<String> l = new ArrayList<>();
  584.                                     if (args.length == 4) {
  585.                                         l.add(args[3] + ":");
  586.                                         ssOther(loc, "Dictionary", l);
  587.                                         pMessage(getConfig().getString("Messages.antiswear-word-add").replace("%WORD%", args[3]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  588.                                     } else if (args.length == 5){
  589.                                         l.add(args[3] + ":" + args[4]);
  590.                                         ssOther(loc, "Dictionary", l);
  591.                                         pMessage(getConfig().getString("Messages.antiswear-word-add").replace("%WORD%", args[3] + ":" + args[4]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  592.                                     }
  593.                                 }
  594.                                
  595.                             } else {
  596.                                 pMessage(getConfig().getString("Messages.antiswear-chat-syntax").replace("%COMMAND%", "/vpc swear {add,+} {chat} {word} | Optional: {replacement word}"), p);
  597.                                 return false;
  598.                             }
  599.                             break;
  600.                         case "-":
  601.                         case "remove":
  602.                         case "rem":
  603.                         case "del":
  604.                         case "delete":
  605.                             if (chatID != -1) {
  606.                                 if (args.length == 4) {
  607.                                     if (getOther(loc).getStringList("Dictionary").size() > 0) {
  608.                                         List<String> l = getOther(loc).getStringList("Dictionary");
  609.                                         // word:replacement
  610.                                         // word - remove it
  611.                                         for (String w : l) {
  612.                                             if (w.split(":").length == 1) {
  613.                                                 if (w.split(":")[0].equalsIgnoreCase(args[3])) {
  614.                                                     l.remove(w);
  615.                                                     ssOther(loc, "Dictionary", l);
  616.                                                     pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&aRemoved").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  617.                                                     return true;
  618.                                                 }
  619.                                             }
  620.                                         }
  621.                                         pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&cNot Removed").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  622.                                     } else {
  623.                                         pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&cNot Removed").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  624.                                     }
  625.                                 } else if (args.length == 5) {
  626.                                     if (getOther(loc).getStringList("Dictionary").size() > 0) {
  627.                                         List<String> l = getOther(loc).getStringList("Dictionary");
  628.                                         // word:replacement
  629.                                         // word - remove it
  630.                                         for (String w : l) {
  631.                                             if (w.split(":").length == 2) {
  632.                                                 if (w.equalsIgnoreCase(args[3] + ":" + args[4])) {
  633.                                                     l.remove(w);
  634.                                                     ssOther(loc, "Dictionary", l);
  635.                                                     pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&aRemoved").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  636.                                                     return true;
  637.                                                 }
  638.                                             }
  639.                                         }
  640.                                         pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&cNot Removed").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  641.                                     } else {
  642.                                         pMessage(getConfig().getString("Messages.antiswear-word-remove").replace("%WORD%", args[3]).replace("%STATE%", "&cNot Removed").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  643.                                     }
  644.                                 }
  645.                             } else {
  646.                                 pMessage(getConfig().getString("Messages.antiswear-chat-syntax").replace("%COMMAND%", "/vpc swear {-,del,delte,rem,remove} {chat} {word} {replacement}"), p);
  647.                             }
  648.                            
  649.                             break;
  650.                         case "clear":
  651.                             if (args.length > 2) {
  652.                                 if (args[1].equalsIgnoreCase("clear")) {
  653.                                     if (chatID != -1) {
  654.                                         ssOther(loc, "Dictionary", new ArrayList<>());
  655.                                         pMessage(getConfig().getString("Messages.antiswear-word-clear").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  656.                                     } else {
  657.                                         pMessage(getConfig().getString("Messages.antiswear-chat-syntax").replace("%COMMAND%", "/vpc swear {add,+,-,del,delte,rem,remove,clear} {chat} {word} | Optional: {replacement word}"), p);
  658.                                     }
  659.                                 } else {
  660.                                     pMessage(getConfig().getString("Messages.antiswear-syntax").replace("%COMMAND%", "/vpc swear clear {chat}"), p);
  661.                                 }
  662.                             }
  663.                         }
  664.                     } else {
  665.                         pMessage(getConfig().getString("Messages.no-permissions"), p);
  666.                     }
  667.                 }
  668.             }
  669.            
  670.             //---- End Modify Swear Dictionaties
  671.            
  672.             //---- Player Ignore List - Added v0.8.5 2/27/2017 - /vpc listplayers | Optional: {#} - Allows players to view the list of people they are ignoring in private chats --- v0.8.5 2/27/2017
  673.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 1 || args.length == 2)) {
  674.                 if (args[0].equalsIgnoreCase("listplayers")) {
  675.                     if (p.hasPermission("vippluschat.user.playerignore.list")) {
  676.                         if (args.length == 1) {
  677.                                 int page = 1;
  678.                                 pMessage(showPlayerIgnore(p, page), p);
  679.                         } else if (args.length == 2){
  680.                             try {
  681.                                 int page = Integer.parseInt(args[1]);
  682.                                 pMessage(showPlayerIgnore(p, page), p);
  683.                             } catch (NumberFormatException e) {
  684.                                 pMessage(showPlayerIgnore(p, 1), p);               
  685.                             }
  686.                         } else {
  687.                             pMessage(getConfig().getString("Messages.player-ignore-list-syntax"), p);
  688.                         }
  689.                     } else {
  690.                         pMessage(getConfig().getString("Messages.no-permissions"), p);
  691.                     }
  692.                 }
  693.             }
  694.             //---- End Palyer Ignore List
  695.            
  696.             //---- Player Ingore - Added v0.8.5 2/27/2017 - /vpc ignoreplayer {player/clear} | Optional: {+/add/rem/del/delete/remove/-/clear}- Allows a player to ignore another player inside chats. --- v0.8.5
  697.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 2 || args.length == 3)) {
  698.                 if (args[0].equalsIgnoreCase("ignoreplayer")) {
  699.                     if (p.hasPermission("vippluschat.user.playerignore")) {
  700.                         if (args.length == 2) {
  701.                             if (args[1].equalsIgnoreCase("clear")) {
  702.                                 modifyPlayerIgnore(getServer().getOfflinePlayer(args[1]), p, "clear");
  703.                                 pMessage(getConfig().getString("Messages.player-ignore").replace("%IGNORE_PLAYER%",  "All Entries").replace("%IGNORE_UUID%", "").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%STATUS%", "&cunignored"), p);
  704.                             } else {
  705.                                 modifyPlayerIgnore(getServer().getOfflinePlayer(args[1]), p, "toggle");
  706.                                 pMessage(getConfig().getString("Messages.player-ignore").replace("%IGNORE_PLAYER%",  getServer().getOfflinePlayer(args[1]).getName()).replace("%IGNORE_UUID%", getServer().getOfflinePlayer(args[1]).getUniqueId().toString()).replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%STATUS%", getPlayerIgnoreStatus(getServer().getOfflinePlayer(args[1]), p)), p);
  707.                             }
  708.                         }
  709.                        
  710.                         if (args.length == 3) {
  711.                             switch (args[2]) {
  712.                             case "+":
  713.                             case "add":
  714.                                 modifyPlayerIgnore(getServer().getOfflinePlayer(args[1]), p, "+");
  715.                                 pMessage(getConfig().getString("Messages.player-ignore").replace("%IGNORE_PLAYER%",  getServer().getOfflinePlayer(args[1]).getName()).replace("%IGNORE_UUID%", getServer().getOfflinePlayer(args[1]).getUniqueId().toString()).replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%STATUS%", getPlayerIgnoreStatus(getServer().getOfflinePlayer(args[1]), p)), p);
  716.                                 break;
  717.                                
  718.                             case "-":
  719.                             case "rem":
  720.                             case "remove":
  721.                             case "del":
  722.                             case "delete":
  723.                                 modifyPlayerIgnore(getServer().getOfflinePlayer(args[1]), p, "-");
  724.                                 pMessage(getConfig().getString("Messages.player-ignore").replace("%IGNORE_PLAYER%",  getServer().getOfflinePlayer(args[1]).getName()).replace("%IGNORE_UUID%", getServer().getOfflinePlayer(args[1]).getUniqueId().toString()).replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%STATUS%", getPlayerIgnoreStatus(getServer().getOfflinePlayer(args[1]), p)), p);
  725.                                 break;
  726.                            
  727.                             case "clear":
  728.                                 modifyPlayerIgnore(getServer().getOfflinePlayer(args[1]), p, "clear");
  729.                                 pMessage(getConfig().getString("Messages.player-ignore").replace("%IGNORE_PLAYER%",  "All Entries").replace("%IGNORE_UUID%", "").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%STATUS%", "&cunignored"), p);
  730.                                 break;
  731.                             default:
  732.                                 pMessage(getConfig().getString("Messages.player-ignore-syntax"), p);
  733.                                 break;
  734.                             }
  735.                         }
  736.                     } else {
  737.                         pMessage(getConfig().getString("Messages.no-permissions"), p);
  738.                     }
  739.                 }
  740.                    
  741.                        
  742.             }
  743.            
  744.            
  745.             //---- End Player Ignore
  746.            
  747.             //---- pstatus - Added v0.8.5 2/23/2017 - /vpc pstatus | Optional 1: {blacklisted/ignored} | Optionatl 2: {chat}
  748.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length >= 1 && args.length <= 3)) {
  749.                 if (args[0].equalsIgnoreCase("pstatus")) {
  750.                     if (args.length == 1) {
  751.                         if (p.hasPermission("vippluschat.user.pstatus") || (p.hasPermission("vippluschat.user.pstatus.ignored") && p.hasPermission("vippluschat.user.pstatus.blacklisted"))) {
  752.                             pMessage(getConfig().getString("Messages.pstatus-layout").replace("%STATUS_BLACKLISTED%", pstatusGetBlacklist(p)).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BLACKLISTED_START%", "").replace("%BLACKLISTED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", pstatusGetChats(p, -2)), p);
  753.                                     //.replaceAll("(%IGNORED_START%)[^&]*(%IGNORED_END%)", "$1$2")
  754.                         } else if (p.hasPermission("vippluschat.user.pstatus.ignored")) {
  755.                             pMessage(getConfig().getString("Messages.pstatus-layout").replaceAll("(%BOTH_START%).*(%BOTH_END%)", "").replaceAll("(%BLACKLISTED_START%).*(%BLACKLISTED_END%)", "").replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", pstatusGetChats(p, -2)), p);
  756.                             //.replaceAll("(%BLACKLISTED_START%)[^&]*(%BLACKLISTED_END%)", "$1$2")
  757.                         } else if (p.hasPermission("vippluschat.user.pstatus.blacklisted")) {
  758.                             pMessage(getConfig().getString("Messages.pstatus-layout").replaceAll("(%BOTH_START%).*(%BOTH_END%)", "").replaceAll("(%IGNORED_START%).*(%IGNORED_END%)", "").replace("%STATUS_BLACKLISTED%", pstatusGetBlacklist(p)).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%BLACKLISTED_START%", "").replace("%BLACKLISTED_END%", "").replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", pstatusGetChats(p, -2)), p);
  759.                         } else {
  760.                             pMessage(getConfig().getString("Messages.no-permissions"), p);
  761.                         }
  762.                     } else if (args.length == 2 && (args[1].equalsIgnoreCase("ignored") || args[1].equalsIgnoreCase("blacklisted"))) {
  763.                         if (p.hasPermission("vippluschat.user.pstatus.blacklisted") && args[1].equalsIgnoreCase("blacklisted")) {
  764.                             pMessage(getConfig().getString("Messages.pstatus-layout").replaceAll("(%BOTH_START%).*(%BOTH_END%)", "").replaceAll("(%IGNORED_START%).*(%IGNORED_END%)", "").replace("%STATUS_BLACKLISTED%", pstatusGetBlacklist(p)).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%BLACKLISTED_START%", "").replace("%BLACKLISTED_END%", "").replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", pstatusGetChats(p, -2)), p);
  765.                         } else if (p.hasPermission("vippluschat.user.pstatus.ignored") && args[1].equalsIgnoreCase("ignored")) {
  766.                             pMessage(getConfig().getString("Messages.pstatus-layout").replaceAll("(%BOTH_START%).*(%BOTH_END%)", "").replaceAll("(%BLACKLISTED_START%).*(%BLACKLISTED_END%)", "").replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", pstatusGetChats(p, -2)), p);
  767.                         } else {
  768.                             pMessage(getConfig().getString("Messages.no-permissions"), p);
  769.                         }
  770.                     } else if (args.length == 3) {
  771.                         int chatID = detectChatID(args[2]);
  772.                         if (args[1].equalsIgnoreCase("ignored")) {
  773.                             if (chatID != -1) {
  774.                                 if (p.hasPermission("vippluschat.user.pstatus.ignored")) {
  775.                                     String output = pstatusGetChats(p, chatID);
  776.                                     if (!output.equalsIgnoreCase("no")) {
  777.                                         pMessage(getConfig().getString("Messages.pstatus-layout").replaceAll("(%BOTH_START%).*(%BOTH_END%)", "").replaceAll("(%BLACKLISTED_START%).*(%BLACKLISTED_END%)", "").replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n").replace("%IGNORED_START%", "").replace("%IGNORED_END%", "").replace("%BOTH_START%", "").replace("%BOTH_END%", "").replace("%IGNORED_ITEMS%", output), p);
  778.                                     }
  779.                                     return true;
  780.                                 } else {
  781.                                     pMessage(getConfig().getString("Messages.no-permissions"), p);
  782.                                 }
  783.                             } else if (!p.hasPermission("vippluschat.user.pstatus.ignored")) {
  784.                                 pMessage(getConfig().getString("Messages.no-permissions"), p);
  785.                             } else {
  786.                                 pMessage(getConfig().getString("Messages.pstatus-invalid-chat"), p);
  787.                                 return false;
  788.                             }
  789.                         } else {
  790.                             pMessage(getConfig().getString("Messages.pstatus-syntax"), p);
  791.                             return false;
  792.                         }
  793.                        
  794.                     }
  795.                 }
  796.             }
  797.             //---- End pstatus
  798.            
  799.             //---- View color status - Added v0.8.2 - /vpc colors {chat}
  800.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2) {
  801.                 if (args[0].equalsIgnoreCase("colors")) {
  802.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.viewcolors")) {
  803.                         int  chatID = detectChatID(args[1]);
  804.                         if (chatID > -1) {
  805.                             pMessage(outputColorCodes(chatID), p);
  806.                         }
  807.                     } else {
  808.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  809.                     }
  810.                 }
  811.             }
  812.             //---- End view color status
  813.            
  814.             //---- Toggle Colors - Added v0.8.2 - /vpc colors toggle {chat} {color-code}
  815.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 4) {
  816.                 if (args[0].equalsIgnoreCase("colors") && args[1].equalsIgnoreCase("toggle")) {
  817.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.togglecolors")) {
  818.                         int  chatID = detectChatID(args[2]);
  819.                         if (chatID > -1) {
  820.                             if (toggleColor(args[3], chatID)) {
  821.                                 pMessage("Chat color has been toggled", p);
  822.                             } else {
  823.                                 pMessage("Chat color has failed to toggle", p);
  824.                             }
  825.                         }  
  826.                     } else {
  827.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  828.                     }
  829.                    
  830.                 }
  831.                
  832.             }
  833.             //---- End Toggle Colors
  834.            
  835.             //---- Focus Mode - /vpc focus {} - Added v0.8.5 - 2/14/17 3:09pm
  836.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2) {
  837.                 if (args[0].equalsIgnoreCase("focus")) {
  838.                     int chatID = detectChatID(args[1]);
  839.                     if (chatID > -1) {
  840.                         if (p.hasPermission("vippluschat.chat.focus." + getCustomChats().getString(chatID + ".permission")) || p.hasPermission("vippluschat.chat.focus.*")) {
  841.                             if (toggleFocusMode(p, getCustomChats().getString(chatID + ".name"))) {
  842.                                 pMessage(ct(getConfig().getString("Messages.focus-mode-toggle").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%STATE%", "&aEnabled&r").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "")), p);
  843.                             } else {
  844.                                 pMessage(ct(getConfig().getString("Messages.focus-mode-toggle").replace("%PLAYER%", p.getName()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%STATE%", "&cDisabled&r").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "")), p);
  845.                             }
  846.                         } else {
  847.                            
  848.                         }
  849.                     } else {
  850.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  851.                     }
  852.                 }
  853.             }
  854.             //---- End Focus Mode
  855.            
  856.             //---- Toggle ignore chats - Added v0.8.2
  857.            
  858.             //---- End Toggle ignore chats
  859.            
  860.             //---- Focus Mode
  861.            
  862.             //---- End Focus Mode
  863.            
  864.             //---- Check Version - Added 7/02/16 v0.8 - /vpc checkver
  865.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 1) {
  866.                 if (args[0].equalsIgnoreCase("checkver")) {
  867.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.checkversion")) {
  868.                         if (getConfig().getBoolean("Check Version")) {
  869.                             try {
  870.                                 URL u = new URL("http://pastebin.com/raw/2ik6fXLb");
  871.                                 URLConnection conn = u.openConnection();
  872.                                 BufferedReader in = new BufferedReader(
  873.                                         new InputStreamReader(
  874.                                                 conn.getInputStream()));
  875.                                 StringBuffer buffer = new StringBuffer();
  876.                                 String inputLine;
  877.                                 while ((inputLine = in.readLine()) != null)
  878.                                     buffer.append(inputLine);
  879.                                 in.close();
  880.                                 System.out.println(buffer.toString());
  881.                                 p.sendMessage(ct("&7Your current version is: &9" + version + " &7The last released version is: &9" + buffer.toString()));
  882.                                 return true;
  883.                             } catch (MalformedURLException e) {
  884.                                 e.printStackTrace();
  885.                                 return false;
  886.                             } catch (IOException e) {
  887.                                 e.printStackTrace();
  888.                                 return false;
  889.                             }
  890.                         } else {
  891.                             p.sendMessage(ct("&cYou currently have check version disabled inside of the config."));
  892.                             return true;
  893.                         }
  894.                     } else {
  895.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  896.                     }
  897.                 }
  898.             }
  899.             //---- End Check Version
  900.            
  901.             //---- Reload - Added PRE v0.8 - /vpc reload
  902.             if(cmdLabel.equalsIgnoreCase("vpc") && args[0].equalsIgnoreCase("reload")) {
  903.                 if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.reload")) {
  904.                     this.reloadConfig();
  905.                     this.reloadChats();
  906.                     loadChats();
  907.                     loadConfiguration();
  908.                     loadOther();
  909.                     pMessage(getConfig().getString("Messages.reload"), p);
  910.                     return true;
  911.                 } else {
  912.                     p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  913.                 }
  914.             }
  915.             //---- End Reload
  916.            
  917.             //---- Chat - Added PRE v0.8 - /{chat} {message}
  918.             /*
  919.             if((cmdLabel.equalsIgnoreCase("staff") || cmdLabel.equalsIgnoreCase("st")) && p.hasPermission("vippluschat.chat.staff")) {
  920.                 String msg = "";    
  921.  
  922.                 for(int i = 0; i < args.length; i++){
  923.                     String arg = args[i] + " ";
  924.                     msg = msg + arg;
  925.                 }
  926.                 if (getConfig().getString("Enabled.Staff") == "true") {
  927.                     sendMessages(msg, p, "vippluschat.chat.staff", "Staff");
  928.                 } else {
  929.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Staff").replace("%PLAYER%", p.getName()), p);
  930.                 }
  931.                 return true;
  932.                
  933.             }
  934.             ---- Removed v0.8.2 - This is the old chat system which is useless now but is here for future notes!*/
  935.             //---- Chat End
  936.            
  937.             //---- Un/Ignore - Added PRE v0.8 - /vpc {ignore/unignore} {chat} - Updated v0.8.5 - 2/16/2017
  938.            
  939.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2) {
  940.                 if (args[0].equalsIgnoreCase("ignore") || args[0].equalsIgnoreCase("unignore") ) {
  941.                     if (p.hasPermission("vippluschat.chat.ignore")) {
  942.                         if (detectChatID(args[1]) > -1) {
  943.                             int  chatID = detectChatID(args[1]);
  944.                             if (checkIgnoreChatSpecified(p.getName(), args[1])) {
  945.                                 if (getCustomChats().getBoolean(chatID + ".allow-ignore")) {
  946.                                     if (args[0].equalsIgnoreCase("ignore")) {
  947.                                         if (!inIgnorelist(p.getUniqueId().toString(), p.getName(), chatID)) {
  948.                                             modifyIgnorelist(p.getUniqueId().toString(), p.getName(), chatID, "+");
  949.                                             pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  950.                                         } else {
  951.                                             pMessage(ct(getConfig().getString("Messages.ignore-already").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  952.                                         }
  953.                                     } else if (args[0].equalsIgnoreCase("unignore")) {
  954.                                         if (inIgnorelist(p.getUniqueId().toString(), p.getName(), chatID)) {
  955.                                             modifyIgnorelist(p.getUniqueId().toString(), p.getName(), chatID, "-");
  956.                                             pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  957.                                         } else {
  958.                                             pMessage(ct(getConfig().getString("Messages.ignore-already").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  959.                                         }
  960.                                     }
  961.                             /* ---- Removed v0.8.5 when ignore and blacklist system got a complete overhaul - 2/15/2017
  962.                             boolean b = false;
  963.                             reloadConfig();
  964.                             /* ---- Removed v0.8.2 when new black list system was added
  965.                             for (String a: getConfig().getString("Other.blacklist").split(",")) {
  966.                                 if (a.equalsIgnoreCase(p.getName())) {
  967.                                     pMessage(getConfig().getString("Messages.blacklist"), p);
  968.                                     return false;
  969.                                 }
  970.                             }
  971.                             for (String a: getCustomChats().getString(chatID + ".ignore-list").split(",")) {
  972.                                 if (a.equalsIgnoreCase(p.getName())) {
  973.                                     b = true;
  974.                             }
  975.                            
  976.                             }
  977.                            
  978.                         if (!b) {
  979.                             if (getCustomChats().getString(chatID + ".ignore-list").equalsIgnoreCase("")) {
  980.                                 getCustomChats().set(chatID + ".ignore-list", p.getName().toLowerCase());
  981.                                 saveCustomConfig();
  982.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  983.                                 return true;
  984.                             } else {
  985.                                 getCustomChats().set(chatID + ".ignore-list", p.getName().toLowerCase() + "," + getConfig().getString(chatID + ".ignore-list".toLowerCase()));
  986.                                 saveCustomConfig();
  987.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  988.                                 return true;
  989.                             }
  990.                         } else {
  991.                             pMessage(ct(getConfig().getString("Messages.ignore-already").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  992.                             return true;
  993.                         }
  994.                         } else {
  995.                             boolean b = false;
  996.                             String c = "";
  997.                             int d = 0;
  998.                             for (String a: getCustomChats().getString(chatID + ".ignore-list").split(",")) {
  999.                                 if (a.equalsIgnoreCase(p.getName())) {
  1000.                                     b = true;
  1001.                                 } else {
  1002.                                     if (d == 0) {
  1003.                                         d += 1;
  1004.                                         c = a;
  1005.                                     } else {
  1006.                                         String e = c;
  1007.                                         c = e + "," + a;
  1008.                                     }
  1009.                                 }
  1010.                             }
  1011.                             if (!b) {
  1012.                                 pMessage(ct(getConfig().getString("Messages.ignore-not-found").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  1013.                                 return true;
  1014.                             } else {
  1015.                                 getCustomChats().set(chatID + ".ignore-list", c);
  1016.                                 saveCustomConfig();
  1017.                                 if (c.length() == 0) {
  1018.                                     getCustomChats().set(chatID + ".ignore-list", "");
  1019.                                     saveCustomConfig();
  1020.                                 }
  1021.                                
  1022.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  1023.                                 return true;
  1024.                             }
  1025.                         }
  1026.                             */
  1027.                                 } else {
  1028.                                     pMessage(getConfig().getString("Messages.ignore-disabled").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + ""),p);
  1029.                                 }
  1030.                             } else {
  1031.                                 pMessage("You are blacklisted from ignoring this chat.", p);   
  1032.                             }
  1033.                         } else {
  1034.                             pMessage(ct(getConfig().getString("Messages.ignore-fail").replace("%CHAT_TAG%", getCustomChats().getString(detectChatID(args[1]) + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(detectChatID(args[1]) + ".name")).replace("%CHAT_ID%", detectChatID(args[1]) + "").replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  1035.                         }
  1036.                     } else {
  1037.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1038.                     }
  1039.                 }
  1040.             }
  1041.             //---- Ignore End
  1042.            
  1043.             //---- Get Ignore List - Added PRE v0.8 - /vpc ignored {chat} : {show/#/all} - Updated v0.8.2  Modified to accept custom chats - Updated v0.8.5  Modified to accept the new system 2/17/2017
  1044.             if (cmdLabel.equalsIgnoreCase("vpc") &&  (args.length == 2|| args.length == 3)) {
  1045.                 if (args[0].equalsIgnoreCase("ignored")) {
  1046.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.ignored")) {
  1047.                         if (detectChatID(args[1]) > -1) {
  1048.                             int chatID = detectChatID(args[1]);
  1049.                             int page = 1;
  1050.                             try {
  1051.                                 page = Integer.parseInt(args[2]);
  1052.                                 pMessage(showIgnored(p, page, chatID), p);
  1053.                             } catch (NumberFormatException e) {
  1054.                                 if (args[2].equalsIgnoreCase("all")) {
  1055.                                     pMessage(showIgnored(p, -1, chatID), p);
  1056.                                     return true;
  1057.                                 } else if (args[2].equalsIgnoreCase("show")) {
  1058.                                     pMessage(showIgnored(p, 1, chatID), p);
  1059.                                 } else {
  1060.                                     return false;
  1061.                                 }
  1062.                            
  1063.                             } catch (ArrayIndexOutOfBoundsException d) {
  1064.                                 pMessage(showIgnored(p, 1, chatID), p);
  1065.                             }
  1066.                         } else {
  1067.                             pMessage(getConfig().getString("Messages.ignore-fail"), p);
  1068.                             return true;
  1069.                         }
  1070.                     } else {
  1071.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1072.                     }
  1073.                 }
  1074.             }
  1075.            
  1076.             //---- Toggle Chat - Added PRE v0.8 - /vpc toggle {chat} : {true/false}
  1077.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2 || args.length == 3) {
  1078.                 if(args[0].equalsIgnoreCase("toggle") && detectChatID(args[1]) > -1) {
  1079.                     int chatID = detectChatID(args[1]);
  1080.                     if (args.length == 2) {
  1081.                         if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.toggle") || p.hasPermission("vippluschat.toggle." + getCustomChats().getString(chatID + ".permission"))) {
  1082.                           if (getCustomChats().getBoolean(chatID + ".enabled")) {
  1083.                               getCustomChats().set(chatID + ".enabled", false);
  1084.                               saveCustomConfig();
  1085.                               reloadChats();
  1086.                             pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATE%", "false"), p);
  1087.                           } else {
  1088.                               getCustomChats().set(chatID + ".enabled", true);
  1089.                               saveCustomConfig();
  1090.                               reloadChats();
  1091.                             pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATE%", "true"), p);
  1092.                           }
  1093.                           return true;
  1094.                         } else {
  1095.                             p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1096.                             return false;
  1097.                         }
  1098.                     } else if (args.length == 3 ) {
  1099.                         try{
  1100.                             if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.toggle") || p.hasPermission("vippluschat.toggle." + getCustomChats().getString(chatID + ".permission"))) {  
  1101.                                       boolean st = Boolean.valueOf(args[2]);
  1102.                                       getCustomChats().set(chatID + ".enabled", st);
  1103.                                       saveCustomConfig();
  1104.                                       reloadChats();
  1105.                                      
  1106.                                       pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%STATE%", args[2]), p);
  1107.                            
  1108.                             } else {
  1109.                                 p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1110.                             }
  1111.                             } catch (NullPointerException e){
  1112.                                 pMessage(getConfig().getString("Messages.error"), p);
  1113.                             }
  1114.                             return true;
  1115.                     }
  1116.                    
  1117.                 }
  1118.             }
  1119.             //---- End Toggle Chat
  1120.            
  1121.             //---- Blacklist Add/Rem/Del - Added 7/2/16 v0.8 - /vpc blacklist {+/add/del/rem/delete/remove/-/clear/all} {username} - Updated v0.8.5 - 2/16/2017
  1122.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 3 || args.length == 2)) {
  1123.                 if (args[0].equalsIgnoreCase("blacklist")) {
  1124.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.blacklist")) {
  1125.                         if (args[1].equalsIgnoreCase("clear")) {
  1126.                             modifyBlacklist(null, null, "c");
  1127.                             /* ---- Removed v0.8.5 when there was a complete overhaul to the blacklist and ignorelist system - 2/15/2017
  1128.                              * getConfig().set("Other.blacklist", "");
  1129.                              * saveConfig();
  1130.                              */
  1131.                             if (getConfig().getBoolean("Other.broadcast")) {
  1132.                                 Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"));
  1133.                                 return true;
  1134.                             } else {
  1135.                                 pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"), p);
  1136.                                 return true;
  1137.                             }
  1138.                         }
  1139.                         if (args[1].equalsIgnoreCase("add") || args[1].equalsIgnoreCase("+")) {
  1140.                             if (!inBlacklist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2])) {
  1141.                                 modifyBlacklist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2], "+");
  1142.                                 if (getConfig().getBoolean("Other.broadcast")) {
  1143.                                     Broadcast(getConfig().getString("Messages.blacklisted").replace("%PLAYER%", args[2]));
  1144.                                     return true;
  1145.                                 } else {
  1146.                                     pMessage(getConfig().getString("Messages.blacklisted").replace("%PLAYER%", args[2]), p);
  1147.                                     return true;
  1148.                                 }
  1149.                             } else {
  1150.                                 //Already in blacklist
  1151.                             }
  1152.                         }
  1153.                             /* ---- Removed v0.8.5 when there was a complete overhaul to the blacklist and ignorelist system - 2/15/2017
  1154.                             if (!getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  1155.                                 blacklist = getConfig().getString("Other.blacklist");
  1156.                             }
  1157.                                
  1158.                                 if (getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  1159.                                  
  1160.                                     getConfig().set("Other.blacklist", args[2]);
  1161.                                     saveConfig();
  1162.                                     forceUnIgnore(args[2], -1);
  1163.                                 } else {
  1164.                                     getConfig().set("Other.blacklist", args[2] + "," + blacklist);
  1165.                                     saveConfig();
  1166.                                     forceUnIgnore(args[2], -1);
  1167.                                 }
  1168.                                 */
  1169.                                 //forceUnIgnore(args[2], -1);
  1170.                                
  1171.                                    
  1172.                         if (args[1].equalsIgnoreCase("rem") || args[1].equalsIgnoreCase("del") || args[1].equalsIgnoreCase("delete")|| args[1].equalsIgnoreCase("remove")|| args[1].equalsIgnoreCase("-") ) {
  1173.                             /* ---- Removed v0.8.5 when there was a complete overhaul to the blacklist and ignorelist system - 2/15/2017
  1174.                             if (!getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  1175.                              
  1176.                                 blacklist = getConfig().getString("Other.blacklist");
  1177.                             }
  1178.                                 getConfig().set("Other.blacklist", blacklist.replace(args[2] + ",", "").replace(args[2], ""));
  1179.                             saveConfig();
  1180.                             */
  1181.                             if (inBlacklist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2])) {
  1182.                                 modifyBlacklist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2], "-");
  1183.                                 if (getConfig().getBoolean("Other.broadcast")) {
  1184.                                     Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", args[2]));
  1185.                                     return true;
  1186.                                 } else {
  1187.                                     pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", args[2]), p);
  1188.                                     return true;
  1189.                                 }
  1190.                             }
  1191.                         }
  1192.                         if (args[1].equalsIgnoreCase("clear") & args[2].equalsIgnoreCase("all")) {
  1193.                                 modifyBlacklist(null, null, "c");
  1194.                                 /* ---- Removed v0.8.5 when there was a complete overhaul to the blacklist and ignorelist system - 2/15/2017
  1195.                                  * getConfig().set("Other.blacklist", "");
  1196.                                  * saveConfig();
  1197.                                  */
  1198.                                 if (getConfig().getBoolean("Other.broadcast")) {
  1199.                                     Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"));
  1200.                                     return true;
  1201.                                 } else {
  1202.                                     pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"), p);
  1203.                                     return true;
  1204.                                 }
  1205.                         }
  1206.                     } else {
  1207.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1208.                     }
  1209.                 }
  1210.             }      
  1211.             //---- End Blacklist Add/Rem/Del - /vpc blacklist {+/add/del/rem/delete/remove/-/clear} {username}
  1212.            
  1213.             //---- Remove Player Ignore - Added 7/2/16 v0.8 - /vpc {fui/forceunignore} {chat} {username} - Updated v0.8.5 - 2/15/2017
  1214.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 3) {
  1215.                 if (args[0].equalsIgnoreCase("fui") || (args[0].equalsIgnoreCase("forceunignore"))) {
  1216.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.forceunignore")) {
  1217.                         if (detectChatID(args[1]) > -1) {
  1218.                             int chatID = detectChatID(args[1]);
  1219.                                     if (inIgnorelist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2], chatID)) {
  1220.                                         modifyIgnorelist(getServer().getOfflinePlayer(args[2]).getUniqueId().toString(), args[2], chatID, "-");
  1221.                                     }
  1222.                                     //forceUnIgnore(args[2], chatID); -- Removed v0.8.5 when the ignore system and blacklist system got a huge overhaul                        
  1223.                                 pMessage(getConfig().getString("Messages.force-unignore").replace("%PLAYER%", args[2]).replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + ""), p);
  1224.                         }
  1225.                     } else {
  1226.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1227.                     }
  1228.                 }
  1229.             }
  1230.             //---- End Remove Player Ignore
  1231.            
  1232.             //---- Blacklisted - Added 7/2/16 v0.8 - /vpc blacklisted : {all/#/show} - Updated v0.8.2  Modified to accept custom chats - Updated v0.8.5  Modified to accept the new system 2/17/2017
  1233.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 2 || args.length == 1)) {
  1234.                 if (args[0].equalsIgnoreCase("blacklisted")) {
  1235.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.blacklisted")) {
  1236.                         int page = 1;
  1237.                         try {
  1238.                             page = Integer.parseInt(args[1]);
  1239.                             pMessage(showBlacklisted(p, page), p);
  1240.                         } catch (NumberFormatException e) {
  1241.                             if (args[1].equalsIgnoreCase("all")) {
  1242.                                 pMessage(showBlacklisted(p, -1), p);
  1243.                                 //pMessage(getConfig().getString("Messages.blacklisted-list").replace("%LIST%", getConfig().getString("Other.blacklist").replace(",", ", ")).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + ""), p);
  1244.                                 return true;
  1245.                             } else if (args[1].equalsIgnoreCase("show")) {
  1246.                                 pMessage(showBlacklisted(p, 1), p);
  1247.                             } else if (args.length == 1){
  1248.                                 pMessage(showBlacklisted(p, 1), p);
  1249.                                 return true;
  1250.                             } else {
  1251.                                 return false;
  1252.                             }
  1253.                                
  1254.                         } catch (ArrayIndexOutOfBoundsException d) {
  1255.                              if (args.length == 1){
  1256.                                     pMessage(showBlacklisted(p, 1), p);
  1257.                                     return true;
  1258.                               } else {
  1259.                                   return false;
  1260.                               }
  1261.                         }
  1262.                         //pMessage(getConfig().getString("Messages.blacklisted-list").replace("%LIST%", blacklisted).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + ""), p);
  1263.                         return true;
  1264.                     } else {
  1265.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  1266.                     }
  1267.                 }
  1268.             }
  1269.             //---- End Blacklisted
  1270.            
  1271.            
  1272.         }
  1273.         return false;
  1274.     }
  1275.     // Generates the message for the player ingore list - Added v0.8.5 - 2/27/2017
  1276.         public String showPlayerIgnore(Player p, int page) {
  1277.             String player_ignore = "";
  1278.             String thed = "";
  1279.             double listLength = getOther(ignorelist_location).getStringList("ignorelist." + p.getUniqueId().toString() + ".players").size();
  1280.             double length = getConfig().getDouble("Other.player-ignore-length");
  1281.             double pages = Math.ceil((double)listLength/(double)length);
  1282.             int i = 1;
  1283.             ssOther(ignorelist_location, "ignorelist." +p.getUniqueId().toString() + ".name", p.getName());
  1284.             if (getOther(ignorelist_location).getStringList("ignorelist." + p.getUniqueId().toString() + ".players") != null) {
  1285.                 for (String p_string : getOther(ignorelist_location).getStringList("ignorelist." + p.getUniqueId().toString() + ".players")) {
  1286.                     String uuid = p_string.split(";")[0];
  1287.                     String user = p_string.split(";")[1];
  1288.                     if (i < (getConfig().getInt("Other.player-ignore-length") * page)) {
  1289.                         if (i >= getConfig().getInt("Other.player-ignore-length") * (page - 1)) {
  1290.                             if (player_ignore.equalsIgnoreCase("")) {
  1291.                                 player_ignore = getConfig().getString("Messages.player-ignore-list-items").replace("%#%", i + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", user).replace("%PLAYER_UUID%", uuid);
  1292.                             } else {
  1293.                                 if (!user.equalsIgnoreCase("")) {
  1294.                                     player_ignore = player_ignore + getConfig().getString("Messages.player-ignore-list-items").replace("%#%", i + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", user).replace("%PLAYER_UUID%", uuid);
  1295.                                 }
  1296.                             }
  1297.                         }
  1298.                     }
  1299.                     thed = getConfig().getString("Messages.player-ignore-list-layout").replace("%ITEMS%", player_ignore).replace("%PH#%", (pages + "").replace(".0", "")).replace("%PL#%", (page + "").replace(".0", "")).replace("%COUNT%", (listLength + "").replace(".0", "")).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n");
  1300.                     i++;
  1301.                 }
  1302.             } else {
  1303.                 thed = "&cNo one was found on the player ignore list\n";
  1304.             }
  1305.             if (player_ignore.equalsIgnoreCase("")) {
  1306.                 thed = "&cNo one was found on the player ignore list\n";
  1307.             }
  1308.            
  1309.             return thed;
  1310.         }
  1311.         //---- End Player Ignore Message Generator
  1312.        
  1313.     // Generates the message for the blacklisted users - Added v0.8.5 - 2/17/2017
  1314.     public String showBlacklisted(Player p, int page) {
  1315.             String blacklisted = "";
  1316.             double listLength = getOther(blacklist_location).getConfigurationSection("blacklist").getKeys(false).size();
  1317.             double length = getConfig().getDouble("Other.blacklisted-length");
  1318.             double pages = Math.ceil((double)listLength/(double)length);
  1319.             int i = 1;
  1320.             for (String uuid : getOther(blacklist_location).getConfigurationSection("blacklist").getKeys(false)) {
  1321.                 String user = getOther(blacklist_location).getString("blacklist." + uuid);
  1322.                 if (i <= (getConfig().getInt("Other.blacklisted-length") * page)) {
  1323.                     if (i > getConfig().getInt("Other.blacklisted-length") * (page - 1)) {
  1324.                         if (blacklisted.equalsIgnoreCase("")) {
  1325.                             blacklisted = getConfig().getString("Messages.blacklisted-items").replace("%#%", i + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", getOther(blacklist_location).getString("blacklist." + uuid)).replace("%PLAYER_UUID%", uuid);
  1326.                         } else {
  1327.                             if (!user.equalsIgnoreCase("")) {
  1328.                                 blacklisted = blacklisted + getConfig().getString("Messages.blacklisted-items").replace("%#%", i + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", getOther(blacklist_location).getString("blacklist." + uuid)).replace("%PLAYER_UUID%", uuid);
  1329.                             }
  1330.                         }
  1331.                     }
  1332.                 }
  1333.                 i++;
  1334.             }
  1335.             String thed = getConfig().getString("Messages.blacklisted-layout").replace("%ITEMS%", blacklisted).replace("%PH#%", (pages + "").replace(".0", "")).replace("%PL#%", (page + "").replace(".0", "")).replace("%COUNT%", (listLength + "").replace(".0", "")).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n");
  1336.             if (blacklisted.equalsIgnoreCase("")) {
  1337.                 thed = "&cNo one was found on the blacklist\n";
  1338.             }
  1339.            
  1340.         return thed;
  1341.     }
  1342.     //---- End Blacklisted Message Generator
  1343.    
  1344.     // Generates the message for the ignored users - Added v0.8.5 - 2/17/2017
  1345.     @SuppressWarnings("unused")
  1346.     public String showIgnored(Player p, int page, int chatID) {
  1347.         String ignored = "";
  1348.         //double listLength = getOther(ignorelist_location).getConfigurationSection("ignorelist").getKeys(false).size();
  1349.         double length = getConfig().getDouble("Other.ignored-length");
  1350.        
  1351.         int i = 1;
  1352.         int b = 1;
  1353.         for (String uuid : getOther(ignorelist_location).getConfigurationSection("ignorelist").getKeys(false)) {
  1354.             List<String> chats = getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".chats");
  1355.             for (String chat : chats) {
  1356.                 if (chat.equalsIgnoreCase(getCustomChats().getString(chatID + ".name"))) {
  1357.                     String user = getOther(ignorelist_location).getString("ignorelist." + uuid + ".username");
  1358.                     if (i <= (getConfig().getInt("Other.ignored-length") * page)) {
  1359.                         if (i > getConfig().getInt("Other.ignored-length") * (page- 1)) {
  1360.                             if (ignored.equalsIgnoreCase("")) {
  1361.                                 ignored = getConfig().getString("Messages.ignored-items").replace("%#%", i + "").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", getOther(ignorelist_location).getString("ignorelist." + uuid + ".username")).replace("%PLAYER_UUID%", uuid);
  1362.                                 i++;
  1363.                             } else {
  1364.                                 if (!user.equalsIgnoreCase("")) {
  1365.                                     ignored = ignored + getConfig().getString("Messages.ignored-items").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%#%", i + "").replace("%NL%", "\n").replace("%PLAYER_NAME%", getOther(ignorelist_location).getString("ignorelist." + uuid + ".username")).replace("%PLAYER_UUID%", uuid);
  1366.                                     i++;
  1367.                                 }
  1368.                             }
  1369.                         }
  1370.                     }
  1371.                 }
  1372.                
  1373.             }          
  1374.            
  1375.             b++;
  1376.         }
  1377.         double pages = Math.ceil((double)(i-1)/(double)length);
  1378.         String thed = getConfig().getString("Messages.ignored-layout").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%ITEMS%", ignored).replace("%PH#%", (pages + "").replace(".0", "")).replace("%PL#%", (page + "").replace(".0", "")).replace("%COUNT%", ((i-1) + "").replace(".0", "")).replace("%PLAYER_NAME%", p.getName()).replace("%PLAYER_UUID%", p.getUniqueId().toString()).replace("%DISPLAY_NAME%", p.getDisplayName()).replace("%NL%", "\n");
  1379.         if (ignored.equalsIgnoreCase("")) {
  1380.             thed = "&cNo one was found on the ignored list\n";
  1381.         }
  1382.        
  1383.     return thed;
  1384.     }
  1385.     //---- End Ignored Message Generator
  1386.    
  1387.     // Generates the message for the swear list - Added v0.8.5 - 2/17/2017
  1388.     @SuppressWarnings("unused")
  1389.     public String showSwearListServer(int page, int chatID) {
  1390.         String word = "";
  1391.         String replace = "";
  1392.         String items = "";
  1393.         //double listLength = getOther(ignorelist_location).getConfigurationSection("ignorelist").getKeys(false).size();
  1394.         double length = getOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name"))).getStringList("Dictionary").size();
  1395.         double pageLength = getConfig().getInt("Other.antiswear-list-server-length");
  1396.         int i = 1;
  1397.         for (String swear : getOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name"))).getStringList("Dictionary")) {
  1398.             if (i <= (pageLength * page)) { // 15 * 2 = 30
  1399.                 if (i > pageLength * (page - 1)) { // 15 * 1 = 15
  1400.                     if (items.equalsIgnoreCase("")) {
  1401.                         if (swear.split(":").length > 1) {
  1402.                             items = getConfig().getString("Messages.antiswear-list-items").replace("%#%", i + "").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%NL%", "\n").replace("%WORD%", swear.split(":")[0]).replace("%REPLACEMENT%", swear.split(":")[1]); 
  1403.                         } else {
  1404.                             items = getConfig().getString("Messages.antiswear-list-items").replace("%#%", i + "").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%NL%", "\n").replace("%WORD%", swear.split(":")[0]).replace("%REPLACEMENT%", "");
  1405.                         }
  1406.                     } else {
  1407.                         if (length != 0) {
  1408.                             if (swear.split(":").length > 1) {
  1409.                                 items = items + getConfig().getString("Messages.antiswear-list-items").replace("%#%", i + "").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%NL%", "\n").replace("%WORD%", swear.split(":")[0]).replace("%REPLACEMENT%", swear.split(":")[1]); 
  1410.                             } else {
  1411.                                 items = items + getConfig().getString("Messages.antiswear-list-items").replace("%#%", i + "").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%NL%", "\n").replace("%WORD%", swear.split(":")[0]).replace("%REPLACEMENT%", "");
  1412.                             }
  1413.                         }
  1414.                     }
  1415.                    
  1416.                 }
  1417.                
  1418.             }
  1419.             i++;
  1420.         }
  1421.         double pages = Math.ceil((double)(length)/(double)pageLength);
  1422.         String thed = getConfig().getString("Messages.antiswear-list-layout").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%ITEMS%", items).replace("%PH#%", (pages + "").replace(".0", "")).replace("%PL#%", (page + "").replace(".0", "")).replace("%COUNT%", length + "").replace(".0", "").replace("%NL%", "\n");
  1423.         if (items.equalsIgnoreCase("")) {
  1424.             thed = "&cThe swear list appears to be empty\n";
  1425.         }
  1426.        
  1427.     return thed;
  1428.     }
  1429.     //---- End swear list Message Generator
  1430.    
  1431.     //---- Toggle Focus Mode - v0.8.5 - 2/14/17
  1432.     public boolean toggleFocusMode(Player p, String chat) {
  1433.         if (focus.containsKey(p)) {
  1434.             if (focus.get(p).equalsIgnoreCase(chat)) {
  1435.                 focus.remove(p);
  1436.                 if (getConfig().getBoolean("Other.focus.saved")) {
  1437.                     ssOther(getConfig().getString("Other.focus.location"), p.getUniqueId().toString(), null);
  1438.                 }
  1439.                 return false;
  1440.             } else {
  1441.                 focus.remove(p);
  1442.                 focus.put(p, chat);
  1443.                 if (getConfig().getBoolean("Other.focus.saved")) {
  1444.                     ssOther(getConfig().getString("Other.focus.location"), p.getUniqueId().toString() + ".username", p.getName());
  1445.                     ssOther(getConfig().getString("Other.focus.location"), p.getUniqueId().toString() + ".chat", chat);
  1446.                 }
  1447.                 return true;
  1448.             }
  1449.         } else {
  1450.             focus.put(p, chat);
  1451.             if (getConfig().getBoolean("Other.focus.saved")) {
  1452.                 ssOther(getConfig().getString("Other.focus.location"), p.getUniqueId().toString() + ".username", p.getName());
  1453.                 ssOther(getConfig().getString("Other.focus.location"), p.getUniqueId().toString() + ".chat", chat);
  1454.             }
  1455.             return true;
  1456.         }
  1457.     }
  1458.     //---- End Toggle Focus Mode
  1459.  
  1460.     //---- Toggle Color Codes - v0.8.2
  1461.     public boolean toggleColor(String code, int chatID) {
  1462.         String[] color_codes = getCustomChats().getString(chatID + ".color-codes").split(" ");
  1463.         for (String color : color_codes) {
  1464.             if (color.equalsIgnoreCase(code + ":true")) {
  1465.                 String theColors = "";
  1466.                 for (String newColors : color_codes) {
  1467.                     if (newColors.equalsIgnoreCase(code + ":true")) {
  1468.                         if (theColors.equalsIgnoreCase("")) {
  1469.                             theColors = newColors.replace("true", "false");
  1470.                         } else {
  1471.                             theColors = theColors + " " + newColors.replace("true", "false");
  1472.                         }
  1473.                     } else {
  1474.                         if (theColors.equalsIgnoreCase("")) {
  1475.                             theColors = newColors;
  1476.                         } else {
  1477.                             theColors = theColors + " " + newColors;
  1478.                         }
  1479.                     }
  1480.                 }
  1481.                 getCustomChats().set(chatID + ".color-codes", theColors);
  1482.                 saveCustomConfig();
  1483.                 reloadChats();
  1484.                 return true;
  1485.             } else if (color.equalsIgnoreCase(code + ":false")) {
  1486.                 String theColors = "";
  1487.                 for (String newColors : color_codes) {
  1488.                     if (newColors.equalsIgnoreCase(code + ":false")) {
  1489.                         if (theColors.equalsIgnoreCase("")) {
  1490.                             theColors = newColors.replace("false", "true");
  1491.                         } else {
  1492.                             theColors = theColors + " " + newColors.replace("false", "true");
  1493.                         }
  1494.                     } else {
  1495.                         if (theColors.equalsIgnoreCase("")) {
  1496.                             theColors = newColors;
  1497.                         } else {
  1498.                             theColors = theColors + " " + newColors;
  1499.                         }
  1500.                     }
  1501.                 }
  1502.                 getCustomChats().set(chatID + ".color-codes", theColors);
  1503.                 saveCustomConfig();
  1504.                 reloadChats();
  1505.                 return true;
  1506.             }
  1507.         }
  1508.         return false;          
  1509.     }
  1510.    
  1511.     //---- End Toggle Color Codes
  1512.    
  1513.     //---- Used to detect old blacklist or ignore systems and convert them to the new system - Added v0.8.5 - 2/22/2017
  1514.     @SuppressWarnings("deprecation")
  1515.     public void checkPortOldBlacklistIgnore() {
  1516.         if (!getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  1517.             for (String name : getConfig().getString("Other.blacklist").split(",")) {
  1518.                 if (!name.equalsIgnoreCase("")) {
  1519.                     modifyBlacklist(getServer().getOfflinePlayer(name).getUniqueId().toString(),getServer().getOfflinePlayer(name).getName(), "+");
  1520.                 }
  1521.             }
  1522.             getConfig().set("Other.blacklist", "");
  1523.             saveConfig();
  1524.             reloadConfig();
  1525.         }
  1526.         int i = 0;
  1527.         do {
  1528.             for (String name : getCustomChats().getString(i + ".ignore-list").split(",")) {
  1529.                 if (!name.equalsIgnoreCase("")) {
  1530.                         if (getServer().getOfflinePlayer(name) != null) {
  1531.                             modifyIgnorelist(getServer().getOfflinePlayer(name).getUniqueId().toString(), getServer().getOfflinePlayer(name).getName(), i, "+");
  1532.                         }                  
  1533.                 }
  1534.                
  1535.             }
  1536.             getCustomChats().set(i + ".ignore-list", "");
  1537.             saveCustomConfig();
  1538.             reloadChats();
  1539.             i++;
  1540.         } while (i < getCustomChats().getInt("Chat Count"));
  1541.          
  1542.     }
  1543.     //---- End detect old blacklist ignore system
  1544.    
  1545.     //---- Used to detect old configs and port them over to the new system - v0.8.2
  1546.    
  1547.     @SuppressWarnings("unused")
  1548.     public void checkOldConfgAndPort() {
  1549.         try {
  1550.            
  1551.             String a = getConfig().getString("Check Version");
  1552.             String b = getConfig().getString("Tag.mod.allow-ignore");
  1553.             if (b.equalsIgnoreCase("null")) {
  1554.                 return;
  1555.             }
  1556.             File file = new File(getDataFolder(), "config.yml");
  1557.             File file2 = new File(getDataFolder(), "oldConfig.yml");
  1558.             file.renameTo(file2);
  1559.             saveDefaultConfig();
  1560.             reloadConfig();
  1561.             reloadOld();
  1562.             getConfig().set("Check Version", getOldConfig().getBoolean("Check Version"));
  1563.             saveConfig();
  1564.             getConfig().set("Other.blacklist",getOldConfig().getString("Other.ignore-blacklist").replaceAll("none", ""));
  1565.             saveConfig();
  1566.             getConfig().set("Messages.no-permission", getOldConfig().getString("Messages.no-permission"));
  1567.             saveConfig();
  1568.             getConfig().set("Messages.chat-disabled", getOldConfig().getString("Messages.chat-disabled"));
  1569.             saveConfig();
  1570.             getConfig().set("Messages.reload", getOldConfig().getString("Messages.reload"));
  1571.             saveConfig();
  1572.             getConfig().set("Messages.toggle" ,getOldConfig().getString("Messages.toggle"));
  1573.             saveConfig();
  1574.             getConfig().set("Messages.error", getOldConfig().getString("Messages.error"));
  1575.             saveConfig();
  1576.             getConfig().set("Messages.ignore", getOldConfig().getString("Messages.ignore"));
  1577.             saveConfig();
  1578.             getConfig().set("Messages.ignore-fail", getOldConfig().getString("Messages.ignore-fail"));
  1579.             saveConfig();
  1580.             getConfig().set("Messages.ignore-already", getOldConfig().getString("Messages.ignore-already"));
  1581.             saveConfig();
  1582.             getConfig().set("Messages.ignore-not-found", getOldConfig().getString("Messages.ignore-not-found"));
  1583.             saveConfig();
  1584.             getConfig().set("Messages.ignore-disabled", getOldConfig().getString("Messages.ignore-disabled"));
  1585.             saveConfig();
  1586.             getConfig().set("Messages.force-unignore", getOldConfig().getString("Messages.force-unignore").replace("%CHAT%", "%CHAT_NAME%"));
  1587.             saveConfig();
  1588.             getConfig().set("Messages.remove-blacklisted",getOldConfig().getString("Messages.remove-blacklisted"));
  1589.             saveConfig();
  1590.             getCustomChats().set("0.allow-ignore", getOldConfig().getBoolean("Tag.mod.allow-ignore"));
  1591.             saveCustomConfig();
  1592.             getCustomChats().set("0.layout" , getOldConfig().getString("Tag.mod.layout"));
  1593.             saveCustomConfig();
  1594.             getCustomChats().set("0.enabled" , getOldConfig().getBoolean("Enabled.Mod"));
  1595.             saveCustomConfig();
  1596.             getCustomChats().set("0.ignore-list" , getOldConfig().getString("Other.ignore.mod").replaceAll("none", ""));
  1597.             saveCustomConfig();
  1598.             getCustomChats().set("1.allow-ignore" , getOldConfig().getBoolean("Tag.admin.allow-ignore"));
  1599.             saveCustomConfig();
  1600.             getCustomChats().set("1.layout" , getOldConfig().getString("Tag.admin.layout"));
  1601.             saveCustomConfig();
  1602.             getCustomChats().set("1.enabled" , getOldConfig().getBoolean("Enabled.Admin"));
  1603.             saveCustomConfig();
  1604.             getCustomChats().set("1.ignore-list" , getOldConfig().getString("Other.ignore.admin").replaceAll("none", ""));
  1605.             saveCustomConfig();
  1606.             getCustomChats().set("2.allow-ignore" , getOldConfig().getBoolean("Tag.owner.allow-ignore"));
  1607.             saveCustomConfig();
  1608.             getCustomChats().set("2.layout" , getOldConfig().getString("Tag.owner.layout"));
  1609.             saveCustomConfig();
  1610.             getCustomChats().set("2.enabled" , getOldConfig().getBoolean("Enabled.Owner"));
  1611.             saveCustomConfig();
  1612.             getCustomChats().set("2.ignore-list" , getOldConfig().getString("Other.ignore.owner").replaceAll("none", ""));
  1613.             saveCustomConfig();
  1614.             getCustomChats().set("3.allow-ignore" , getOldConfig().getBoolean("Tag.staff.allow-ignore"));
  1615.             saveCustomConfig();
  1616.             getCustomChats().set("3.layout" , getOldConfig().getString("Tag.staff.layout"));
  1617.             saveCustomConfig();
  1618.             getCustomChats().set("3.enabled" , getOldConfig().getBoolean("Enabled.Staff"));
  1619.             saveCustomConfig();
  1620.             getCustomChats().set("3.ignore-list" , getOldConfig().getString("Other.ignore.staff").replaceAll("none", ""));
  1621.             saveCustomConfig();
  1622.             getCustomChats().set("4.allow-ignore" , getOldConfig().getBoolean("Tag.dev.allow-ignore"));
  1623.             saveCustomConfig();
  1624.             getCustomChats().set("4.layout" , getOldConfig().getString("Tag.dev.layout"));
  1625.             saveCustomConfig();
  1626.             getCustomChats().set("4.enabled" , getOldConfig().getBoolean("Enabled.Dev"));
  1627.             saveCustomConfig();
  1628.             getCustomChats().set("4.ignore-list" , getOldConfig().getString("Other.ignore.dev").replaceAll("none", ""));
  1629.             saveCustomConfig();
  1630.             getCustomChats().set("5.allow-ignore" , getOldConfig().getBoolean("Tag.vip.allow-ignore"));
  1631.             saveCustomConfig();
  1632.             getCustomChats().set("5.layout" , getOldConfig().getString("Tag.vip.layout"));
  1633.             saveCustomConfig();
  1634.             getCustomChats().set("5.enabled" , getOldConfig().getBoolean("Enabled.VIP"));
  1635.             saveCustomConfig();
  1636.             getCustomChats().set("5.ignore-list" , getOldConfig().getString("Other.ignore.vip").replaceAll("none", ""));
  1637.             saveCustomConfig();
  1638.             getCustomChats().set("6.allow-ignore" , getOldConfig().getBoolean("Tag.donator.allow-ignore"));
  1639.             saveCustomConfig();
  1640.             getCustomChats().set("6.layout" , getOldConfig().getString("Tag.donator.layout"));
  1641.             saveCustomConfig();
  1642.             getCustomChats().set("6.enabled" , getOldConfig().getBoolean("Enabled.Donator"));
  1643.             saveCustomConfig();
  1644.             getCustomChats().set("6.ignore-list" , getOldConfig().getString("Other.ignore.donator").replaceAll("none", ""));
  1645.             saveCustomConfig();
  1646.             getCustomChats().set("7.allow-ignore" , getOldConfig().getBoolean("Tag.special.allow-ignore"));
  1647.             saveCustomConfig();
  1648.             getCustomChats().set("7.layout" , getOldConfig().getString("Tag.special.layout"));
  1649.             saveCustomConfig();
  1650.             getCustomChats().set("7.enabled" , getOldConfig().getBoolean("Enabled.Special"));
  1651.             saveCustomConfig();
  1652.             getCustomChats().set("7.ignore-list" , getOldConfig().getString("Other.ignore.special").replaceAll("none", ""));
  1653.             saveCustomConfig();
  1654.             getCustomChats().set("8.allow-ignore" , getOldConfig().getBoolean("Tag.elite.allow-ignore"));
  1655.             saveCustomConfig();
  1656.             getCustomChats().set("8.layout" , getOldConfig().getString("Tag.elite.layout"));
  1657.             saveCustomConfig();
  1658.             getCustomChats().set("8.enabled" , getOldConfig().getBoolean("Enabled.Elite"));
  1659.             saveCustomConfig();
  1660.             getCustomChats().set("8.ignore-list" , getOldConfig().getString("Other.ignore.elite").replaceAll("none", ""));
  1661.             saveCustomConfig();
  1662.             File file3 = new File(getDataFolder(), "oldConfig.yml");
  1663.             File file4 = new File(getDataFolder(), "oldConfig.yml.bak");
  1664.             file3.renameTo(file4);
  1665.         } catch (NullPointerException failed) {
  1666.            
  1667.         }
  1668.     }
  1669.    
  1670.     //---- End Detect Old Config
  1671.    
  1672.     //---- Check and port configs to new config system! - v0.8.2
  1673.    
  1674.     public void portConfig() {
  1675.     }
  1676.    
  1677.     //---- End Check and port configs to new config system!
  1678.    
  1679.     //---- Check black list to see if the player is on the blacklist - v0.8.2
  1680.     @Deprecated // -- Deprecated in v0.8.5 when the ignore system and blacklist system were rewritten to use custom files. - 2/15/2017
  1681.     public boolean checkBlacklist(String player) {
  1682.         List<String> blacklisted = Arrays.asList(getConfig().getString("Other.blacklist").split(","));
  1683.         for (String p : blacklisted) {
  1684.             if (p.toLowerCase().equalsIgnoreCase(player.toLowerCase())) {
  1685.                 return true;
  1686.             }
  1687.         }
  1688.         return false;
  1689.     }
  1690.    
  1691.     //---- End blacklist check player
  1692.        
  1693.     //---- Check blacklist options to see if they can view chat - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1694.    
  1695.     @SuppressWarnings("deprecation")
  1696.     public boolean checkView(String player) {
  1697.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")) {
  1698.             return true;
  1699.         } else if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & !getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")){
  1700.             return false;
  1701.         }
  1702.         return false;
  1703.     }
  1704.    
  1705.     //---- End blacklist check options view chat
  1706.            
  1707.     //---- Check blacklist options to see if they can view chat is specified - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1708.    
  1709.     @SuppressWarnings("deprecation")
  1710.     public boolean checkViewChatSpecified(String player, String chat) {
  1711.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player)) {
  1712.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")) {
  1713.                 return true;
  1714.             }
  1715.             if (checkView(player)) {
  1716.                 for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-view-chats.specified-chats")) {
  1717.                     if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  1718.                 }
  1719.                 return false;
  1720.             }
  1721.         }
  1722.        
  1723.         return true;
  1724.     }
  1725.            
  1726.     //---- End blacklist check options view chat if chat is specified
  1727.        
  1728.     //---- Check blacklist options to see if they can talk chat - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1729.  
  1730.     @SuppressWarnings("deprecation")
  1731.     public boolean checkTalk(String player) {
  1732.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")) {
  1733.             return true;
  1734.         } else if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & !getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")){
  1735.             return false;
  1736.         }
  1737.         return false;
  1738.     }
  1739.    
  1740.     //---- End blacklist check options talk chat
  1741.  
  1742.     //---- Check blacklist options to see if they can talk chat is specified - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1743.    
  1744.     @SuppressWarnings("deprecation")
  1745.     public boolean checkTalkChatSpecified(String player, String chat) {
  1746.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player)) {
  1747.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")) {
  1748.                 return true;
  1749.             }
  1750.             if (checkTalk(player)) {
  1751.                 for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-talk-in-chats.specified-chats")) {
  1752.                     if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  1753.                 }
  1754.                 return false;
  1755.             }
  1756.         }
  1757.        
  1758.         return true;
  1759.     }
  1760.            
  1761.     //---- End blacklist check options talk chat if chat is specified
  1762.    
  1763.     //---- Check ignore options to see if they can ignore chat - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1764.    
  1765.     @SuppressWarnings("deprecation")
  1766.     public boolean checkIgnore(String player) {
  1767.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")) {
  1768.             return true;
  1769.         } else if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player) & !getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")){
  1770.             return false;
  1771.         }
  1772.         return false;
  1773.     }
  1774.    
  1775.     //---- End ignore check options ignore chat
  1776.        
  1777.     //---- Check ignore options to see if they can ignore chat is specified - v0.8.2 - Updated v0.8.5 - 2/15/2017
  1778.     @SuppressWarnings("deprecation")
  1779.     public boolean checkIgnoreChatSpecified(String player, String chat) {
  1780.         if (inBlacklist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player)) {
  1781.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")) {
  1782.                 return true;
  1783.             } else {
  1784.                 if (inIgnorelist(getServer().getOfflinePlayer(player).getUniqueId().toString(), player, detectChatID(chat))) {
  1785.                     for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-ignore-chats.specified-chats")) {
  1786.                         if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  1787.                     }
  1788.                     return false;
  1789.                 }
  1790.                 return false;
  1791.             }
  1792.         }
  1793.        
  1794.         return true;
  1795.     }
  1796.    
  1797.     //---- End ignore check options ignore chat if chat is specified
  1798.    
  1799.     @SuppressWarnings("unused")
  1800.     //---- This is called when force unignoring chats. This was modified to accept custom chats in v0.8.2 - Created in v0.8
  1801.     @Deprecated // -- Depracated after huge overhaul of ignore and black list system in v0.8.5 - 2/15/2017
  1802.     private void forceUnIgnore(String player, int id) {
  1803.         if (id == -1) {
  1804.             int i = 0;
  1805.             if (player.equalsIgnoreCase("*")) {
  1806.                 do {
  1807.                     getCustomChats().set(i + ".ignore-list", "");
  1808.                     saveCustomConfig();
  1809.                 } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  1810.                
  1811.             } else {
  1812.                 do {
  1813.                     getCustomChats().set(i + ".ignore-list", getCustomChats().getString(i + ".ignore-list").toLowerCase().replace(player.toLowerCase() + ",", "").replace(player.toLowerCase(), ""));
  1814.                     saveCustomConfig();
  1815.                 } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  1816.             }
  1817.             return;
  1818.         }
  1819.         if (player.equalsIgnoreCase("*")) {
  1820.             getCustomChats().set(id + ".ignore-list", "");
  1821.             saveCustomConfig();
  1822.         } else {
  1823.             if (getCustomChats().getString(id + ".ignore-list").equalsIgnoreCase("")){
  1824.                
  1825.             } else {
  1826.                 getCustomChats().set(id + ".ignore-list", getCustomChats().getString(id + ".ignore-list").toLowerCase().replace(player.toLowerCase() + ",", "").replace(player.toLowerCase(), ""));
  1827.                 saveCustomConfig();
  1828.                 if (getCustomChats().getString(id + ".ignore-list").equalsIgnoreCase("null")) {
  1829.                     getCustomChats().set(id + ".ignore-list", "");
  1830.                     saveCustomConfig();
  1831.                 }
  1832.             }
  1833.         }
  1834.        
  1835.         /* - Removed v0.8.2 - Removed with when custom chats were added
  1836.         switch (chat.toLowerCase()) {
  1837.         case "mod":
  1838.             getConfig().set("Other.ignore.mod", getConfig().getString("Other.ignore.mod").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1839.             saveConfig();
  1840.             break;
  1841.         case "all":
  1842.             getConfig().set("Other.ignore.elite", getConfig().getString("Other.ignore.elite").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1843.             saveConfig();
  1844.             getConfig().set("Other.ignore.special", getConfig().getString("Other.ignore.special").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1845.             saveConfig();
  1846.             getConfig().set("Other.ignore.donator", getConfig().getString("Other.ignore.donator").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1847.             saveConfig();
  1848.             getConfig().set("Other.ignore.vip", getConfig().getString("Other.ignore.vip").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1849.             saveConfig();
  1850.             getConfig().set("Other.ignore.dev", getConfig().getString("Other.ignore.dev").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1851.             saveConfig();
  1852.             getConfig().set("Other.ignore.staff", getConfig().getString("Other.ignore.staff").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1853.             saveConfig();
  1854.             getConfig().set("Other.ignore.owner", getConfig().getString("Other.ignore.owner").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1855.             saveConfig();
  1856.             getConfig().set("Other.ignore.admin", getConfig().getString("Other.ignore.admin").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1857.             saveConfig();
  1858.             getConfig().set("Other.ignore.mod", getConfig().getString("Other.ignore.mod").replace(a.getName() + ",", "").replace(a.getName(), ""));
  1859.             saveConfig();
  1860.             break;
  1861.            
  1862.         }*/
  1863.     }
  1864.     //---- End forceunignore
  1865.     //---- Used to color not message chats - Added v0.7
  1866.     public static String ct(String text) {
  1867.         return text.replace("&0", ChatColor.BLACK + "").replace("&1", ChatColor.DARK_BLUE + "").replace("&2", ChatColor.DARK_GREEN + "").replace("&3", ChatColor.DARK_AQUA + "").replace("&4", ChatColor.DARK_RED + "").replace("&5", ChatColor.DARK_PURPLE + "").replace("&6", ChatColor.GOLD + "").replace("&7", ChatColor.GRAY + "").replace("&8", ChatColor.DARK_GRAY + "").replace("&9", ChatColor.BLUE + "").replace("&a", ChatColor.GREEN + "").replace("&b", ChatColor.AQUA + "").replace("&c", ChatColor.RED + "").replace("&d", ChatColor.LIGHT_PURPLE + "").replace("&e", ChatColor.YELLOW + "").replace("&f", ChatColor.WHITE + "").replace("&l", ChatColor.BOLD + "").replace("&m", ChatColor.STRIKETHROUGH + "").replace("&n", ChatColor.UNDERLINE + "").replace("&o", ChatColor.ITALIC + "").replace("&r", ChatColor.RESET + "").replace("&k", ChatColor.MAGIC + "");
  1868.     }
  1869.     //---- End of color
  1870.     //---- Used to broadcast message - Added v0.7
  1871.     public static void Broadcast(String msg) {
  1872.         String tag = ct("&8[&9VPC&8] &2");
  1873.         Bukkit.getServer().broadcastMessage(tag + ct(msg));
  1874.     }
  1875.     //---- End of broad cast
  1876.     //---- Used to detect what colors are enabled for what chats. This was modified in v0.8.2 to accept custom chats
  1877.     public Boolean checkColorCodes(String code, int id) {
  1878.         System.out.println(code + " - End of list");
  1879.         for (String precolors: Arrays.asList(getCustomChats().getString(id + ".color-codes").split(" "))) {
  1880.             List<String> temp = Arrays.asList(precolors.split(":"));
  1881.             String colors = temp.get(0);
  1882.             Boolean colorsState = Boolean.parseBoolean(temp.get(1));
  1883.             if (colors.equalsIgnoreCase(code) && colorsState) {
  1884.                 return true;
  1885.             }
  1886.         }
  1887.         return false;
  1888.     }
  1889.     //---- End of color checking
  1890.     //---- Ingore Check
  1891.     @Deprecated // -- Deprecated in v0.8.5 when the ignore system and blacklist system were rewritten to use custom files. - 2/15/2017
  1892.     public Boolean checkIgnore(String user, int id) {
  1893.         boolean b = false;
  1894.        
  1895.         for (String a: getCustomChats().getString(id + ".ignore-list").toLowerCase().split(",")) {
  1896.             if (a.equalsIgnoreCase(user)) {
  1897.                 b = true;
  1898.             }
  1899.         }
  1900.         if (b) {
  1901.             return true;
  1902.         }
  1903.         return false;
  1904.     }
  1905.     //---- Ignore Check End
  1906.    
  1907.     //---- Output Color Codes - Added v0.8.2
  1908.     public String outputColorCodes(int chatID) {
  1909.         String text = getCustomChats().getString(chatID + ".name") + " Current Color Code Status\n";
  1910.         @SuppressWarnings("unused")
  1911.         int i = 0;
  1912.         for (String precolors: Arrays.asList(getCustomChats().getString(chatID + ".color-codes").split(" "))) {
  1913.             List<String> temp = Arrays.asList(precolors.split(":"));
  1914.             String colors = temp.get(0);
  1915.             Boolean colorsState = Boolean.parseBoolean(temp.get(1));
  1916.             if (colors.equalsIgnoreCase("black") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&91. &0Black").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("black") & !colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&91. &0Black").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1917.             if (colors.equalsIgnoreCase("dark_blue") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&92. &1Dark Blue").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_blue") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&92. &1Dark Blue").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1918.             if (colors.equalsIgnoreCase("dark_green") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&93. &2Dark Green").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_green") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&93. &2Dark Green").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1919.             if (colors.equalsIgnoreCase("dark_aqua") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&94. &3Dark Aqua").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_aqua") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&94. &3Dark Aqua").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1920.             if (colors.equalsIgnoreCase("dark_red") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&95. &4Dark Red").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_red") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&95. &4Dark Red").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1921.             if (colors.equalsIgnoreCase("dark_purple") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&96. &5Dark Purple").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_purple") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&96. &5Dark Purple").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1922.             if (colors.equalsIgnoreCase("gold") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&97. &6Gold").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("gold") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&97. &6Gold").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1923.             if (colors.equalsIgnoreCase("gray") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&98. &7Gray").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("gray") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&98. &7Gray").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1924.             if (colors.equalsIgnoreCase("dark_gray") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&99. &8Dark Gray").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("dark_gray") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&99. &8Dark Gray").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1925.             if (colors.equalsIgnoreCase("blue") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&910. &9Blue").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("blue") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&910. &9Blue").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1926.             if (colors.equalsIgnoreCase("green") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&911. &aGreen").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("green") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&911. &aGreen").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1927.             if (colors.equalsIgnoreCase("aqua") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&912. &bAqua").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("aqua") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&912. &bAqua").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1928.             if (colors.equalsIgnoreCase("red") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&913. &cRed").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("red") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&913. &cRed").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1929.             if (colors.equalsIgnoreCase("light_purple") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&914. &dLight Purple").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("light_purple") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&914. &dLight Purple").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1930.             if (colors.equalsIgnoreCase("yellow") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&915. &eYellow").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("yellow") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&915. &eYellow").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1931.             if (colors.equalsIgnoreCase("white") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&916. &fWhite").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("white") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&916. &fWhite").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1932.             if (colors.equalsIgnoreCase("obfuscated") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&917. &fObfuscated").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("obfuscated") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&917. &fObfuscated").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1933.             if (colors.equalsIgnoreCase("bold") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&918. &f&lBold").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("bold") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&918. &f&lBold").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1934.             if (colors.equalsIgnoreCase("strikethrough") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&919. &f&mStrikethrough").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("strikethrough") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&919. &f&mStrikethrough").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1935.             if (colors.equalsIgnoreCase("underline") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&920. &f&nUnderline").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("underline") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&920. &f&nUnderline").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1936.             if (colors.equalsIgnoreCase("italic") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&921. &f&oItalic").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("italic") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&921. &f&oItalic").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1937.             if (colors.equalsIgnoreCase("reset") & colorsState) { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&922. &f&rReset").replace("%STATE%", "&aEnabled").replace("%NL%", "\n");} else if (colors.equalsIgnoreCase("reset") & !colorsState)  { text = text + getConfig().getString("Messages.colors").replace("%COLOR%", "&922. &f&rReset").replace("%STATE%", "&cDisabled").replace("%NL%", "\n");}
  1938.             i++;
  1939.         }
  1940.         return ct(text);
  1941.     }
  1942.     //---- End Output Color Codes
  1943.        
  1944.     //---- Used to send messages - Modified in v0.8.2 to accept custom chats
  1945.     public String chatCleaner(String text , int id) {
  1946.         if (text.contains("&0") && checkColorCodes("black", id) == true) { text = text.replace("&0", ChatColor.BLACK + ""); } else { text = text.replace("&0", "");}
  1947.         if (text.contains("&1") && checkColorCodes("dark_blue", id) == true) { text = text.replace("&1", ChatColor.DARK_BLUE + ""); } else { text = text.replace("&1", "");}
  1948.         if (text.contains("&2") && checkColorCodes("dark_green", id) == true) { text = text.replace("&2", ChatColor.DARK_GREEN + ""); } else { text = text.replace("&2", "");}
  1949.         if (text.contains("&3") && checkColorCodes("dark_aqua", id) == true) { text = text.replace("&3", ChatColor.DARK_AQUA + ""); } else { text = text.replace("&3", "");}
  1950.         if (text.contains("&4") && checkColorCodes("dark_red", id) == true) { text = text.replace("&4", ChatColor.DARK_RED + ""); } else { text = text.replace("&4", "");}
  1951.         if (text.contains("&5") && checkColorCodes("dark_purple", id) == true) { text = text.replace("&5", ChatColor.DARK_PURPLE + ""); } else { text = text.replace("&5", "");}
  1952.         if (text.contains("&6") && checkColorCodes("gold", id) == true) { text = text.replace("&6", ChatColor.GOLD + ""); } else { text = text.replace("&6", "");}
  1953.         if (text.contains("&7") && checkColorCodes("gray", id) == true) { text = text.replace("&7", ChatColor.GRAY + ""); } else { text = text.replace("&7", "");}
  1954.         if (text.contains("&8") && checkColorCodes("dark_gray", id) == true) { text = text.replace("&8", ChatColor.DARK_GRAY + ""); } else { text = text.replace("&8", "");}
  1955.         if (text.contains("&9") && checkColorCodes("blue", id) == true) { text = text.replace("&9", ChatColor.BLUE + ""); } else { text = text.replace("&9", "");}
  1956.         if (text.contains("&a") && checkColorCodes("green", id) == true) { text = text.replace("&a", ChatColor.GREEN + ""); } else { text = text.replace("&a", "");}
  1957.         if (text.contains("&b") && checkColorCodes("aqua", id) == true) { text = text.replace("&b", ChatColor.AQUA + ""); } else { text = text.replace("&b", "");}
  1958.         if (text.contains("&c") && checkColorCodes("red", id) == true) { text = text.replace("&c", ChatColor.RED + ""); } else { text = text.replace("&c", "");}
  1959.         if (text.contains("&d") && checkColorCodes("light_purple", id) == true) { text = text.replace("&d", ChatColor.LIGHT_PURPLE + ""); } else { text = text.replace("&d", "");}
  1960.         if (text.contains("&e") && checkColorCodes("yellow", id) == true) { text = text.replace("&e", ChatColor.YELLOW + ""); } else { text = text.replace("&e", "");}
  1961.         if (text.contains("&f") && checkColorCodes("white", id) == true) { text = text.replace("&f", ChatColor.WHITE + ""); } else { text = text.replace("&f", "");}
  1962.         if (text.contains("&k") && checkColorCodes("obfuscated", id) == true) { text = text.replace("&k", ChatColor.MAGIC + ""); } else { text = text.replace("&k", "");}
  1963.         if (text.contains("&l") && checkColorCodes("bold", id) == true) { text = text.replace("&l", ChatColor.BOLD + ""); } else { text = text.replace("&l", "");}
  1964.         if (text.contains("&m") && checkColorCodes("strikethrough", id) == true) { text = text.replace("&m", ChatColor.STRIKETHROUGH + ""); } else { text = text.replace("&m", "");}
  1965.         if (text.contains("&n") && checkColorCodes("underline", id) == true) { text = text.replace("&n", ChatColor.UNDERLINE + ""); } else { text = text.replace("&n", "");}
  1966.         if (text.contains("&o") && checkColorCodes("italic", id) == true) { text = text.replace("&o", ChatColor.ITALIC + ""); } else { text = text.replace("&o", "");}
  1967.         if (text.contains("&r") && checkColorCodes("reset", id) == true) { text = text.replace("&r", ChatColor.RESET + ""); } else { text = text.replace("&r", "");}
  1968.        
  1969.         return text;
  1970.     }
  1971.     public void pMessage(String msg, Player p) {
  1972.         p.sendMessage(ct("&8[&9VPC&8] &2" + msg));
  1973.     }
  1974.     public String pSend(String msg, Player p1, Player p2, String layout, int id) {
  1975.         String tag = ct(getCustomChats().getString(layout)).replace("%PLAYER%", p2.getName()).replace("%DISPLAY_NAME%", p2.getDisplayName()).replace("%MESSAGE%", chatCleaner(msg, id)).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString());
  1976.         /* - Removed v0.8.2 - Removed wheen we added the custom chats - 10/3/16
  1977.         if(rank == "Mod") { tag = ct(getConfig().getString("Tag.mod.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "mod")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1978.         if(rank == "Admin") { tag = ct(getConfig().getString("Tag.admin.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "admin")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1979.         if(rank == "Staff") { tag = ct(getConfig().getString("Tag.staff.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "staff")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1980.         if(rank == "Owner") { tag = ct(getConfig().getString("Tag.owner.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "owner")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1981.         if(rank == "Dev") { tag = ct(getConfig().getString("Tag.dev.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "dev")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1982.         if(rank == "VIP") { tag = ct(getConfig().getString("Tag.vip.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "vip")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1983.         if(rank == "Donator") { tag = ct(getConfig().getString("Tag.donator.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "donator")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1984.         if(rank == "Special") { tag = ct(getConfig().getString("Tag.special.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "special")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1985.         if(rank == "Elite") { tag = ct(getConfig().getString("Tag.elite.layout")).replace("%PLAYER%", p2.getName()).replace("%MESSAGE%", chatCleaner(msg, "elite")).replace("%WORLD%", p1.getWorld().getName()).replace("%GAMEMODE%", p1.getGameMode().toString()); }
  1986.         */
  1987.         System.out.println(tag);
  1988.         p1.sendMessage(tag);
  1989.         return "";
  1990.     }
  1991.    
  1992.     @SuppressWarnings("deprecation")
  1993.     public void sendMessages(String msg, Player player, String permissin, String layout, int id) {
  1994.         int chatID = id;
  1995.         if(player.hasPermission(permissin) && !inIgnorelist(player.getUniqueId().toString(), player.getName(), id)) {
  1996.             if (checkTalkChatSpecified(player.getName(), getCustomChats().getString(id + ".name").toLowerCase())) {
  1997.                 if (getCustomChats().getBoolean(id  + ".enabled")) {
  1998.                     for(Player p : Bukkit.getOnlinePlayers()) {
  1999.                         if(p.hasPermission(permissin) && !inIgnorelist(p.getUniqueId().toString(), p.getName(), id) && checkViewChatSpecified(p.getName().toLowerCase(), getCustomChats().getString(id + ".name").toLowerCase()) && getPlayerIgnoreStatus(getServer().getOfflinePlayer(player.getName()), p).equalsIgnoreCase("&cunignored")) {
  2000.                             pSend(msg, p, player, layout, id);                         
  2001.                         }
  2002.                     }
  2003.                 } else {
  2004.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_TAG%", getCustomChats().getString(chatID + ".layout-tag")).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%CHAT_ID%", chatID + "").replace("%PLAYER%", player.getName()).replace("%DISPLAY_PLAYER%", player.getDisplayName().replace("%STATE%", "Disabled")).replace("%STATUS%", "").replace("%LIST%", "").replace("%STATUS%", ""), player);            
  2005.                 }
  2006.             } else {
  2007.                 pMessage("You are currently blacklisted from this chat and may not chat in this chat.", player);
  2008.             }
  2009.         } else {
  2010.             pMessage("You are currently ignoring this chat.", player);
  2011.         }
  2012.     }
  2013.    
  2014.     //---- End of sending messages
  2015.    
  2016.    
  2017.     // Modify Blacklist - v0.8.5 - 2/15/2017 - Added to simplify blacklist system
  2018.         public void modifyBlacklist(String uuid, String name, String modification) {
  2019.             switch (modification) {
  2020.             case "+":
  2021.                 ssOther(blacklist_location, "blacklist." + uuid, name);
  2022.                 break;
  2023.             case "-":
  2024.                 ssOther(blacklist_location, "blacklist." + uuid, null);
  2025.                 break;
  2026.             case "c":
  2027.                 delOther(blacklist_location);
  2028.                 loadOther();
  2029.                 break;
  2030.             }
  2031.         }
  2032.         //---- End Modify Blacklist
  2033.        
  2034.         // Modify IgnoreList - v0.8.5 - 2/15/2017 - Added to simplify ignore list system
  2035.         public void modifyIgnorelist(String uuid, String name, int chat, String modification) {
  2036.             List<String> l = new ArrayList<>();
  2037.             switch (modification) {
  2038.             case "+":
  2039.                 ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2040.                 if (getOther(ignorelist_location).get("ignorelist." + uuid) != null) {
  2041.                     l = getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".chats");
  2042.                     for (String c : l) {
  2043.                         if (c.equalsIgnoreCase(getCustomChats().getString(chat + ".name"))) {
  2044.                             return;
  2045.                         }
  2046.                     }
  2047.                     l.add(getCustomChats().getString(chat + ".name"));
  2048.                 } else {
  2049.                     l.add(getCustomChats().getString(chat + ".name"));
  2050.                 }
  2051.                 ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", l);
  2052.                 break;
  2053.             case "-":
  2054.                 try {
  2055.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2056.                     if (getOther(ignorelist_location).contains("ignorelist." + uuid)) {
  2057.                         l = getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".chats");
  2058.                         if (l.size() == 1 & l.get(0).equalsIgnoreCase(getCustomChats().getString(chat + ".name"))) {
  2059.                             if (getOther(ignorelist_location).get("ignorelist." + uuid + ".players") != null) {
  2060.                                 ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2061.                             } else {
  2062.                                 ssOther(ignorelist_location, "ignorelist." + uuid, null);
  2063.                             }
  2064.                             return;
  2065.                         } else if (l.size() == 1 && !l.get(0).equalsIgnoreCase(getCustomChats().getString(chat + ".name"))){
  2066.                             ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2067.                             return;
  2068.                         }
  2069.                         l.remove(getCustomChats().getString(chat + ".name"));
  2070.                         ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", l);  
  2071.                     } else {
  2072.                     }
  2073.                 } catch (NullPointerException e) {
  2074.                    
  2075.                 }
  2076.                
  2077.                
  2078.                 break;
  2079.             case "c":
  2080.                 if (getOther(ignorelist_location).get("ignorelist." + uuid + ".players") != null) {
  2081.                     ssOther(blacklist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2082.                 } else {
  2083.                     ssOther(blacklist_location, "ignorelist." + uuid, null);
  2084.                 }
  2085.                
  2086.                 break;
  2087.             }
  2088.         }
  2089.         //---- End Modify ignore list
  2090.        
  2091.         // Detect Player Blacklist - v0.8.5 - 2/15/2017 - Added to detect if a player is inside the blacklist
  2092.         public boolean inBlacklist(String uuid, String name) {
  2093.             if (getOther(blacklist_location).contains("blacklist." + uuid)) {
  2094.                 return true;
  2095.             }
  2096.             return false;
  2097.         }
  2098.         // ---- End Detect Player Blacklist
  2099.        
  2100.         // Detect Player Blacklist - v0.8.5 - 2/15/2017 - Added to detect if a player is inside the blacklist
  2101.         public boolean inIgnorelist(String uuid, String name, int chat) {
  2102.             if (getOther(ignorelist_location).contains("ignorelist." + uuid)) {
  2103.                 for (String c : getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".chats")) {
  2104.                     if (c.equalsIgnoreCase(getCustomChats().getString(chat + ".name"))) {
  2105.                         return true;
  2106.                     }
  2107.                 }
  2108.             }
  2109.             return false;
  2110.         }
  2111.         // ---- End Detect Player Blacklist
  2112.        
  2113.         public void modifyPlayerIgnore(OfflinePlayer offline, Player actor, String action) {
  2114.             String uuid = actor.getUniqueId().toString();
  2115.             String name = actor.getName();
  2116.             String offline_uuid = offline.getUniqueId().toString();
  2117.             String offline_name = offline.getName();
  2118.             List<String> l = new ArrayList<>();
  2119.             switch (action) {
  2120.             case "+":
  2121.                 ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2122.                 if (getOther(ignorelist_location).get("ignorelist." + uuid + ".chats") == null) {
  2123.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2124.                 }
  2125.                
  2126.                 if (getOther(ignorelist_location).get("ignorelist." + uuid) == null) {
  2127.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2128.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2129.                 }
  2130.                     if (getPlayerIgnoreStatus(offline, actor).equalsIgnoreCase("&aignored")) {
  2131.                         return;
  2132.                     } else {
  2133.                         if (getOther(ignorelist_location).get("ignorelist." + uuid + ".players") != null) {
  2134.                             l = getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".players");
  2135.                             l.add(offline_uuid + ";" + offline_name);
  2136.                             ssOther(ignorelist_location, "ignorelist." + uuid + ".players", l);
  2137.                         } else {
  2138.                             l.clear();
  2139.                             l.add(offline_uuid + ";" + offline_name);
  2140.                             ssOther(ignorelist_location, "ignorelist." + uuid + ".players", l);
  2141.                         }
  2142.                     }
  2143.                 break;
  2144.             case "-":
  2145.                 ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2146.                 if (getOther(ignorelist_location).get("ignorelist." + uuid + ".chats") == null) {
  2147.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2148.                 }
  2149.                     if (getOther(ignorelist_location).get("ignorelist." + uuid) != null) {
  2150.                         if (getPlayerIgnoreStatus(offline, actor).equalsIgnoreCase("&aignored")) {
  2151.                             if (getOther(ignorelist_location).get("ignorelist." + uuid + ".players") != null) {
  2152.                                 l = getOther(ignorelist_location).getStringList("ignorelist." + uuid + ".players");
  2153.                                 l.remove(offline_uuid + ";" + offline_name);
  2154.                                 ssOther(ignorelist_location, "ignorelist." + uuid + ".players", l);
  2155.                             }
  2156.                         }
  2157.                     }
  2158.                 break;
  2159.             case "clear":
  2160.                 ssOther(ignorelist_location, "ignorelist." + uuid + ".username", name);
  2161.                 if (getOther(ignorelist_location).get("ignorelist." + uuid + ".chats") == null) {
  2162.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".chats", new ArrayList<>());
  2163.                 }
  2164.                 if (getOther(ignorelist_location).get("ignorelist." + uuid + ".players") != null) {
  2165.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".players", new ArrayList<>());
  2166.                 } else {
  2167.                     ssOther(ignorelist_location, "ignorelist." + uuid + ".players", new ArrayList<>());
  2168.                 }
  2169.                 break;
  2170.             case "toggle":
  2171.                 if (getPlayerIgnoreStatus(offline, actor).equalsIgnoreCase("&aignored")){
  2172.                     modifyPlayerIgnore(offline, actor, "-");
  2173.                 } else if (getPlayerIgnoreStatus(offline, actor).equalsIgnoreCase("&cunignored")) {
  2174.                     modifyPlayerIgnore(offline, actor, "+");
  2175.                 }
  2176.                 break;
  2177.             }
  2178.            
  2179.         }
  2180.        
  2181.         public String getPlayerIgnoreStatus(OfflinePlayer offline, Player actor) {
  2182.             if (getOther(ignorelist_location).get("ignorelist." + actor.getUniqueId().toString() + ".players") != null) {
  2183.                 List<String> l = getOther(ignorelist_location).getStringList("ignorelist." + actor.getUniqueId().toString() + ".players");
  2184.                 for (String e : l) {
  2185.                     if (e.equalsIgnoreCase(offline.getUniqueId().toString() + ";" + offline.getName())) {
  2186.                         return "&aignored";
  2187.                     }
  2188.                 }
  2189.                 return "&cunignored";
  2190.             } else {
  2191.                 return "&cunignored";
  2192.             }
  2193.         }
  2194.        
  2195.         public String antiswearServerCheck(String msg, int chatID) {
  2196.             //removed messages will equal - ERROR: 1337 - Banned Message
  2197.            
  2198.             List<String> l = getOther(getCustomChats().getString(chatID + ".anti-swear.server.file-name").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name"))).getStringList("Dictionary");
  2199.             String[] msgSplit = msg.split(" ");
  2200.             String final_msg = "";
  2201.             for (String msgWord : msgSplit) {  
  2202.                 boolean cont = false;
  2203.                 for (String word : l) {
  2204.                     String replace = "";
  2205.                     if (word.split(":").length > 1) {
  2206.                         replace = word.split(":")[1];
  2207.                     }
  2208.                    
  2209.                     word = word.split(":")[0];
  2210.                     if (word.contains("<%>")) {
  2211.                         word = word.replace("<%>", "");
  2212.                         // Removing Like Word - <%>WORD<%>         
  2213.                         if (msgWord.toLowerCase().contains(word.toLowerCase())) {
  2214.                             if (!replace.equalsIgnoreCase("")) {
  2215.                                 if (final_msg.equalsIgnoreCase("")) {
  2216.                                     final_msg = replace;
  2217.                                 } else {
  2218.                                     final_msg = final_msg + " " + replace;
  2219.                                 }
  2220.                                 cont = true;
  2221.                             }
  2222.                             cont = true;
  2223.                         }
  2224.                     } else if (word.contains("<@>")) {
  2225.                         word = word.replace("<@>", "");
  2226.                         // Removing Banned Word - <@>WORD<@>
  2227.                         if (msgWord.toLowerCase().equalsIgnoreCase(word.toLowerCase())) {
  2228.                             final_msg = "ERROR: 1337 - Banned Message";
  2229.                             return final_msg;
  2230.                         }
  2231.                     } else if (word.contains("<@%>")) {
  2232.                         word = word.replace("<@%>", "");
  2233.                         // Removing Like Banned Word <@%>WORD<@%>
  2234.                         if (msgWord.toLowerCase().contains(word.toLowerCase())) {
  2235.                             final_msg = "ERROR: 1337 - Banned Message";
  2236.                             return final_msg;
  2237.                         }
  2238.                     } else {
  2239.                         // Removing Exact Word - WORD
  2240.                         if (msgWord.toLowerCase().equalsIgnoreCase(word.toLowerCase()) && !cont) {
  2241.                             if (!replace.equalsIgnoreCase("")) {
  2242.                                 if (final_msg.equalsIgnoreCase("")) {
  2243.                                     final_msg = replace;
  2244.                                 } else {
  2245.                                     final_msg = final_msg + " " + replace;
  2246.                                 }
  2247.                                 cont = true;
  2248.                                 continue;
  2249.                             } else {
  2250.                                 cont = true;
  2251.                                 continue;
  2252.                             }
  2253.                         }
  2254.                     }
  2255.                 }
  2256.                 if (!cont) {
  2257.                     if (final_msg.equalsIgnoreCase("")) {
  2258.                         final_msg = msgWord;
  2259.                     } else {
  2260.                         final_msg = final_msg + " " + msgWord;
  2261.                     }
  2262.                 }
  2263.             }
  2264.             return final_msg;
  2265.         }
  2266.        
  2267.         public boolean serverAntiSwear(int chatID) {
  2268.             if (getCustomChats().getBoolean(chatID + ".anti-swear.server.enabled")) {
  2269.                 return true;
  2270.             } else {
  2271.                 return false;
  2272.             }
  2273.            
  2274.         }
  2275.        
  2276.        
  2277.      // Added the ability to have a custom chats config! - v0.8.2 - 10/3/2016
  2278.     private FileConfiguration customChatsConfig = null; //customConfig
  2279.     private File customChats = null; //customConfigFile
  2280.    
  2281.     public void reloadChats() {
  2282.         if (customChats == null) {
  2283.             customChats = new File(getDataFolder(), "chat.yml");
  2284.         }
  2285.         customChatsConfig = YamlConfiguration.loadConfiguration(customChats);
  2286.         // Look for defaults in the jar
  2287.         Reader defConfigStream;
  2288.         try {
  2289.             defConfigStream = new InputStreamReader(this.getResource("chat.yml"), "UTF8");
  2290.        
  2291.         if (defConfigStream != null) {
  2292.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2293.             customChatsConfig.setDefaults(defConfig);
  2294.         }
  2295.         } catch (UnsupportedEncodingException e) {
  2296.             e.printStackTrace();
  2297.         }
  2298.     }
  2299.    
  2300.     public FileConfiguration getCustomChats() {
  2301.         if (customChatsConfig == null) {
  2302.             reloadChats();
  2303.         }
  2304.         return customChatsConfig;
  2305.     }
  2306.    
  2307.     public void saveCustomConfig() {
  2308.         if (customChatsConfig == null || customChatsConfig == null) {
  2309.             return;
  2310.         }
  2311.         try {
  2312.             getCustomChats().save(customChats);
  2313.         } catch (IOException ex) {
  2314.             getLogger().log(Level.SEVERE, "Could not save config to " + customChats, ex);
  2315.         }
  2316.     }
  2317.    
  2318.     public void saveDefaultConfig() {
  2319.         if (customChats == null) {
  2320.             customChats = new File(getDataFolder(), "chat.yml");
  2321.         }
  2322.         if (!customChats.exists()) {            
  2323.              this.saveResource("chat.yml", false);
  2324.          }
  2325.     }
  2326.    
  2327.     //--- End of chats.yml writing tools
  2328.    
  2329.    
  2330.     // Added the ability to have unlimited custom configs! - v0.8.5 - 2/15/2017
  2331.     private FileConfiguration otherConfig = null; //customConfig
  2332.     private File otherFiles = null; //customConfigFile
  2333.    
  2334.     public void reloadOther(String file) {
  2335.         file = file.replace("\\", File.separator);
  2336.         otherFiles = new File(getDataFolder(), file);
  2337.         otherConfig = YamlConfiguration.loadConfiguration(otherFiles);
  2338.         // Look for defaults in the jar
  2339.         Reader defConfigStream;
  2340.         InputStream is = null;
  2341.         try {
  2342.            
  2343.             try {
  2344.                 is = new FileInputStream(getDataFolder().toString() + file);
  2345.             } catch (FileNotFoundException e) {
  2346.                 e.printStackTrace();
  2347.             }
  2348.             defConfigStream = new InputStreamReader(is, "UTF8");
  2349.        
  2350.         if (defConfigStream != null) {
  2351.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2352.             otherConfig.setDefaults(defConfig);
  2353.         }
  2354.         } catch (UnsupportedEncodingException e) {
  2355.             e.printStackTrace();
  2356.         }
  2357.     }
  2358.    
  2359.     public FileConfiguration getOther(String file) {
  2360.         file = file.replace("\\", File.separator);
  2361.         otherFiles = new File(getDataFolder(), file);
  2362.         otherConfig = YamlConfiguration.loadConfiguration(otherFiles);
  2363.         if (otherConfig == null) {
  2364.             reloadOther(file);
  2365.         }
  2366.         return otherConfig;
  2367.     }
  2368.    
  2369.     public void ssOther(String file, String path, Object value) {
  2370.         file = file.replace("\\", File.separator);
  2371.         getOther(file).set(path, value);
  2372.         if (otherConfig == null || otherFiles == null) {
  2373.             return;
  2374.         }
  2375.         try {
  2376.             otherConfig.save(otherFiles);
  2377.         } catch (IOException ex) {
  2378.             getLogger().log(Level.SEVERE, "Could not save config to " + otherFiles, ex);
  2379.         }
  2380.         reloadOther(file);
  2381.     }
  2382.    
  2383.     public void saveOther(String file) {
  2384.         file = file.replace("\\", File.separator);
  2385.         if (otherConfig == null || otherFiles == null) {
  2386.             return;
  2387.         }
  2388.         try {
  2389.             getOther(file).save(otherFiles);
  2390.         } catch (IOException ex) {
  2391.             getLogger().log(Level.SEVERE, "Could not save config to " + otherFiles, ex);
  2392.         }
  2393.     }
  2394.     public void tcOther(String file, String type) {
  2395.         file = file.replace("\\", File.separator);
  2396.         switch (type) {
  2397.         case "b":
  2398.             if (!getOther(file).contains("blacklist")){
  2399.                 ssOther(file, "blacklist.exampleuuid", null);
  2400.             }
  2401.             break;
  2402.         case "i":
  2403.             if (!getOther(file).contains("ignorelist")){
  2404.                 ssOther(file, "ignorelist.exampleuuid", null);
  2405.             }
  2406.             break;
  2407.         case "d":
  2408.             if (!getOther(file).contains("Dictionary")){
  2409.                 ssOther(file, "Dictionary.exampleword", null);
  2410.             }
  2411.             break;
  2412.         default:
  2413.             break;
  2414.         }
  2415.     }
  2416.     public void saveDefaultOther(String file) {
  2417.        
  2418.         otherFiles = new File(getDataFolder(), file.replace("\\", File.separator));
  2419.         otherConfig = YamlConfiguration.loadConfiguration(otherFiles);
  2420.         if (otherFiles == null) {
  2421.             otherFiles = new File(getDataFolder(), file);
  2422.         }
  2423.         if (file.contains("\\")) {
  2424.             String temp_file = file.replace("\\", "/");
  2425.             int i = 0;
  2426.             String path = "";
  2427.             for (String s : temp_file.split("/")) {
  2428.                 i++;
  2429.                 if (i != 1) {
  2430.                     if (i != temp_file.split("/").length) {
  2431.                         if (path.equalsIgnoreCase("")) { path = File.separator + s; } else { path = path + File.separator + s; }
  2432.                     }  
  2433.                 }
  2434.             }
  2435.             File path_file = new File(getDataFolder() + path);
  2436.             if (!path_file.exists()) {
  2437.                 path_file.mkdirs();
  2438.             }
  2439.         }
  2440.         if (!otherFiles.exists()) {            
  2441.             try {
  2442.                 otherFiles.createNewFile();
  2443.             } catch (IOException e) {
  2444.                 //e.printStackTrace();
  2445.             }
  2446.          }
  2447.     }
  2448.    
  2449.     public void delOther(String file) {
  2450.         file = file.replace("\\", File.separator);
  2451.         otherFiles = new File(getDataFolder(), file);
  2452.         otherConfig = YamlConfiguration.loadConfiguration(otherFiles);
  2453.         otherFiles.delete();
  2454.     }
  2455.    
  2456.     //--- End unlimited custom configs
  2457.    
  2458.     private FileConfiguration oldConfig = null; //customConfig
  2459.     private File oldConfigFile = null; //customConfigFile
  2460.    
  2461.     public void reloadOld() {
  2462.         if (oldConfigFile == null) {
  2463.             oldConfigFile = new File(getDataFolder(), "oldConfig.yml");
  2464.         }
  2465.         oldConfig = YamlConfiguration.loadConfiguration(oldConfigFile);
  2466.         // Look for defaults in the jar
  2467.         Reader defConfigStream;
  2468.         try {
  2469.             defConfigStream = new InputStreamReader(this.getResource("oldConfig.yml"), "UTF8");
  2470.        
  2471.         if (defConfigStream != null) {
  2472.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  2473.             oldConfig.setDefaults(defConfig);
  2474.         }
  2475.         } catch (UnsupportedEncodingException e) {
  2476.             e.printStackTrace();
  2477.         }
  2478.     }
  2479.    
  2480.     public FileConfiguration getOldConfig() {
  2481.         if (oldConfig == null) {
  2482.             reloadOld();
  2483.         }
  2484.         return oldConfig;
  2485.     }
  2486.    
  2487.     public void saveOldConfig() {
  2488.         if (oldConfig == null || oldConfig == null) {
  2489.             return;
  2490.         }
  2491.         try {
  2492.             getOldConfig().save(oldConfigFile);
  2493.         } catch (IOException ex) {
  2494.             getLogger().log(Level.SEVERE, "Could not save config to " + oldConfigFile, ex);
  2495.         }
  2496.     }
  2497.    
  2498. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement