Advertisement
agentsix1

Public - VIP+ Chat v0.8.4 - Source - 1.6.4 - 1.7.5

Dec 22nd, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 65.70 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.IOException;
  7. import java.io.InputStream;
  8. import java.io.InputStreamReader;
  9. import java.io.Reader;
  10. import java.io.UnsupportedEncodingException;
  11. import java.net.MalformedURLException;
  12. import java.net.URL;
  13. import java.net.URLConnection;
  14. import java.util.Arrays;
  15. import java.util.HashMap;
  16. import java.util.List;
  17. import java.util.concurrent.TimeUnit;
  18. import java.util.logging.Level;
  19.  
  20. import org.bukkit.Bukkit;
  21. import org.bukkit.ChatColor;
  22. import org.bukkit.command.Command;
  23. import org.bukkit.command.CommandSender;
  24. import org.bukkit.configuration.file.FileConfiguration;
  25. import org.bukkit.configuration.file.YamlConfiguration;
  26. import org.bukkit.entity.Player;
  27. import org.bukkit.event.EventHandler;
  28. import org.bukkit.event.Listener;
  29. import org.bukkit.event.player.PlayerCommandPreprocessEvent;
  30. import org.bukkit.event.player.PlayerJoinEvent;
  31. import org.bukkit.plugin.java.JavaPlugin;
  32.  
  33. /* List of commands - Added v0.8.2
  34.  
  35.     /vpc checkver - Check the latest version of plugin and what the current release is
  36.     Permission:
  37.     - vippluschat.admin
  38.     - vippluschat.admin.checkversion
  39.    
  40.     /vpc reload - Reload the Chat.yml and Config.yml files
  41.     Permission:
  42.     - vippluschat.admin
  43.     - vippluschat.admin.reload
  44.    
  45.     /vpc {ignore/unignore} {chat} - Set your self to ignore/unignore the specified chat
  46.     Permission:
  47.     - vippluschat.chat.ignore
  48.    
  49.     /vpc ignored {chat} | optional: {show/#/all} - View the list of ignored users with in the chat specified
  50.     Permission:
  51.     - vippluschat.admin
  52.     - vippluschat.admin.ignored
  53.    
  54.     /vpc toggle {chat} - Enable/Disable the chat specified
  55.     Permission:
  56.     - vippluschat.admin
  57.     - vippluschat.admin.toggle
  58.     - vippluschat.toggle.{permission} - The permission is defined in the chat.yml
  59.    
  60.     /vpc blacklist {+/add/del/rem/delete/remove/-/clear} {username} - Add/remove/clear the User{s} to/from the blacklist
  61.     Permission:
  62.     - vippluschat.admin
  63.     - vippluschat.admin.blacklist
  64.    
  65.     /vpc {fui/forceunignore} {chat} {username} - Force the user to uningore the chat specified
  66.     Permission:
  67.     - vippluschat.admin
  68.     - vippluschat.admin.forceunignore
  69.    
  70.     /vpc blacklisted | Optional: {all/#/show} - View the blacklisted users
  71.     Permission:
  72.     - vippluschat.admin
  73.     - vippluschat.admin.blacklisted
  74.    
  75.     /vpc colors {chat} - The command allows you to see what colors are enabled for this command
  76.     Permission:
  77.     - vippluschat.admin
  78.     - vippluschat.admin.viewcolors
  79.    
  80.     /vpc colors toggle {chat} {color-code} - This will allow you to toggle the state of the color code entered
  81.     Permission:
  82.     - vippluschat.admin
  83.     - vippluschat.admin.togglecolors
  84.    
  85.     /{chat} {message} - The chat command is defied with in the chat.yml config. This command allows you to chat in the chats
  86.     Permission:
  87.     - vippluschat.chat.{permission} - The permission is defined in the chat.yml
  88.     - vippluschat.chat.* - Gives you permission to all the chats
  89.     - vippluschat.allowchat - This is required on top of the permission used for the indivual chats.
  90.  
  91.  */
  92.  
  93.  
  94. public class StaffChat extends JavaPlugin implements Listener {
  95.     //---- This is used to easily grab the current version of the program - Added v0.8
  96. public String version = "v0.8.2";
  97. //---- End Version String
  98.     @Override
  99.     public void onEnable(){
  100.         Bukkit.getServer().getPluginManager().registerEvents(this, this);
  101.         checkOldConfgAndPort();
  102.         loadConfiguration();
  103.         loadChats();
  104.     }
  105.     //---- This is used to create the default config.yml and was added in v0.6
  106.     public void loadConfiguration(){
  107.         getConfig().options().copyDefaults(true);
  108.         saveConfig();
  109.    
  110.     }
  111.     //---- End config.yml
  112.     //---- 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
  113.     public void loadChats(){
  114.         getCustomChats().options().copyDefaults(true);
  115.         saveCustomConfig();
  116.     }
  117.     //---- End Chat.yml
  118.     //---- 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
  119.     @EventHandler
  120.     public void onPlayerJoin(PlayerJoinEvent e) {
  121.         Player p = (Player) e.getPlayer();
  122.         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!. PUBLIC SOURCE - 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)");}
  123.     }
  124.     //---- End Do you own me?
  125.     //---- Detect Custom Chat - This was added to allow custom commands with custom chats! - Added v0.8.2
  126.     @EventHandler
  127.     public void detectCustomChat(PlayerCommandPreprocessEvent e) {
  128.         Player p = e.getPlayer();
  129.         if (p.hasPermission("vippluschat.allowchat")) {
  130.             try {
  131.                 String[] cmd = e.getMessage().split(" ");
  132.                 int chatID = detectChatID(cmd[0].replace("/", ""));
  133.                 if (chatID > -1 & p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  134.                         String msg = "";
  135.                         for(int i = 0; i < cmd.length; i++){
  136.                             if (i != 0) {
  137.                                 String fmsg = cmd[i] + " ";
  138.                                 msg = msg + fmsg;
  139.                             }
  140.                         }
  141.                         e.setCancelled(true);
  142.                         sendMessages(msg, p, "vippluschat.chat." + getCustomChats().getString(chatID + ".permission"), chatID + ".layout", chatID);
  143.                 }
  144.             } catch (ArrayIndexOutOfBoundsException catcherror) {
  145.                 int chatID = detectChatID(e.getMessage().replace("/", ""));
  146.                 if (chatID > -1) {
  147.                     if (p.hasPermission("vippluschat.chat." + getCustomChats().getString(chatID + ".permission"))) {
  148.                         e.setCancelled(true);
  149.                     }
  150.                 }
  151.             }
  152.         }
  153.        
  154.     }
  155.     //---- End Detect Custom Chat
  156.     //---- Detect Chat ID - This was added to detect what what chat you are trying to reach - Added v0.8.2
  157.     public int detectChatID(String command) {
  158.         int i = 0;
  159.         do {
  160.             for ( String cmd : getCustomChats().getStringList(i + ".command")) {
  161.                 if (cmd.equalsIgnoreCase(command)) {
  162.                     return i;
  163.                 }
  164.             }
  165.         } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  166.         return -1;
  167.     }
  168.     //---- End Detect Chat ID
  169.     public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
  170.         if(sender instanceof Player) {
  171.             Player p = (Player) sender;
  172.            
  173.             //---- View color status - Added v0.8.2 - /vpc colors {chat}
  174.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2) {
  175.                 if (args[0].equalsIgnoreCase("colors")) {
  176.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.viewcolors")) {
  177.                         int  chatID = detectChatID(args[1]);
  178.                         if (chatID > -1) {
  179.                             pMessage(outputColorCodes(chatID), p);
  180.                         }
  181.                     } else {
  182.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  183.                     }
  184.                 }
  185.             }
  186.             //---- End view color status
  187.            
  188.             //---- Toggle Colors - Added v0.8.2 - /vpc colors toggle {chat} {color-code}
  189.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 4) {
  190.                 if (args[0].equalsIgnoreCase("colors") && args[1].equalsIgnoreCase("toggle")) {
  191.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.togglecolors")) {
  192.                         int  chatID = detectChatID(args[2]);
  193.                         if (chatID > -1) {
  194.                             if (toggleColor(args[3], chatID)) {
  195.                                 pMessage("Chat color has been toggled", p);
  196.                             } else {
  197.                                 pMessage("Chat color has failed to toggle", p);
  198.                             }
  199.                         }  
  200.                     } else {
  201.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  202.                     }
  203.                    
  204.                 }
  205.                
  206.             }
  207.             //---- End Toggle Colors
  208.            
  209.             //---- Add Custom Chats
  210.            
  211.             //---- End Add Custom Chats
  212.            
  213.             //---- Toggle ignore chats - Added v0.8.2
  214.            
  215.             //---- End Toggle ignore chats
  216.            
  217.             //---- Focus Mode
  218.            
  219.             //---- End Focus Mode
  220.            
  221.             //---- Check Version - Added 7/02/16 v0.8 - /vpc checkver
  222.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 1) {
  223.                 if (args[0].equalsIgnoreCase("checkver")) {
  224.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.checkversion")) {
  225.                         if (getConfig().getBoolean("Check Version")) {
  226.                             try {
  227.                                 URL u = new URL("http://pastebin.com/raw/2ik6fXLb");
  228.                                 URLConnection conn = u.openConnection();
  229.                                 BufferedReader in = new BufferedReader(
  230.                                         new InputStreamReader(
  231.                                                 conn.getInputStream()));
  232.                                 StringBuffer buffer = new StringBuffer();
  233.                                 String inputLine;
  234.                                 while ((inputLine = in.readLine()) != null)
  235.                                     buffer.append(inputLine);
  236.                                 in.close();
  237.                                 System.out.println(buffer.toString());
  238.                                 p.sendMessage(ct("&7Your current version is: &9" + version + " &7The last released version is: &9" + buffer.toString()));
  239.                                 return true;
  240.                             } catch (MalformedURLException e) {
  241.                                 e.printStackTrace();
  242.                                 return false;
  243.                             } catch (IOException e) {
  244.                                 e.printStackTrace();
  245.                                 return false;
  246.                             }
  247.                         } else {
  248.                             p.sendMessage(ct("&cYou currently have check version disabled inside of the config."));
  249.                             return true;
  250.                         }
  251.                     } else {
  252.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  253.                     }
  254.                 }
  255.             }
  256.             //---- End Check Version
  257.            
  258.             //---- Reload - Added PRE v0.8 - /vpc reload
  259.             if(cmdLabel.equalsIgnoreCase("vpc") && args[0].equalsIgnoreCase("reload")) {
  260.                 if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.reload")) {
  261.                     this.reloadConfig();
  262.                     this.reloadChats();
  263.                     loadChats();
  264.                     loadConfiguration();
  265.                     pMessage(getConfig().getString("Messages.reload"), p);
  266.                     return true;
  267.                 } else {
  268.                     p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  269.                 }
  270.             }
  271.             //---- End Reload
  272.            
  273.             //---- Chat - Added PRE v0.8 - /{chat} {message}
  274.             /*
  275.             if((cmdLabel.equalsIgnoreCase("staff") || cmdLabel.equalsIgnoreCase("st")) && p.hasPermission("vippluschat.chat.staff")) {
  276.                 String msg = "";    
  277.  
  278.                 for(int i = 0; i < args.length; i++){
  279.                     String arg = args[i] + " ";
  280.                     msg = msg + arg;
  281.                 }
  282.                 if (getConfig().getString("Enabled.Staff") == "true") {
  283.                     sendMessages(msg, p, "vippluschat.chat.staff", "Staff");
  284.                 } else {
  285.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Staff").replace("%PLAYER%", p.getName()), p);
  286.                 }
  287.                 return true;
  288.                
  289.             }
  290.             ---- Removed v0.8.2 - This is the old chat system which is useless now but is here for future notes!*/
  291.             //---- Chat End
  292.            
  293.             //---- Un/Ignore - Added PRE v0.8 - /vpc {ignore/unignore} {chat}
  294.            
  295.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2) {
  296.                 if (args[0].equalsIgnoreCase("ignore") || args[0].equalsIgnoreCase("unignore") ) {
  297.                     if (p.hasPermission("vippluschat.chat.ignore")) {
  298.                         if (detectChatID(args[1]) > -1) {
  299.                             int  chatID = detectChatID(args[1]);
  300.                             if (checkIgnoreChatSpecified(p.getName(), getCustomChats().getString(chatID + ".name"))) {
  301.                             if (getCustomChats().getBoolean(chatID + ".allow-ignore")) {
  302.                             if (args[0].equalsIgnoreCase("ignore")) {
  303.                             boolean b = false;
  304.                             reloadConfig();
  305.                             /* ---- Removed v0.8.2 when new black list system was added
  306.                             for (String a: getConfig().getString("Other.blacklist").split(",")) {
  307.                                 if (a.equalsIgnoreCase(p.getName())) {
  308.                                     pMessage(getConfig().getString("Messages.blacklist"), p);
  309.                                     return false;
  310.                                 }
  311.                             }
  312.                             */
  313.                             for (String a: getCustomChats().getString(chatID + ".ignore-list").split(",")) {
  314.                                 if (a.equalsIgnoreCase(p.getName())) {
  315.                                     b = true;
  316.                             }
  317.                         }
  318.                         if (!b) {
  319.                             if (getCustomChats().getString(chatID + ".ignore-list").equalsIgnoreCase("")) {
  320.                                 getCustomChats().set(chatID + ".ignore-list", p.getName().toLowerCase());
  321.                                 saveCustomConfig();
  322.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  323.                                 return true;
  324.                             } else {
  325.                                 getCustomChats().set(chatID + ".ignore-list", p.getName().toLowerCase() + "," + getConfig().getString(chatID + ".ignore-list".toLowerCase()));
  326.                                 saveCustomConfig();
  327.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  328.                                 return true;
  329.                             }
  330.                         } else {
  331.                             pMessage(ct(getConfig().getString("Messages.ignore-already").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  332.                             return true;
  333.                         }
  334.                         } else {
  335.                             boolean b = false;
  336.                             String c = "";
  337.                             int d = 0;
  338.                             for (String a: getCustomChats().getString(chatID + ".ignore-list").split(",")) {
  339.                                 if (a.equalsIgnoreCase(p.getName())) {
  340.                                     b = true;
  341.                                 } else {
  342.                                     if (d == 0) {
  343.                                         d += 1;
  344.                                         c = a;
  345.                                     } else {
  346.                                         String e = c;
  347.                                         c = e + "," + a;
  348.                                     }
  349.                                 }
  350.                             }
  351.                             if (!b) {
  352.                                 pMessage(ct(getConfig().getString("Messages.ignore-not-found").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  353.                                 return true;
  354.                             } else {
  355.                                 getCustomChats().set(chatID + ".ignore-list", c);
  356.                                 saveCustomConfig();
  357.                                 if (c.length() == 0) {
  358.                                     getCustomChats().set(chatID + ".ignore-list", "");
  359.                                     saveCustomConfig();
  360.                                 }
  361.                                
  362.                                 pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  363.                                 return true;
  364.                             }
  365.                         }
  366.                            
  367.                         } else {
  368.                             pMessage(getConfig().getString("Messages.ignore-disabled").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")),p);
  369.                         }
  370.                             } else {
  371.                                 pMessage("You are blacklisted from ignoring this chat.", p);   
  372.                             }
  373.                         } else {
  374.                             pMessage(ct(getConfig().getString("Messages.ignore-fail").replace("%CHAT_NAME%", getCustomChats().getString(detectChatID(args[1]) + ".name")).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  375.                         }
  376.                     } else {
  377.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  378.                     }
  379.                 }
  380.             }
  381.             //---- Ignore End
  382.            
  383.             //---- Get Ignore List - Added PRE v0.8 - /vpc ignored {chat} : {show/#/all}
  384.             if (cmdLabel.equalsIgnoreCase("vpc") &&  (args.length == 2|| args.length == 3)) {
  385.                 if (args[0].equalsIgnoreCase("ignored")) {
  386.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.ignored")) {
  387.                         if (detectChatID(args[1]) > -1) {
  388.                             int chatID = detectChatID(args[1]);
  389.                             int page = 1;
  390.                             try {
  391.                                 page = Integer.parseInt(args[2]);
  392.                             } catch (NumberFormatException e) {
  393.                                 if (args[2].equalsIgnoreCase("all")) {
  394.                                     String[] ignoredlist = getCustomChats().getString(chatID + ".ignore-list").split(",");
  395.                                     double listLength = ignoredlist.length;
  396.                                     if (getCustomChats().getString(chatID + ".ignore-list").equalsIgnoreCase("")) {listLength = 0;}
  397.                                     pMessage(getConfig().getString("Messages.ignore-list").replace("%LIST%", getCustomChats().getString(chatID + ".ignore-list").replace(",", ", ")).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + ""), p);
  398.                                     return true;
  399.                                 } else if (args[2].equalsIgnoreCase("show")) {
  400.                                     page = 1;
  401.                                 } else {
  402.                                     return false;
  403.                                 }
  404.                            
  405.                             } catch (ArrayIndexOutOfBoundsException d) {
  406.                                
  407.                             }
  408.                             String[] ignorelist = getCustomChats().getString(chatID + ".ignore-list").split(",");
  409.                             String ignored = "";
  410.                             double listLength = ignorelist.length;
  411.                             double length = getConfig().getDouble("Other.ignored-length");
  412.                             double pages = Math.ceil((double)listLength/(double)length);
  413.                             int i = 1;
  414.                             for (String user : ignorelist) {
  415.                                 if (i < (getConfig().getInt("Other.ignored-length") * page)) {
  416.                                     if (i >= getConfig().getInt("Other.ignored-length") * (page - 1)) {
  417.                                         if (ignored.equalsIgnoreCase("")) {
  418.                                             ignored = user;
  419.                                         } else {
  420.                                             if (!user.equalsIgnoreCase("")) {
  421.                                                 ignored = user + ", " + ignored;
  422.                                             }
  423.                                         }
  424.                                     }
  425.                                 } else { break; }
  426.                                
  427.                                
  428.                                 i++;
  429.                             }
  430.                            
  431.                             if (getCustomChats().getString(chatID + ".ignore-list").equalsIgnoreCase("")) {listLength = 0;}
  432.                             ignored = ignored + " &8| &9Pages: " + page + "/" + String.valueOf(pages).replace(".0", "");
  433.                             pMessage(getConfig().getString("Messages.ignore-list").replace("%LIST%", ignored).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + "").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  434.                             return true;
  435.                             /* ---- Removed when custom chats were added in v0.8.2
  436.                             pMessage(getConfig().getString("Messages.ignore-list").replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")).replace("%LIST%", getCustomChats().getString(chatID + ".ignore-list")), p);
  437.                                 return true;
  438.                                 */
  439.                         } else {
  440.                             pMessage(getConfig().getString("Messages.ignore-fail"), p);
  441.                             return true;
  442.                         }
  443.                     } else {
  444.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  445.                     }
  446.                 }
  447.             }
  448.            
  449.             //---- Toggle Chat - Added PRE v0.8 - /vpc toggle {chat} : {true/false}
  450.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2 || args.length == 3) {
  451.                 if(args[0].equalsIgnoreCase("toggle") && detectChatID(args[1]) > -1) {
  452.                     int chatID = detectChatID(args[1]);
  453.                     if (args.length == 2) {
  454.                         if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.toggle") || p.hasPermission("vippluschat.toggle." + getCustomChats().getString(chatID + ".permission"))) {
  455.                           if (getCustomChats().getBoolean(chatID + ".enabled")) {
  456.                               getCustomChats().set(chatID + ".enabled", false);
  457.                               saveCustomConfig();
  458.                               reloadChats();
  459.                             pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_NAME%", getCustomChats().getString(detectChatID(args[1]) + ".name")).replace("%STATE%", "false"), p);
  460.                           } else {
  461.                               getCustomChats().set(chatID + ".enabled", true);
  462.                               saveCustomConfig();
  463.                               reloadChats();
  464.                             pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_NAME%", getCustomChats().getString(detectChatID(args[1]) + ".name")).replace("%STATE%", "true"), p);
  465.                           }
  466.                           return true;
  467.                         } else {
  468.                             p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  469.                             return false;
  470.                         }
  471.                     } else if (args.length == 3 ) {
  472.                         try{
  473.                            
  474.                             if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.toggle") || p.hasPermission("vippluschat.toggle." + getCustomChats().getString(chatID + ".permission"))) {  
  475.                                       boolean st = Boolean.valueOf(args[2]);
  476.                                       getCustomChats().set(chatID + ".enabled", st);
  477.                                       saveCustomConfig();
  478.                                       reloadChats();
  479.                                       pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_NAME%", getCustomChats().getString(detectChatID(args[1]) + ".name")).replace("%STATE%", args[2]), p);
  480.                            
  481.                             } else {
  482.                                 p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  483.                             }
  484.                             } catch (NullPointerException e){
  485.                                 pMessage(getConfig().getString("Messages.error"), p);
  486.                             }
  487.                             return true;
  488.                     }
  489.                    
  490.                 }
  491.             }
  492.             //---- End Toggle Chat
  493.            
  494.             //---- Blacklist Add/Rem/Del - Added 7/2/16 v0.8 - /vpc blacklist {+/add/del/rem/delete/remove/-/clear} {username}
  495.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 3 || args.length == 2)) {
  496.                 String blacklist = "";
  497.                 if (args[0].equalsIgnoreCase("blacklist")) {
  498.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.blacklist")) {
  499.                         if (args[1].equalsIgnoreCase("clear")) {
  500.                             getConfig().set("Other.blacklist", "");
  501.                             saveConfig();
  502.                             if (getConfig().getBoolean("Other.broadcast")) {
  503.                                 Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"));
  504.                                 return true;
  505.                             } else {
  506.                                 pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "Everyone"), p);
  507.                                 return true;
  508.                             }
  509.                         }
  510.                         if (args[1].equalsIgnoreCase("add") || args[1].equalsIgnoreCase("+")) {
  511.                             if (!getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  512.                                 blacklist = getConfig().getString("Other.blacklist");
  513.                             }
  514.                                 if (getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  515.                                     getConfig().set("Other.blacklist", args[2]);
  516.                                     saveConfig();
  517.                                     forceUnIgnore(args[2], -1);
  518.                                 } else {
  519.                                     getConfig().set("Other.blacklist", args[2] + "," + blacklist);
  520.                                     saveConfig();
  521.                                     forceUnIgnore(args[2], -1);
  522.                                 }
  523.                                
  524.                                 //forceUnIgnore(args[2], -1);
  525.                                 if (getConfig().getBoolean("Other.broadcast")) {
  526.                                     Broadcast(getConfig().getString("Messages.blacklisted").replace("%PLAYER%", args[2]));
  527.                                     return true;
  528.                                 } else {
  529.                                     pMessage(getConfig().getString("Messages.blacklisted").replace("%PLAYER%", args[2]), p);
  530.                                     return true;
  531.                                 }
  532.                                    
  533.                         } else if (args[1].equalsIgnoreCase("rem") || args[1].equalsIgnoreCase("del") || args[1].equalsIgnoreCase("delete")|| args[1].equalsIgnoreCase("remove")|| args[1].equalsIgnoreCase("-") ) {
  534.                             if (!getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {
  535.                                 blacklist = getConfig().getString("Other.blacklist");
  536.                             }
  537.                                 getConfig().set("Other.blacklist", blacklist.replace(args[2] + ",", "").replace(args[2], ""));
  538.                             saveConfig();
  539.                             if (getConfig().getBoolean("Other.broadcast")) {
  540.                                 Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", args[2]));
  541.                                 return true;
  542.                             } else {
  543.                                 pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", args[2]), p);
  544.                                 return true;
  545.                             }
  546.                         } else if (args[1].equalsIgnoreCase("clear") & args[2].equalsIgnoreCase("all")) {
  547.                             getConfig().set("Other.blacklist", "");
  548.                             saveConfig();
  549.                             if (getConfig().getBoolean("Other.broadcast")) {
  550.                                 Broadcast(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "all"));
  551.                                 return true;
  552.                             } else {
  553.                                 pMessage(getConfig().getString("Messages.remove-blacklisted").replace("%PLAYER%", "all"), p);
  554.                                 return true;
  555.                             }
  556.                         }
  557.                     } else {
  558.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  559.                     }
  560.                 }
  561.             }      
  562.             //---- End Blacklist Add/Rem/Del - /vpc blacklist {+/add/del/rem/delete/remove/-/clear} {username}
  563.            
  564.             //---- Remove Player Ignore - Added 7/2/16 v0.8 - /vpc {fui/forceunignore} {chat} {username}
  565.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 3) {
  566.                 if (args[0].equalsIgnoreCase("fui") || (args[0].equalsIgnoreCase("forceunignore"))) {
  567.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.forceunignore")) {
  568.                         if (detectChatID(args[1]) > -1) {
  569.                             int chatID = detectChatID(args[1]);
  570.                                     forceUnIgnore(args[2], chatID);                        
  571.                                 pMessage(getConfig().getString("Messages.force-unignore").replace("%PLAYER%", args[2]).replace("%CHAT_NAME%", getCustomChats().getString(chatID + ".name")), p);
  572.                         }
  573.                     } else {
  574.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  575.                     }
  576.                 }
  577.             }
  578.             //---- End Remove Player Ignore
  579.            
  580.             //---- Blacklisted - Added 7/2/16 v0.8 - /vpc blacklisted : {all/#/show}
  581.             if (cmdLabel.equalsIgnoreCase("vpc") && (args.length == 2 || args.length == 1)) {
  582.                 if (args[0].equalsIgnoreCase("blacklisted")) {
  583.                     if (p.hasPermission("vippluschat.admin") || p.hasPermission("vippluschat.admin.blacklisted")) {
  584.                         int page = 1;
  585.                         try {
  586.                             page = Integer.parseInt(args[1]);
  587.                         } catch (NumberFormatException e) {
  588.                             if (args[1].equalsIgnoreCase("all")) {
  589.                                 String[] blacklist = getConfig().getString("Other.blacklist").split(",");
  590.                                 double listLength = blacklist.length;
  591.                                 if (getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {listLength = 0;}
  592.                                 pMessage(getConfig().getString("Messages.blacklisted-list").replace("%LIST%", getConfig().getString("Other.blacklist").replace(",", ", ")).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + ""), p);
  593.                                 return true;
  594.                             } else if (args[1].equalsIgnoreCase("show")) {
  595.                                 page = 1;
  596.                             } else {
  597.                                 return false;
  598.                             }
  599.                                
  600.                         } catch (ArrayIndexOutOfBoundsException d) {
  601.                            
  602.                         }
  603.                         String[] blacklist = getConfig().getString("Other.blacklist").split(",");
  604.                         String blacklisted = "";
  605.                         double listLength = blacklist.length;
  606.                         double length = getConfig().getDouble("Other.blacklisted-length");
  607.                         double pages = Math.ceil((double)listLength/(double)length);
  608.                         int i = 1;
  609.                         for (String user : blacklist) {
  610.                             if (i < (getConfig().getInt("Other.blacklisted-length") * page)) {
  611.                                 if (i >= getConfig().getInt("Other.blacklisted-length") * (page - 1)) {
  612.                                     if (blacklisted.equalsIgnoreCase("")) {
  613.                                         blacklisted = user;
  614.                                     } else {
  615.                                         if (!user.equalsIgnoreCase("")) {
  616.                                             blacklisted = user + ", " + blacklisted;
  617.                                         }
  618.                                     }
  619.                                 }
  620.                             } else { break; }
  621.                            
  622.                            
  623.                             i++;
  624.                         }
  625.                         if (getConfig().getString("Other.blacklist").equalsIgnoreCase("")) {listLength = 0;}
  626.                         blacklisted = blacklisted + " &8| &9Pages: " + page + "/" + String.valueOf(pages).replace(".0", "");
  627.                         pMessage(getConfig().getString("Messages.blacklisted-list").replace("%LIST%", blacklisted).replace("%COUNT%", String.valueOf(listLength).replace(".0", "") + ""), p);
  628.                         return true;
  629.                     } else {
  630.                         p.sendMessage(ct(getConfig().getString("Messages.no-permissions")));
  631.                     }
  632.                 }
  633.             }
  634.             //---- End Blacklisted
  635.            
  636.            
  637.         }
  638.         return false;
  639.     }
  640.    
  641.     //---- Toggle Color Codes - v0.8.2
  642.    
  643.     public boolean toggleColor(String code, int chatID) {
  644.         String[] color_codes = getCustomChats().getString(chatID + ".color-codes").split(" ");
  645.         for (String color : color_codes) {
  646.             if (color.equalsIgnoreCase(code + ":true")) {
  647.                 String theColors = "";
  648.                 for (String newColors : color_codes) {
  649.                     if (newColors.equalsIgnoreCase(code + ":true")) {
  650.                         if (theColors.equalsIgnoreCase("")) {
  651.                             theColors = newColors.replace("true", "false");
  652.                         } else {
  653.                             theColors = theColors + " " + newColors.replace("true", "false");
  654.                         }
  655.                     } else {
  656.                         if (theColors.equalsIgnoreCase("")) {
  657.                             theColors = newColors;
  658.                         } else {
  659.                             theColors = theColors + " " + newColors;
  660.                         }
  661.                     }
  662.                 }
  663.                 getCustomChats().set(chatID + ".color-codes", theColors);
  664.                 saveCustomConfig();
  665.                 reloadChats();
  666.                 return true;
  667.             } else if (color.equalsIgnoreCase(code + ":false")) {
  668.                 String theColors = "";
  669.                 for (String newColors : color_codes) {
  670.                     if (newColors.equalsIgnoreCase(code + ":false")) {
  671.                         if (theColors.equalsIgnoreCase("")) {
  672.                             theColors = newColors.replace("false", "true");
  673.                         } else {
  674.                             theColors = theColors + " " + newColors.replace("false", "true");
  675.                         }
  676.                     } else {
  677.                         if (theColors.equalsIgnoreCase("")) {
  678.                             theColors = newColors;
  679.                         } else {
  680.                             theColors = theColors + " " + newColors;
  681.                         }
  682.                     }
  683.                 }
  684.                 getCustomChats().set(chatID + ".color-codes", theColors);
  685.                 saveCustomConfig();
  686.                 reloadChats();
  687.                 return true;
  688.             }
  689.         }
  690.         return false;          
  691.     }
  692.    
  693.     //---- End Toggle Color Codes
  694.    
  695.     //---- Used to detect old configs and port them over to the new system - v0.8.2
  696.    
  697.     public void checkOldConfgAndPort() {
  698.         try {
  699.            
  700.             String a = getConfig().getString("Check Version");
  701.             String b = getConfig().getString("Tag.mod.allow-ignore");
  702.             if (b.equalsIgnoreCase("null")) {
  703.                 return;
  704.             }
  705.             File file = new File(getDataFolder(), "config.yml");
  706.             File file2 = new File(getDataFolder(), "oldConfig.yml");
  707.             file.renameTo(file2);
  708.             saveDefaultConfig();
  709.             reloadConfig();
  710.             reloadOld();
  711.             getConfig().set("Check Version", getOldConfig().getBoolean("Check Version"));
  712.             saveConfig();
  713.             getConfig().set("Other.blacklist",getOldConfig().getString("Other.ignore-blacklist").replaceAll("none", ""));
  714.             saveConfig();
  715.             getConfig().set("Messages.no-permission", getOldConfig().getString("Messages.no-permission"));
  716.             saveConfig();
  717.             getConfig().set("Messages.chat-disabled", getOldConfig().getString("Messages.chat-disabled"));
  718.             saveConfig();
  719.             getConfig().set("Messages.reload", getOldConfig().getString("Messages.reload"));
  720.             saveConfig();
  721.             getConfig().set("Messages.toggle" ,getOldConfig().getString("Messages.toggle"));
  722.             saveConfig();
  723.             getConfig().set("Messages.error", getOldConfig().getString("Messages.error"));
  724.             saveConfig();
  725.             getConfig().set("Messages.ignore", getOldConfig().getString("Messages.ignore"));
  726.             saveConfig();
  727.             getConfig().set("Messages.ignore-fail", getOldConfig().getString("Messages.ignore-fail"));
  728.             saveConfig();
  729.             getConfig().set("Messages.ignore-already", getOldConfig().getString("Messages.ignore-already"));
  730.             saveConfig();
  731.             getConfig().set("Messages.ignore-not-found", getOldConfig().getString("Messages.ignore-not-found"));
  732.             saveConfig();
  733.             getConfig().set("Messages.ignore-disabled", getOldConfig().getString("Messages.ignore-disabled"));
  734.             saveConfig();
  735.             getConfig().set("Messages.force-unignore", getOldConfig().getString("Messages.force-unignore").replace("%CHAT%", "%CHAT_NAME%"));
  736.             saveConfig();
  737.             getConfig().set("Messages.remove-blacklisted",getOldConfig().getString("Messages.remove-blacklisted"));
  738.             saveConfig();
  739.             getCustomChats().set("0.allow-ignore", getOldConfig().getBoolean("Tag.mod.allow-ignore"));
  740.             saveCustomConfig();
  741.             getCustomChats().set("0.layout" , getOldConfig().getString("Tag.mod.layout"));
  742.             saveCustomConfig();
  743.             getCustomChats().set("0.enabled" , getOldConfig().getBoolean("Enabled.Mod"));
  744.             saveCustomConfig();
  745.             getCustomChats().set("0.ignore-list" , getOldConfig().getString("Other.ignore.mod").replaceAll("none", ""));
  746.             saveCustomConfig();
  747.             getCustomChats().set("1.allow-ignore" , getOldConfig().getBoolean("Tag.admin.allow-ignore"));
  748.             saveCustomConfig();
  749.             getCustomChats().set("1.layout" , getOldConfig().getString("Tag.admin.layout"));
  750.             saveCustomConfig();
  751.             getCustomChats().set("1.enabled" , getOldConfig().getBoolean("Enabled.Admin"));
  752.             saveCustomConfig();
  753.             getCustomChats().set("1.ignore-list" , getOldConfig().getString("Other.ignore.admin").replaceAll("none", ""));
  754.             saveCustomConfig();
  755.             getCustomChats().set("2.allow-ignore" , getOldConfig().getBoolean("Tag.owner.allow-ignore"));
  756.             saveCustomConfig();
  757.             getCustomChats().set("2.layout" , getOldConfig().getString("Tag.owner.layout"));
  758.             saveCustomConfig();
  759.             getCustomChats().set("2.enabled" , getOldConfig().getBoolean("Enabled.Owner"));
  760.             saveCustomConfig();
  761.             getCustomChats().set("2.ignore-list" , getOldConfig().getString("Other.ignore.owner").replaceAll("none", ""));
  762.             saveCustomConfig();
  763.             getCustomChats().set("3.allow-ignore" , getOldConfig().getBoolean("Tag.staff.allow-ignore"));
  764.             saveCustomConfig();
  765.             getCustomChats().set("3.layout" , getOldConfig().getString("Tag.staff.layout"));
  766.             saveCustomConfig();
  767.             getCustomChats().set("3.enabled" , getOldConfig().getBoolean("Enabled.Staff"));
  768.             saveCustomConfig();
  769.             getCustomChats().set("3.ignore-list" , getOldConfig().getString("Other.ignore.staff").replaceAll("none", ""));
  770.             saveCustomConfig();
  771.             getCustomChats().set("4.allow-ignore" , getOldConfig().getBoolean("Tag.dev.allow-ignore"));
  772.             saveCustomConfig();
  773.             getCustomChats().set("4.layout" , getOldConfig().getString("Tag.dev.layout"));
  774.             saveCustomConfig();
  775.             getCustomChats().set("4.enabled" , getOldConfig().getBoolean("Enabled.Dev"));
  776.             saveCustomConfig();
  777.             getCustomChats().set("4.ignore-list" , getOldConfig().getString("Other.ignore.dev").replaceAll("none", ""));
  778.             saveCustomConfig();
  779.             getCustomChats().set("5.allow-ignore" , getOldConfig().getBoolean("Tag.vip.allow-ignore"));
  780.             saveCustomConfig();
  781.             getCustomChats().set("5.layout" , getOldConfig().getString("Tag.vip.layout"));
  782.             saveCustomConfig();
  783.             getCustomChats().set("5.enabled" , getOldConfig().getBoolean("Enabled.VIP"));
  784.             saveCustomConfig();
  785.             getCustomChats().set("5.ignore-list" , getOldConfig().getString("Other.ignore.vip").replaceAll("none", ""));
  786.             saveCustomConfig();
  787.             getCustomChats().set("6.allow-ignore" , getOldConfig().getBoolean("Tag.donator.allow-ignore"));
  788.             saveCustomConfig();
  789.             getCustomChats().set("6.layout" , getOldConfig().getString("Tag.donator.layout"));
  790.             saveCustomConfig();
  791.             getCustomChats().set("6.enabled" , getOldConfig().getBoolean("Enabled.Donator"));
  792.             saveCustomConfig();
  793.             getCustomChats().set("6.ignore-list" , getOldConfig().getString("Other.ignore.donator").replaceAll("none", ""));
  794.             saveCustomConfig();
  795.             getCustomChats().set("7.allow-ignore" , getOldConfig().getBoolean("Tag.special.allow-ignore"));
  796.             saveCustomConfig();
  797.             getCustomChats().set("7.layout" , getOldConfig().getString("Tag.special.layout"));
  798.             saveCustomConfig();
  799.             getCustomChats().set("7.enabled" , getOldConfig().getBoolean("Enabled.Special"));
  800.             saveCustomConfig();
  801.             getCustomChats().set("7.ignore-list" , getOldConfig().getString("Other.ignore.special").replaceAll("none", ""));
  802.             saveCustomConfig();
  803.             getCustomChats().set("8.allow-ignore" , getOldConfig().getBoolean("Tag.elite.allow-ignore"));
  804.             saveCustomConfig();
  805.             getCustomChats().set("8.layout" , getOldConfig().getString("Tag.elite.layout"));
  806.             saveCustomConfig();
  807.             getCustomChats().set("8.enabled" , getOldConfig().getBoolean("Enabled.Elite"));
  808.             saveCustomConfig();
  809.             getCustomChats().set("8.ignore-list" , getOldConfig().getString("Other.ignore.elite").replaceAll("none", ""));
  810.             saveCustomConfig();
  811.             File file3 = new File(getDataFolder(), "oldConfig.yml");
  812.             File file4 = new File(getDataFolder(), "oldConfig.yml.bak");
  813.             file3.renameTo(file4);
  814.         } catch (NullPointerException failed) {
  815.            
  816.         }
  817.     }
  818.    
  819.     //---- End Detect Old Config
  820.    
  821.     //---- Check and port configs to new config system! - v0.8.2
  822.    
  823.     public void portConfig() {
  824.     }
  825.    
  826.     //---- End Check and port configs to new config system!
  827.    
  828.     //---- Check black list to see if the player is on the blacklist - v0.8.2
  829.    
  830.     public boolean checkBlacklist(String player) {
  831.         List<String> blacklisted = Arrays.asList(getConfig().getString("Other.blacklist").split(","));
  832.         for (String p : blacklisted) {
  833.             if (p.toLowerCase().equalsIgnoreCase(player.toLowerCase())) {
  834.                 return true;
  835.             }
  836.         }
  837.         return false;
  838.     }
  839.    
  840.     //---- End blacklist check player
  841.        
  842.     //---- Check blacklist options to see if they can view chat - v0.8.2
  843.    
  844.     public boolean checkView(String player) {
  845.         if (checkBlacklist(player) & getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")) {
  846.             return true;
  847.         } else if (checkBlacklist(player) & !getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")){
  848.             return false;
  849.         }
  850.         return false;
  851.     }
  852.    
  853.     //---- End blacklist check options view chat
  854.            
  855.     //---- Check blacklist options to see if they can view chat is specified - v0.8.2
  856.    
  857.     public boolean checkViewChatSpecified(String player, String chat) {
  858.         if (checkBlacklist(player)) {
  859.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-view-chats.enabled")) {
  860.                 return true;
  861.             }
  862.             if (checkView(player)) {
  863.                 for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-view-chats.specified-chats")) {
  864.                     if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  865.                 }
  866.                 return false;
  867.             }
  868.         }
  869.        
  870.         return true;
  871.     }
  872.            
  873.     //---- End blacklist check options view chat if chat is specified
  874.        
  875.     //---- Check blacklist options to see if they can talk chat - v0.8.2
  876.  
  877.     public boolean checkTalk(String player) {
  878.         if (checkBlacklist(player) & getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")) {
  879.             return true;
  880.         } else if (checkBlacklist(player) & !getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")){
  881.             return false;
  882.         }
  883.         return false;
  884.     }
  885.    
  886.     //---- End blacklist check options talk chat
  887.  
  888.     //---- Check blacklist options to see if they can talk chat is specified - v0.8.2
  889.    
  890.     public boolean checkTalkChatSpecified(String player, String chat) {
  891.         if (checkBlacklist(player)) {
  892.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-talk-in-chats.enabled")) {
  893.                 return true;
  894.             }
  895.             if (checkTalk(player)) {
  896.                 for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-talk-in-chats.specified-chats")) {
  897.                     if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  898.                 }
  899.                 return false;
  900.             }
  901.         }
  902.        
  903.         return true;
  904.     }
  905.            
  906.     //---- End blacklist check options talk chat if chat is specified
  907.    
  908.     //---- Check ignore options to see if they can ignore chat - v0.8.2
  909.    
  910.     public boolean checkIgnore(String player) {
  911.         if (checkBlacklist(player.toLowerCase()) & getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")) {
  912.             return true;
  913.         } else if (checkBlacklist(player.toLowerCase()) & !getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")){
  914.             return false;
  915.         }
  916.         return false;
  917.     }
  918.    
  919.     //---- End ignore check options ignore chat
  920.        
  921.     //---- Check ignore options to see if they can ignore chat is specified - v0.8.2
  922.  
  923.     public boolean checkIgnoreChatSpecified(String player, String chat) {
  924.         if (checkBlacklist(player.toLowerCase())) {
  925.             if (!getConfig().getBoolean("Other.Blacklist-Settings.can-ignore-chats.enabled")) {
  926.                 return true;
  927.             }
  928.             if (checkIgnore(player.toLowerCase())) {
  929.                 for (String c : getConfig().getStringList("Other.Blacklist-Settings.can-ignore-chats.specified-chats")) {
  930.                     if (c.toLowerCase().equalsIgnoreCase(chat.toLowerCase())) { return true; }
  931.                 }
  932.                 return false;
  933.             }
  934.         }
  935.        
  936.         return true;
  937.     }
  938.    
  939.     //---- End ignore check options ignore chat if chat is specified
  940.    
  941.     //---- This is called when force unignoring chats. This was modified to accept custom chats in v0.8.2 - Created in v0.8
  942.     private void forceUnIgnore(String player, int id) {
  943.         if (id == -1) {
  944.             int i = 0;
  945.             if (player.equalsIgnoreCase("*")) {
  946.                 do {
  947.                     getCustomChats().set(i + ".ignore-list", "");
  948.                     saveCustomConfig();
  949.                 } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  950.                
  951.             } else {
  952.                 do {
  953.                     getCustomChats().set(i + ".ignore-list", getCustomChats().getString(i + ".ignore-list").toLowerCase().replace(player.toLowerCase() + ",", "").replace(player.toLowerCase(), ""));
  954.                     saveCustomConfig();
  955.                 } while (i++ < getCustomChats().getInt("Chat Count") - 1);
  956.             }
  957.             return;
  958.         }
  959.         if (player.equalsIgnoreCase("*")) {
  960.             getCustomChats().set(id + ".ignore-list", "");
  961.             saveCustomConfig();
  962.         } else {
  963.             if (getCustomChats().getString(id + ".ignore-list").equalsIgnoreCase("")){
  964.                
  965.             } else {
  966.                 getCustomChats().set(id + ".ignore-list", getCustomChats().getString(id + ".ignore-list").toLowerCase().replace(player.toLowerCase() + ",", "").replace(player.toLowerCase(), ""));
  967.                 saveCustomConfig();
  968.                 if (getCustomChats().getString(id + ".ignore-list").equalsIgnoreCase("null")) {
  969.                     getCustomChats().set(id + ".ignore-list", "");
  970.                     saveCustomConfig();
  971.                 }
  972.             }
  973.         }
  974.        
  975.         /* - Removed v0.8.2 - Removed with when custom chats were added
  976.         switch (chat.toLowerCase()) {
  977.         case "mod":
  978.             getConfig().set("Other.ignore.mod", getConfig().getString("Other.ignore.mod").replace(a.getName() + ",", "").replace(a.getName(), ""));
  979.             saveConfig();
  980.             break;
  981.         case "all":
  982.             getConfig().set("Other.ignore.elite", getConfig().getString("Other.ignore.elite").replace(a.getName() + ",", "").replace(a.getName(), ""));
  983.             saveConfig();
  984.             getConfig().set("Other.ignore.special", getConfig().getString("Other.ignore.special").replace(a.getName() + ",", "").replace(a.getName(), ""));
  985.             saveConfig();
  986.             getConfig().set("Other.ignore.donator", getConfig().getString("Other.ignore.donator").replace(a.getName() + ",", "").replace(a.getName(), ""));
  987.             saveConfig();
  988.             getConfig().set("Other.ignore.vip", getConfig().getString("Other.ignore.vip").replace(a.getName() + ",", "").replace(a.getName(), ""));
  989.             saveConfig();
  990.             getConfig().set("Other.ignore.dev", getConfig().getString("Other.ignore.dev").replace(a.getName() + ",", "").replace(a.getName(), ""));
  991.             saveConfig();
  992.             getConfig().set("Other.ignore.staff", getConfig().getString("Other.ignore.staff").replace(a.getName() + ",", "").replace(a.getName(), ""));
  993.             saveConfig();
  994.             getConfig().set("Other.ignore.owner", getConfig().getString("Other.ignore.owner").replace(a.getName() + ",", "").replace(a.getName(), ""));
  995.             saveConfig();
  996.             getConfig().set("Other.ignore.admin", getConfig().getString("Other.ignore.admin").replace(a.getName() + ",", "").replace(a.getName(), ""));
  997.             saveConfig();
  998.             getConfig().set("Other.ignore.mod", getConfig().getString("Other.ignore.mod").replace(a.getName() + ",", "").replace(a.getName(), ""));
  999.             saveConfig();
  1000.             break;
  1001.            
  1002.         }*/
  1003.     }
  1004.     //---- End forceunignore
  1005.     //---- Used to color not message chats - Added v0.7
  1006.     public static String ct(String text) {
  1007.         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 + "");
  1008.     }
  1009.     //---- End of color
  1010.     //---- Used to broadcast message - Added v0.7
  1011.     public static void Broadcast(String msg) {
  1012.         String tag = ct("&8[&9VPC&8] &2");
  1013.         Bukkit.getServer().broadcastMessage(tag + ct(msg));
  1014.     }
  1015.     //---- End of broad cast
  1016.     //---- Used to detect what colors are enabled for what chats. This was modified in v0.8.2 to accept custom chats
  1017.     public Boolean checkColorCodes(String code, int id) {
  1018.         System.out.println(code + " - End of list");
  1019.         for (String precolors: Arrays.asList(getCustomChats().getString(id + ".color-codes").split(" "))) {
  1020.             List<String> temp = Arrays.asList(precolors.split(":"));
  1021.             String colors = temp.get(0);
  1022.             Boolean colorsState = Boolean.parseBoolean(temp.get(1));
  1023.             if (colors.equalsIgnoreCase(code) && colorsState) {
  1024.                 return true;
  1025.             }
  1026.         }
  1027.         return false;
  1028.     }
  1029.     //---- End of color checking
  1030.     //---- Ingore Check
  1031.     public Boolean checkIgnore(String user, int id) {
  1032.         boolean b = false;
  1033.        
  1034.         for (String a: getCustomChats().getString(id + ".ignore-list").toLowerCase().split(",")) {
  1035.             if (a.equalsIgnoreCase(user)) {
  1036.                 b = true;
  1037.             }
  1038.         }
  1039.         if (b) {
  1040.             return true;
  1041.         }
  1042.         return false;
  1043.     }
  1044.     //---- Ignore Check End
  1045.    
  1046.     //---- Output Color Codes - Added v0.8.2
  1047.     public String outputColorCodes(int chatID) {
  1048.         String text = getCustomChats().getString(chatID + ".name") + " Current Color Code Status\n";
  1049.         int i = 0;
  1050.         for (String precolors: Arrays.asList(getCustomChats().getString(chatID + ".color-codes").split(" "))) {
  1051.             List<String> temp = Arrays.asList(precolors.split(":"));
  1052.             String colors = temp.get(0);
  1053.             Boolean colorsState = Boolean.parseBoolean(temp.get(1));
  1054.             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");}
  1055.             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");}
  1056.             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");}
  1057.             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");}
  1058.             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");}
  1059.             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");}
  1060.             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");}
  1061.             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");}
  1062.             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");}
  1063.             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");}
  1064.             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");}
  1065.             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");}
  1066.             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");}
  1067.             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");}
  1068.             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");}
  1069.             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");}
  1070.             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");}
  1071.             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");}
  1072.             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");}
  1073.             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");}
  1074.             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");}
  1075.             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");}
  1076.             i++;
  1077.         }
  1078.         return ct(text);
  1079.     }
  1080.     //---- End Output Color Codes
  1081.        
  1082.     //---- Used to send messages - Modified in v0.8.2 to accept custom chats
  1083.     public String chatCleaner(String text , int id) {
  1084.         if (text.contains("&0") && checkColorCodes("black", id) == true) { text = text.replace("&0", ChatColor.BLACK + ""); } else { text = text.replace("&0", "");}
  1085.         if (text.contains("&1") && checkColorCodes("dark_blue", id) == true) { text = text.replace("&1", ChatColor.DARK_BLUE + ""); } else { text = text.replace("&1", "");}
  1086.         if (text.contains("&2") && checkColorCodes("dark_green", id) == true) { text = text.replace("&2", ChatColor.DARK_GREEN + ""); } else { text = text.replace("&2", "");}
  1087.         if (text.contains("&3") && checkColorCodes("dark_aqua", id) == true) { text = text.replace("&3", ChatColor.DARK_AQUA + ""); } else { text = text.replace("&3", "");}
  1088.         if (text.contains("&4") && checkColorCodes("dark_red", id) == true) { text = text.replace("&4", ChatColor.DARK_RED + ""); } else { text = text.replace("&4", "");}
  1089.         if (text.contains("&5") && checkColorCodes("dark_purple", id) == true) { text = text.replace("&5", ChatColor.DARK_PURPLE + ""); } else { text = text.replace("&5", "");}
  1090.         if (text.contains("&6") && checkColorCodes("gold", id) == true) { text = text.replace("&6", ChatColor.GOLD + ""); } else { text = text.replace("&6", "");}
  1091.         if (text.contains("&7") && checkColorCodes("gray", id) == true) { text = text.replace("&7", ChatColor.GRAY + ""); } else { text = text.replace("&7", "");}
  1092.         if (text.contains("&8") && checkColorCodes("dark_gray", id) == true) { text = text.replace("&8", ChatColor.DARK_GRAY + ""); } else { text = text.replace("&8", "");}
  1093.         if (text.contains("&9") && checkColorCodes("blue", id) == true) { text = text.replace("&9", ChatColor.BLUE + ""); } else { text = text.replace("&9", "");}
  1094.         if (text.contains("&a") && checkColorCodes("green", id) == true) { text = text.replace("&a", ChatColor.GREEN + ""); } else { text = text.replace("&a", "");}
  1095.         if (text.contains("&b") && checkColorCodes("aqua", id) == true) { text = text.replace("&b", ChatColor.AQUA + ""); } else { text = text.replace("&b", "");}
  1096.         if (text.contains("&c") && checkColorCodes("red", id) == true) { text = text.replace("&c", ChatColor.RED + ""); } else { text = text.replace("&c", "");}
  1097.         if (text.contains("&d") && checkColorCodes("light_purple", id) == true) { text = text.replace("&d", ChatColor.LIGHT_PURPLE + ""); } else { text = text.replace("&d", "");}
  1098.         if (text.contains("&e") && checkColorCodes("yellow", id) == true) { text = text.replace("&e", ChatColor.YELLOW + ""); } else { text = text.replace("&e", "");}
  1099.         if (text.contains("&f") && checkColorCodes("white", id) == true) { text = text.replace("&f", ChatColor.WHITE + ""); } else { text = text.replace("&f", "");}
  1100.         if (text.contains("&k") && checkColorCodes("obfuscated", id) == true) { text = text.replace("&k", ChatColor.MAGIC + ""); } else { text = text.replace("&k", "");}
  1101.         if (text.contains("&l") && checkColorCodes("bold", id) == true) { text = text.replace("&l", ChatColor.BOLD + ""); } else { text = text.replace("&l", "");}
  1102.         if (text.contains("&m") && checkColorCodes("strikethrough", id) == true) { text = text.replace("&m", ChatColor.STRIKETHROUGH + ""); } else { text = text.replace("&m", "");}
  1103.         if (text.contains("&n") && checkColorCodes("underline", id) == true) { text = text.replace("&n", ChatColor.UNDERLINE + ""); } else { text = text.replace("&n", "");}
  1104.         if (text.contains("&o") && checkColorCodes("italic", id) == true) { text = text.replace("&o", ChatColor.ITALIC + ""); } else { text = text.replace("&o", "");}
  1105.         if (text.contains("&r") && checkColorCodes("reset", id) == true) { text = text.replace("&r", ChatColor.RESET + ""); } else { text = text.replace("&r", "");}
  1106.        
  1107.         return text;
  1108.     }
  1109.     public void pMessage(String msg, Player p) {
  1110.         p.sendMessage(ct("&8[&9VPC&8] &2" + msg));
  1111.     }
  1112.     public String pSend(String msg, Player p1, Player p2, String layout, int id) {
  1113.         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());
  1114.         /* - Removed v0.8.2 - Removed wheen we added the custom chats - 10/3/16
  1115.         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()); }
  1116.         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()); }
  1117.         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()); }
  1118.         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()); }
  1119.         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()); }
  1120.         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()); }
  1121.         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()); }
  1122.         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()); }
  1123.         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()); }
  1124.         */
  1125.         System.out.println(tag);
  1126.         p1.sendMessage(tag);
  1127.         return "";
  1128.     }
  1129.    
  1130.     @SuppressWarnings("deprecation")
  1131.     public void sendMessages(String msg, Player player, String permissin, String layout, int id) {
  1132.         if(player.hasPermission(permissin) && !checkIgnore(player.getName(), id)) {
  1133.             if (checkTalkChatSpecified(player.getName(), getCustomChats().getString(id + ".name").toLowerCase())) {
  1134.                 if (getCustomChats().getBoolean(id  + ".enabled")) {
  1135.                     for(Player p : Bukkit.getOnlinePlayers()) {
  1136.                         if(p.hasPermission(permissin) && !checkIgnore(p.getName(), id) && checkViewChatSpecified(p.getName().toLowerCase(), getCustomChats().getString(id + ".name").toLowerCase())) {
  1137.                             pSend(msg, p, player, layout, id); 
  1138.                         }
  1139.                     }
  1140.                 } else {
  1141.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", getCustomChats().getString(id + ".name")).replace("%PLAYER%", player.getName()).replace("%DISPLAY_PLAYER%", player.getDisplayName().replace("%STATE%", "Disabled")).replace("%STATUS%", "").replace("%LIST%", "").replace("%STATUS%", ""), player);            
  1142.                 }
  1143.             } else {
  1144.                 pMessage("You are currently blacklisted from this chat and may not chat in this chat.", player);
  1145.             }
  1146.         } else {
  1147.             pMessage("You are currently ignoring this chat.", player);
  1148.         }
  1149.     }
  1150.    
  1151.     //---- End of sending messages
  1152.    
  1153.  // Added the ability to have a custom chats config! - v0.8.2 - 10/3/2016
  1154.     private FileConfiguration customChatsConfig = null; //customConfig
  1155.     private File customChats = null; //customConfigFile
  1156.    
  1157.    
  1158.     public void reloadChats() {
  1159.         if (customChats == null) {
  1160.             customChats = new File(getDataFolder(), "chat.yml");
  1161.             }
  1162.         customChatsConfig = YamlConfiguration.loadConfiguration(customChats);
  1163.              
  1164.             InputStream defConfigStream = getResource("chat.yml");
  1165.             if (defConfigStream != null) {
  1166.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  1167.             customChatsConfig.setDefaults(defConfig);
  1168.             }
  1169.     }
  1170.    
  1171.     public FileConfiguration getCustomChats() {
  1172.         if (customChatsConfig == null) {
  1173.             reloadChats();
  1174.         }
  1175.         return customChatsConfig;
  1176.     }
  1177.    
  1178.     public void saveCustomConfig() {
  1179.         if (customChatsConfig == null || customChatsConfig == null) {
  1180.             return;
  1181.         }
  1182.         try {
  1183.             getCustomChats().save(customChats);
  1184.         } catch (IOException ex) {
  1185.             getLogger().log(Level.SEVERE, "Could not save config to " + customChats, ex);
  1186.         }
  1187.     }
  1188.    
  1189.     public void saveDefaultConfig() {
  1190.         if (customChats == null) {
  1191.             customChats = new File(getDataFolder(), "chat.yml");
  1192.         }
  1193.         if (!customChats.exists()) {            
  1194.              this.saveResource("chat.yml", false);
  1195.          }
  1196.     }
  1197.    
  1198.     //--- End of chats.yml writing tools
  1199.    
  1200.     private FileConfiguration oldConfig = null; //customConfig
  1201.     private File oldConfigFile = null; //customConfigFile
  1202.    
  1203.    
  1204.     public void reloadOld() {
  1205.         if (oldConfigFile == null) {
  1206.             oldConfigFile = new File(getDataFolder(), "oldConfig.yml");
  1207.             }
  1208.         oldConfig = YamlConfiguration.loadConfiguration(oldConfigFile);
  1209.              
  1210.             InputStream defConfigStream = getResource("oldConfig.yml");
  1211.             if (defConfigStream != null) {
  1212.             YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  1213.             oldConfig.setDefaults(defConfig);
  1214.             }
  1215.     }
  1216.    
  1217.     public FileConfiguration getOldConfig() {
  1218.         if (oldConfig == null) {
  1219.             reloadOld();
  1220.         }
  1221.         return oldConfig;
  1222.     }
  1223.    
  1224.     public void saveOldConfig() {
  1225.         if (oldConfig == null || oldConfig == null) {
  1226.             return;
  1227.         }
  1228.         try {
  1229.             getOldConfig().save(oldConfigFile);
  1230.         } catch (IOException ex) {
  1231.             getLogger().log(Level.SEVERE, "Could not save config to " + oldConfigFile, ex);
  1232.         }
  1233.     }
  1234.    
  1235. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement