Advertisement
Jnk1296

The Difference One Year Can Make

Nov 10th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.87 KB | None | 0 0
  1. //====================================//
  2. // IP-Check 1.0.0 Command Declarations (April 02, 2013)
  3. //====================================//
  4.  
  5. @Override
  6.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
  7.         if (cmd.getName().equalsIgnoreCase("check")) {
  8.             if (args.length == 1) {
  9.                 if (!args[0].equalsIgnoreCase("ban") && !args[0].equalsIgnoreCase("unban") && !args[0].equalsIgnoreCase("player")
  10.                         && !args[0].equalsIgnoreCase("banrecent") && !args[0].equalsIgnoreCase("unbanrecent")) { // If the argument given is not any of the seconday commands
  11.                     if (args[0].charAt(0) >= '0'&& args[0].charAt(0) <= '9') {
  12.                         // Command Operation
  13.                         report(checkPlayers(compareIP(args[0], getBannedList()), getPlayerFiles()), sender, args[0], false);
  14.                         recent = "";
  15.                     } else {
  16.                         sender.sendMessage(illArgsErr);
  17.                     }
  18.                 } else if (args[0].equalsIgnoreCase("banrecent")) { // "/check banrecent"
  19.                     if ((sender.hasPermission("ipcheck.recent") && sender.hasPermission("ipcheck.ban")) || sender.isOp()) {
  20.                         // Command Operation
  21.                         if (!recent.equals("")) {
  22.                             report(banPlayers(checkPlayers(compareIP(recent, getBannedList()), getPlayerFiles()), sender, recent, true), sender, recent, false);
  23.                         } else {
  24.                             sender.sendMessage(noRecent);
  25.                         }
  26.                     } else {
  27.                         sender.sendMessage(noPermErr);
  28.                     }
  29.                 } else if (args[0].equalsIgnoreCase("unbanrecent")) { // "/check banrecent"
  30.                     if ((sender.hasPermission("ipcheck.recent") && sender.hasPermission("ipcheck.unban")) || sender.isOp()) {
  31.                         // Command Operation
  32.                         if (!recent.equals("")) {
  33.                             report(banPlayers(checkPlayers(compareIP(recent, getBannedList()), getPlayerFiles()), sender, recent, false), sender, recent, false);
  34.                         } else {
  35.                             sender.sendMessage(noRecent);
  36.                         }
  37.                     } else {
  38.                         sender.sendMessage(noPermErr);
  39.                     }
  40.                 } else {
  41.                     sender.sendMessage(numArgsErr);
  42.                 }
  43.                
  44.                 return true;
  45.             } else if (args.length == 2) {
  46.                 if (args[0].equalsIgnoreCase("ban")) {    // "/check ban"
  47.                     if  (sender.hasPermission("ipcheck.ban") || sender.isOp()) {
  48.                         if (args[1].charAt(0) >= '0'&& args[1].charAt(0) <= '9') { // Check that argument is a potential IP address
  49.                             // Command Operation
  50.                             report(banPlayers(checkPlayers(compareIP(args[1], getBannedList()), getPlayerFiles()), sender, args[1], true), sender, args[1], false);
  51.                             recent = "";
  52.                         } else {
  53.                             sender.sendMessage(illArgsErr);
  54.                         }
  55.                     } else {
  56.                         sender.sendMessage(noPermErr);
  57.                     }
  58.                 } else if (args[0].equalsIgnoreCase("unban")) {    // "/check unban"
  59.                     if (sender.hasPermission("ipcheck.unban") || sender.isOp()) {
  60.                         if (args[1].charAt(0) >= '0'&& args[1].charAt(0) <= '9') { // Check that argument is a potential IP address
  61.                             // Command Operation
  62.                             report(banPlayers(checkPlayers(compareIP(args[1], getBannedList()), getPlayerFiles()), sender, args[1], false), sender, args[1], false);
  63.                             recent = "";
  64.                         } else {
  65.                             sender.sendMessage(illArgsErr);
  66.                         }
  67.                     } else {
  68.                         sender.sendMessage(noPermErr);
  69.                     }
  70.                 } else if (args[0].equalsIgnoreCase("player")) {    // "/check player"
  71.                     if (sender.hasPermission("ipcheck.player") || sender.isOp()) {
  72.                         // Command Operation
  73.                         report(checkPlayers(compareIP(getPlayerInfo(args[1], getPlayerFiles()), getBannedList()), getPlayerFiles()), sender, recent, true);
  74.                     } else {
  75.                         sender.sendMessage(noPermErr);
  76.                     }
  77.                 }
  78.  
  79.                 return true;
  80.             }
  81.         }
  82.        
  83.         return false;
  84.     }
  85.  
  86. //====================================//
  87. // IP-Check 2.0.0 Command Declarations (April 26, 2014)
  88. //====================================//
  89.  
  90. @Override
  91.     public void initializeStore() {
  92.         // About Command
  93.         this.add(
  94.                 new CmdAbout(plugin, new String[]{"ipc", "about"},
  95.                         CommandType.STATIC));
  96.  
  97.         // Help Command
  98.         this.add(
  99.                 new CmdHelp(plugin, new String[]{"ipc", "help", "VAR_ARG_OPT"},
  100.                         CommandType.VARIABLE));
  101.  
  102.         // Ban Command
  103.         this.add(
  104.                 new CmdBan(plugin, new String[]{"ipc", "ban", "VAR_ARG"},
  105.                         CommandType.DYNAMIC));
  106.  
  107.         // SBan Command
  108.         this.add(
  109.                 new CmdSBan(plugin, new String[]{"ipc", "sban", "VAR_ARG"},
  110.                         CommandType.DYNAMIC));
  111.  
  112.         // Ban-All Command
  113.         this.add(
  114.                 new CmdBanAll(plugin, new String[]{"ipc", "banall", "VAR_ARG",
  115.                         "VAR_ARG"}, CommandType.DYNAMIC));
  116.  
  117.         // Unban Command
  118.         this.add(
  119.                 new CmdUnban(plugin, new String[]{"ipc", "unban", "VAR_ARG"},
  120.                         CommandType.VARIABLE));
  121.  
  122.         // Unban-All Command
  123.         this.add(
  124.                 new CmdUnbanAll(plugin, new String[]{"ipc", "unbanall",
  125.                         "VAR_ARG", "VAR_ARG"}, CommandType.VARIABLE));
  126.  
  127.         // Mod-Ban Command
  128.         this.add(
  129.                 new CmdModBan(plugin, new String[]{"ipc", "modban", "VAR_ARG"},
  130.                         CommandType.DYNAMIC));
  131.  
  132.         // Kick Command
  133.         this.add(
  134.                 new CmdKick(plugin, new String[]{"ipc", "kick", "VAR_ARG"},
  135.                         CommandType.DYNAMIC));
  136.  
  137.         // Exempt Command
  138.         this.add(
  139.                 new CmdExempt(plugin, new String[]{"ipc", "exempt", "VAR_ARG"},
  140.                         CommandType.VARIABLE));
  141.  
  142.         // Unexempt Command
  143.         this.add(
  144.                 new CmdUnexempt(plugin, new String[]{"ipc", "unexempt",
  145.                         "VAR_ARG"}, CommandType.VARIABLE));
  146.  
  147.         // Exempt-List (IP)
  148.         this.add(
  149.                 new CmdExemptListIP(plugin, new String[]{"ipc", "exempt-list",
  150.                         "ip"}, CommandType.STATIC));
  151.  
  152.         // Exempt-List (Player)
  153.         this.add(
  154.                 new CmdExemptListPlayer(plugin, new String[]{"ipc",
  155.                         "exempt-list", "player"}, CommandType.STATIC));
  156.  
  157.         // Exempt-List (All)
  158.         this.add(
  159.                 new CmdExemptListAll(plugin, new String[]{"ipc",
  160.                         "exempt-list"}, CommandType.STATIC));
  161.  
  162.         // Block Command
  163.         this.add(
  164.                 new CmdBlock(plugin, new String[]{"ipc", "block", "VAR_ARG"},
  165.                         CommandType.VARIABLE));
  166.  
  167.         // Unblock Command
  168.         this.add(
  169.                 new CmdUnblock(plugin, new String[]{"ipc", "unblock",
  170.                         "VAR_ARG"}, CommandType.VARIABLE));
  171.  
  172.         // Protect Command
  173.         this.add(
  174.                 new CmdProtect(plugin, new String[]{"ipc", "protect",
  175.                         "VAR_ARG"}, CommandType.VARIABLE));
  176.  
  177.         // Unprotect Command
  178.         this.add(
  179.                 new CmdUnprotect(plugin, new String[]{"ipc", "unprotect",
  180.                         "VAR_ARG"}, CommandType.VARIABLE));
  181.  
  182.         // Scan Command
  183.         this.add(
  184.                 new CmdScan(plugin, new String[]{"ipc", "scan"},
  185.                         CommandType.STATIC));
  186.  
  187.         // Status Command
  188.         this.add(
  189.                 new CmdStatus(plugin, new String[]{"ipc", "status"},
  190.                         CommandType.STATIC));
  191.  
  192.         // Purge Command
  193.         this.add(
  194.                 new CmdPurge(plugin, new String[]{"ipc", "purge", "VAR_ARG"},
  195.                         CommandType.VARIABLE));
  196.  
  197.         // Toggle Command
  198.         this.add(
  199.                 new CmdToggle(plugin, new String[]{"ipc", "toggle", "VAR_ARG"},
  200.                         CommandType.VARIABLE));
  201.  
  202.         // Reload Command
  203.         this.add(
  204.                 new CmdReload(plugin, new String[]{"ipc", "reload"},
  205.                         CommandType.STATIC));
  206.  
  207.         // ROOT COMMAND
  208.         this.add(
  209.                 new CmdCheck(plugin, new String[]{"ipc", "VAR_ARG"},
  210.                         CommandType.VARIABLE));
  211.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement