Advertisement
agentsix1

Other Project

May 10th, 2016
36,628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 20.91 KB | None | 0 0
  1. package me.kronix.staffchat;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.ChatColor;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. public class StaffChat extends JavaPlugin{
  11.     @Override
  12.     public void onEnable(){
  13.         loadConfiguration();
  14.     }
  15.    
  16.     public void loadConfiguration(){
  17.         getConfig().options().copyDefaults(true);
  18.  
  19.         saveConfig();
  20.    
  21.     }
  22.    
  23.     public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
  24.         if(sender instanceof Player) {
  25.             Player p = (Player) sender;
  26.            
  27.            
  28.            
  29.             //---- Reload
  30.             if(cmdLabel.equalsIgnoreCase("vpc") && args[0].equalsIgnoreCase("reload") && (p.isOp() || p.hasPermission("vippluschat.admin"))) {
  31.                 this.reloadConfig();
  32.                 pMessage(getConfig().getString("Messages.reload"), p);
  33.                 return true;
  34.             }
  35.             //---- End Reload
  36.            
  37.             //---- Chat
  38.             if((cmdLabel.equalsIgnoreCase("mod") || cmdLabel.equalsIgnoreCase("mo")) && p.hasPermission("vippluschat.chat.mod")) {
  39.                 String msg = "";    
  40.                 for(int i = 0; i < args.length; i++){
  41.                     String arg = args[i] + " ";
  42.                     msg = msg + arg;
  43.                 }
  44.                
  45.                 if (getConfig().getString("Enabled.Mod") == "true") {
  46.                     sendMessages(msg, p, "vippluschat.chat.mod", "Mod");
  47.                 } else {
  48.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Mod").replace("%PLAYER%", p.getName()), p);
  49.                 }
  50.                 return true;
  51.             }
  52.             if((cmdLabel.equalsIgnoreCase("admin") || cmdLabel.equalsIgnoreCase("ad")) && p.hasPermission("vippluschat.chat.admin")) {
  53.                 String msg = "";    
  54.  
  55.                 for(int i = 0; i < args.length; i++){
  56.                     String arg = args[i] + " ";
  57.                     msg = msg + arg;
  58.                 }
  59.                
  60.                 if (getConfig().getString("Enabled.Admin") == "true") {
  61.                     sendMessages(msg, p, "vippluschat.chat.admin", "Admin");
  62.                 } else {
  63.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Admin").replace("%PLAYER%", p.getName()), p);
  64.                 }
  65.                 return true;
  66.             }
  67.             if((cmdLabel.equalsIgnoreCase("owner") || cmdLabel.equalsIgnoreCase("ow")) && p.hasPermission("vippluschat.chat.owner")) {
  68.                 String msg = "";    
  69.  
  70.                 for(int i = 0; i < args.length; i++){
  71.                     String arg = args[i] + " ";
  72.                     msg = msg + arg;
  73.                 }
  74.                
  75.                 if (getConfig().getString("Enabled.Owner") == "true") {
  76.                     sendMessages(msg, p, "vippluschat.chat.owner", "Owner");
  77.                 } else {
  78.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Owner").replace("%PLAYER%", p.getName()), p);
  79.                 }
  80.                 return true;
  81.             }
  82.             if((cmdLabel.equalsIgnoreCase("vip") || cmdLabel.equalsIgnoreCase("v")) && p.hasPermission("vippluschat.chat.vip")) {
  83.                 String msg = "";    
  84.                 for(int i = 0; i < args.length; i++){
  85.                     String arg = args[i] + " ";
  86.                     msg = msg + arg;
  87.                 }
  88.                
  89.                 if (getConfig().getString("Enabled.VIP") == "true") {
  90.                     sendMessages(msg, p, "vippluschat.chat.vip", "VIP");
  91.                 } else {
  92.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "VIP").replace("%PLAYER%", p.getName()), p);
  93.                 }
  94.                 return true;
  95.             }
  96.             if((cmdLabel.equalsIgnoreCase("dev") || cmdLabel.equalsIgnoreCase("de")) && p.hasPermission("vippluschat.chat.dev")) {
  97.                 String msg = "";    
  98.  
  99.                 for(int i = 0; i < args.length; i++){
  100.                     String arg = args[i] + " ";
  101.                     msg = msg + arg;
  102.                 }
  103.                
  104.                 if (getConfig().getString("Enabled.Dev") == "true") {
  105.                     sendMessages(msg, p, "vippluschat.chat.dev", "Dev");
  106.                 } else {
  107.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Dev").replace("%PLAYER%", p.getName()), p);
  108.                 }
  109.                 return true;
  110.             }
  111.             if((cmdLabel.equalsIgnoreCase("donator") || cmdLabel.equalsIgnoreCase("do")) && p.hasPermission("vippluschat.chat.donator")) {
  112.                 String msg = "";    
  113.  
  114.                 for(int i = 0; i < args.length; i++){
  115.                     String arg = args[i] + " ";
  116.                     msg = msg + arg;
  117.                 }
  118.                
  119.                 if (getConfig().getString("Enabled.Donator") == "true") {
  120.                     sendMessages(msg, p, "vippluschat.chat.donator", "Donator");
  121.                 } else {
  122.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Donator").replace("%PLAYER%", p.getName()), p);
  123.                 }
  124.                 return true;
  125.             }
  126.             if((cmdLabel.equalsIgnoreCase("special") || cmdLabel.equalsIgnoreCase("sp")) && p.hasPermission("vippluschat.chat.special")) {
  127.                 String msg = "";    
  128.                 for(int i = 0; i < args.length; i++){
  129.                     String arg = args[i] + " ";
  130.                     msg = msg + arg;
  131.                 }
  132.                
  133.                 if (getConfig().getString("Enabled.Special") == "true") {
  134.                     sendMessages(msg, p, "vippluschat.chat.special", "Special");
  135.                 } else {
  136.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Special").replace("%PLAYER%", p.getName()), p);
  137.                 }
  138.                 return true;
  139.             }
  140.             if((cmdLabel.equalsIgnoreCase("elite") || cmdLabel.equalsIgnoreCase("el")) && p.hasPermission("vippluschat.chat.elite")) {
  141.                 String msg = "";    
  142.  
  143.                 for(int i = 0; i < args.length; i++){
  144.                     String arg = args[i] + " ";
  145.                     msg = msg + arg;
  146.                 }
  147.                
  148.                 if (getConfig().getString("Enabled.Elite") == "true") {
  149.                     sendMessages(msg, p, "vippluschat.chat.elite", "Elite");
  150.                 } else {
  151.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Elite").replace("%PLAYER%", p.getName()), p);
  152.                 }
  153.                 return true;
  154.             }
  155.             if((cmdLabel.equalsIgnoreCase("staff") || cmdLabel.equalsIgnoreCase("st")) && p.hasPermission("vippluschat.chat.staff")) {
  156.                 String msg = "";    
  157.  
  158.                 for(int i = 0; i < args.length; i++){
  159.                     String arg = args[i] + " ";
  160.                     msg = msg + arg;
  161.                 }
  162.                 if (getConfig().getString("Enabled.Staff") == "true") {
  163.                     sendMessages(msg, p, "vippluschat.chat.staff", "Staff");
  164.                 } else {
  165.                     pMessage(getConfig().getString("Messages.chat-disabled").replace("%CHAT_NAME%", "Staff").replace("%PLAYER%", p.getName()), p);
  166.                 }
  167.                 return true;
  168.                
  169.             }
  170.             //---- Chat End
  171.            
  172.             //---- Un/Ignore
  173.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2 && p.hasPermission("vippluschat.chat.ignore")) {
  174.                 if (args[0].equalsIgnoreCase("ignore") || args[0].equalsIgnoreCase("unignore") ) {
  175.                     if ((args[1].equalsIgnoreCase("mod") || args[1].equalsIgnoreCase("admin")
  176.                         || args[1].equalsIgnoreCase("owner") || args[1].equalsIgnoreCase("dev") || args[1].equalsIgnoreCase("staff") || args[1].equalsIgnoreCase("vip")
  177.                         || args[1].equalsIgnoreCase("donator") || args[1].equalsIgnoreCase("special") || args[1].equalsIgnoreCase("elite"))) {
  178.                         if (getConfig().getBoolean("Tag." + args[1] + ".allow-ignore")) {
  179.                         if (args[0].equalsIgnoreCase("ignore")) {
  180.                     boolean b = false;
  181.                     for (String a: getConfig().getString("Other.ignore-blacklist").split(",")) {
  182.                         if (a.equalsIgnoreCase(p.getName())) {
  183.                             pMessage(getConfig().getString("Messages.ignore-blacklist"), p);
  184.                             return false;
  185.                         }
  186.                     }
  187.                     for (String a: getConfig().getString("Other.ignore." + args[1].toLowerCase()).split(",")) {
  188.                         if (a.equalsIgnoreCase(p.getName())) {
  189.                             b = true;
  190.                         }
  191.                     }
  192.                     if (!b) {
  193.                         if (getConfig().getString("Other.ignore." + args[1].toLowerCase()).contains("none")) {
  194.                             getConfig().set("Other.ignore." + args[1].toLowerCase(), p.getName());
  195.                             saveConfig();
  196.                             pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  197.                             return true;
  198.                         } else {
  199.                             getConfig().set("Other.ignore." + args[1].toLowerCase(), getConfig().getString("Other.ignore." + args[1].toLowerCase()) + "," + p.getName());
  200.                             saveConfig();
  201.                             pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  202.                             return true;
  203.                         }
  204.                     } else {
  205.                         pMessage(ct(getConfig().getString("Messages.ignore-already").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "ignored").replace("%PLAYER%", p.getName())), p);
  206.                         return true;
  207.                     }
  208.                     } else {
  209.                         //Un
  210.                         boolean b = false;
  211.                         String c = "";
  212.                         int d = 0;
  213.                         for (String a: getConfig().getString("Other.ignore." + args[1].toLowerCase()).split(",")) {
  214.                             if (a.equalsIgnoreCase(p.getName())) {
  215.                                 b = true;
  216.                             } else {
  217.                                 if (d == 0) {
  218.                                     d += 1;
  219.                                     String e = c;
  220.                                     c = a;
  221.                                 } else {
  222.                                     String e = c;
  223.                                     c = e + "," + a;
  224.                                 }
  225.                             }
  226.                         }
  227.                         if (!b) {
  228.                             pMessage(ct(getConfig().getString("Messages.ignore-not-found").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  229.                             return true;
  230.                         } else {
  231.                             getConfig().set("Other.ignore." + args[1].toLowerCase(), c);
  232.                             saveConfig();
  233.                             if (c.length() == 0) {
  234.                                 c = "none";
  235.                             }
  236.                             getConfig().set("Other.ignore." + args[1].toLowerCase(), c);
  237.                             saveConfig();
  238.                             pMessage(ct(getConfig().getString("Messages.ignore").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  239.                             return true;
  240.                         }
  241.                     }
  242.                        
  243.                     } else {
  244.                         pMessage(getConfig().getString("Messages.ignore-disabled").replace("%CHAT_NAME%", args[1]),p);
  245.                     }
  246.                     } else {
  247.                         pMessage(ct(getConfig().getString("Messages.ignore-fail").replace("%CHAT_NAME%", args[1]).replace("%STATUS%", "unignored").replace("%PLAYER%", p.getName())), p);
  248.                     }
  249.                 }
  250.             }
  251.             //---- Ignore End
  252.            
  253.             //---- Get Ignore List
  254.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 2 && p.hasPermission("vippluschat.admin")) {
  255.                 if (args[0].equalsIgnoreCase("ignored")) {
  256.                     if (args[1].equalsIgnoreCase("mod") || args[1].equalsIgnoreCase("admin")
  257.                         || args[1].equalsIgnoreCase("owner") || args[1].equalsIgnoreCase("dev") || args[1].equalsIgnoreCase("staff") || args[1].equalsIgnoreCase("vip")
  258.                         || args[1].equalsIgnoreCase("donator") || args[1].equalsIgnoreCase("special") || args[1].equalsIgnoreCase("elite")) {
  259.                         pMessage(getConfig().getString("Messages.ignore-list").replace("%CHAT_NAME%", args[1]).replace("%LIST%", getConfig().getString("Other.ignore." + args[1].toLowerCase())), p);
  260.                             return true;
  261.                     } else {
  262.                         pMessage(getConfig().getString("Messages.ignore-fail"), p);
  263.                         return true;
  264.                     }
  265.                 }
  266.             }
  267.            
  268.             //---- Toggle Chat
  269.             if (cmdLabel.equalsIgnoreCase("vpc") && args.length == 3 && (p.isOp() || p.hasPermission("vippluschat.admin"))) {
  270.                 if(args[0].equalsIgnoreCase("toggle") && (args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("false")) && (args[1].equalsIgnoreCase("mod")
  271.                         || args[1].equalsIgnoreCase("admin")
  272.                         || args[1].equalsIgnoreCase("owner") || args[1].equalsIgnoreCase("dev") || args[1].equalsIgnoreCase("staff") || args[1].equalsIgnoreCase("vip")
  273.                         || args[1].equalsIgnoreCase("donator") || args[1].equalsIgnoreCase("special") || args[1].equalsIgnoreCase("elite"))) {
  274.                     try{  
  275.                           if (p.hasPermission("vipplushchat.toggle." + args[1])) {
  276.                               getConfig().get("Enabled." + args[1]);
  277.                               boolean st = Boolean.valueOf(args[2]);
  278.                               getConfig().set("Enabled." + args[1], st);
  279.                               saveConfig();
  280.                               reloadConfig();
  281.                               pMessage(getConfig().getString("Messages.toggle").replace("%CHAT_NAME%", args[1]).replace("%STATE%", args[2]), p);
  282.                           } else {
  283.                               pMessage(getConfig().getString("Messages.no-permissions"), p);
  284.                           }
  285.                         }catch(NullPointerException e){
  286.                             pMessage(getConfig().getString("Messages.error"), p);
  287.                         }
  288.                     return true;
  289.                 }
  290.             }
  291.             //---- End Toggle Chat
  292.         }
  293.         return false;
  294.     }
  295.    
  296.     public static String ct(String text) {
  297.         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 + "");
  298.     }
  299.    
  300.     public static void Broadcast(String msg) {
  301.         String tag = ct("&8[&9VPC&8] &2");
  302.         Bukkit.getServer().broadcastMessage(tag + ct(msg));
  303.     }
  304.     public Boolean checkColorCodes(String rank, String code) {
  305.         System.out.println(code + " - End of list");
  306.         for (String a: getConfig().getString("Tag." + rank + ".colors").split(" ")) {
  307.             if (a.equalsIgnoreCase(code)) {
  308.                 return true;
  309.             }
  310.         }
  311.         for (String a: getConfig().getString("Tag." + rank + ".color-codes").split(" ")) {
  312.             if (a.equalsIgnoreCase(code)) {
  313.                 return true;
  314.             }
  315.         }
  316.         return false;
  317.     }
  318.    
  319.     //---- Ingore Check
  320.     public Boolean checkIgnore(String user, String chat) {
  321.         boolean b = false;
  322.         for (String a: getConfig().getString("Other.ignore." + chat.toLowerCase()).split(",")) {
  323.             if (a.equalsIgnoreCase(user)) {
  324.                 b = true;
  325.             }
  326.         }
  327.         if (b) {
  328.             return true;
  329.         }
  330.         return false;
  331.     }
  332.     //---- Ignore Check End
  333.    
  334.     public String chatCleaner(String text , String rank) {
  335.         if (text.contains("&0") && checkColorCodes(rank, "black") == true) { text = text.replace("&0", ChatColor.BLACK + ""); } else { text = text.replace("&0", "");}
  336.         if (text.contains("&1") && checkColorCodes(rank, "dark_blue") == true) { text = text.replace("&1", ChatColor.DARK_BLUE + ""); } else { text = text.replace("&1", "");}
  337.         if (text.contains("&2") && checkColorCodes(rank, "dark_green") == true) { text = text.replace("&2", ChatColor.DARK_GREEN + ""); } else { text = text.replace("&2", "");}
  338.         if (text.contains("&3") && checkColorCodes(rank, "dark_aqua") == true) { text = text.replace("&3", ChatColor.DARK_AQUA + ""); } else { text = text.replace("&3", "");}
  339.         if (text.contains("&4") && checkColorCodes(rank, "dark_red") == true) { text = text.replace("&4", ChatColor.DARK_RED + ""); } else { text = text.replace("&4", "");}
  340.         if (text.contains("&5") && checkColorCodes(rank, "dark_purple") == true) { text = text.replace("&5", ChatColor.DARK_PURPLE + ""); } else { text = text.replace("&5", "");}
  341.         if (text.contains("&6") && checkColorCodes(rank, "gold") == true) { text = text.replace("&6", ChatColor.GOLD + ""); } else { text = text.replace("&6", "");}
  342.         if (text.contains("&7") && checkColorCodes(rank, "gray") == true) { text = text.replace("&7", ChatColor.GRAY + ""); } else { text = text.replace("&7", "");}
  343.         if (text.contains("&8") && checkColorCodes(rank, "dark_gray") == true) { text = text.replace("&8", ChatColor.DARK_GRAY + ""); } else { text = text.replace("&8", "");}
  344.         if (text.contains("&9") && checkColorCodes(rank, "blue") == true) { text = text.replace("&9", ChatColor.BLUE + ""); } else { text = text.replace("&9", "");}
  345.         if (text.contains("&a") && checkColorCodes(rank, "green") == true) { text = text.replace("&a", ChatColor.GREEN + ""); } else { text = text.replace("&a", "");}
  346.         if (text.contains("&b") && checkColorCodes(rank, "aqua") == true) { text = text.replace("&b", ChatColor.AQUA + ""); } else { text = text.replace("&b", "");}
  347.         if (text.contains("&c") && checkColorCodes(rank, "red") == true) { text = text.replace("&c", ChatColor.RED + ""); } else { text = text.replace("&c", "");}
  348.         if (text.contains("&d") && checkColorCodes(rank, "light_purple") == true) { text = text.replace("&d", ChatColor.LIGHT_PURPLE + ""); } else { text = text.replace("&d", "");}
  349.         if (text.contains("&e") && checkColorCodes(rank, "yellow") == true) { text = text.replace("&e", ChatColor.YELLOW + ""); } else { text = text.replace("&e", "");}
  350.         if (text.contains("&f") && checkColorCodes(rank, "white") == true) { text = text.replace("&f", ChatColor.WHITE + ""); } else { text = text.replace("&f", "");}
  351.         if (text.contains("&k") && checkColorCodes(rank, "obfuscated") == true) { text = text.replace("&k", ChatColor.MAGIC + ""); } else { text = text.replace("&k", "");}
  352.         if (text.contains("&l") && checkColorCodes(rank, "bold") == true) { text = text.replace("&l", ChatColor.BOLD + ""); } else { text = text.replace("&l", "");}
  353.         if (text.contains("&m") && checkColorCodes(rank, "strikethrough") == true) { text = text.replace("&m", ChatColor.STRIKETHROUGH + ""); } else { text = text.replace("&m", "");}
  354.         if (text.contains("&n") && checkColorCodes(rank, "underline") == true) { text = text.replace("&n", ChatColor.UNDERLINE + ""); } else { text = text.replace("&n", "");}
  355.         if (text.contains("&o") && checkColorCodes(rank, "italic") == true) { text = text.replace("&o", ChatColor.ITALIC + ""); } else { text = text.replace("&o", "");}
  356.         if (text.contains("&r") && checkColorCodes(rank, "reset") == true) { text = text.replace("&r", ChatColor.RESET + ""); } else { text = text.replace("&r", "");}
  357.        
  358.         return text;
  359.     }
  360.     public void pMessage(String msg, Player p) {
  361.         p.sendMessage(ct("&8[&9VPC&8] &2" + msg));
  362.     }
  363.     public String pSend(String msg, Player p1, Player p2, String rank) {
  364.         String tag = "";
  365.         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()); }
  366.         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()); }
  367.         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()); }
  368.         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()); }
  369.         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()); }
  370.         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()); }
  371.         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()); }
  372.         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()); }
  373.         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()); }
  374.        
  375.         System.out.println(tag);
  376.         p1.sendMessage(tag);
  377.         return "";
  378.     }
  379.    
  380.     public void sendMessages(String msg, Player player, String permissin, String rank) {
  381.         if(player.hasPermission(permissin) && !checkIgnore(player.getName(), rank)) {
  382.         for(Player p : Bukkit.getOnlinePlayers()) {
  383.             if(p.hasPermission(permissin) && !checkIgnore(p.getName(), rank)) {
  384.                 pSend(msg, p, player, rank);   
  385.             }
  386.         }
  387.         } else {
  388.             pMessage("You are currently ignoring this chat.", player);
  389.         }
  390.     }
  391. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement