Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //====================================//
- // IP-Check 1.0.0 Command Declarations (April 02, 2013)
- //====================================//
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
- if (cmd.getName().equalsIgnoreCase("check")) {
- if (args.length == 1) {
- if (!args[0].equalsIgnoreCase("ban") && !args[0].equalsIgnoreCase("unban") && !args[0].equalsIgnoreCase("player")
- && !args[0].equalsIgnoreCase("banrecent") && !args[0].equalsIgnoreCase("unbanrecent")) { // If the argument given is not any of the seconday commands
- if (args[0].charAt(0) >= '0'&& args[0].charAt(0) <= '9') {
- // Command Operation
- report(checkPlayers(compareIP(args[0], getBannedList()), getPlayerFiles()), sender, args[0], false);
- recent = "";
- } else {
- sender.sendMessage(illArgsErr);
- }
- } else if (args[0].equalsIgnoreCase("banrecent")) { // "/check banrecent"
- if ((sender.hasPermission("ipcheck.recent") && sender.hasPermission("ipcheck.ban")) || sender.isOp()) {
- // Command Operation
- if (!recent.equals("")) {
- report(banPlayers(checkPlayers(compareIP(recent, getBannedList()), getPlayerFiles()), sender, recent, true), sender, recent, false);
- } else {
- sender.sendMessage(noRecent);
- }
- } else {
- sender.sendMessage(noPermErr);
- }
- } else if (args[0].equalsIgnoreCase("unbanrecent")) { // "/check banrecent"
- if ((sender.hasPermission("ipcheck.recent") && sender.hasPermission("ipcheck.unban")) || sender.isOp()) {
- // Command Operation
- if (!recent.equals("")) {
- report(banPlayers(checkPlayers(compareIP(recent, getBannedList()), getPlayerFiles()), sender, recent, false), sender, recent, false);
- } else {
- sender.sendMessage(noRecent);
- }
- } else {
- sender.sendMessage(noPermErr);
- }
- } else {
- sender.sendMessage(numArgsErr);
- }
- return true;
- } else if (args.length == 2) {
- if (args[0].equalsIgnoreCase("ban")) { // "/check ban"
- if (sender.hasPermission("ipcheck.ban") || sender.isOp()) {
- if (args[1].charAt(0) >= '0'&& args[1].charAt(0) <= '9') { // Check that argument is a potential IP address
- // Command Operation
- report(banPlayers(checkPlayers(compareIP(args[1], getBannedList()), getPlayerFiles()), sender, args[1], true), sender, args[1], false);
- recent = "";
- } else {
- sender.sendMessage(illArgsErr);
- }
- } else {
- sender.sendMessage(noPermErr);
- }
- } else if (args[0].equalsIgnoreCase("unban")) { // "/check unban"
- if (sender.hasPermission("ipcheck.unban") || sender.isOp()) {
- if (args[1].charAt(0) >= '0'&& args[1].charAt(0) <= '9') { // Check that argument is a potential IP address
- // Command Operation
- report(banPlayers(checkPlayers(compareIP(args[1], getBannedList()), getPlayerFiles()), sender, args[1], false), sender, args[1], false);
- recent = "";
- } else {
- sender.sendMessage(illArgsErr);
- }
- } else {
- sender.sendMessage(noPermErr);
- }
- } else if (args[0].equalsIgnoreCase("player")) { // "/check player"
- if (sender.hasPermission("ipcheck.player") || sender.isOp()) {
- // Command Operation
- report(checkPlayers(compareIP(getPlayerInfo(args[1], getPlayerFiles()), getBannedList()), getPlayerFiles()), sender, recent, true);
- } else {
- sender.sendMessage(noPermErr);
- }
- }
- return true;
- }
- }
- return false;
- }
- //====================================//
- // IP-Check 2.0.0 Command Declarations (April 26, 2014)
- //====================================//
- @Override
- public void initializeStore() {
- // About Command
- this.add(
- new CmdAbout(plugin, new String[]{"ipc", "about"},
- CommandType.STATIC));
- // Help Command
- this.add(
- new CmdHelp(plugin, new String[]{"ipc", "help", "VAR_ARG_OPT"},
- CommandType.VARIABLE));
- // Ban Command
- this.add(
- new CmdBan(plugin, new String[]{"ipc", "ban", "VAR_ARG"},
- CommandType.DYNAMIC));
- // SBan Command
- this.add(
- new CmdSBan(plugin, new String[]{"ipc", "sban", "VAR_ARG"},
- CommandType.DYNAMIC));
- // Ban-All Command
- this.add(
- new CmdBanAll(plugin, new String[]{"ipc", "banall", "VAR_ARG",
- "VAR_ARG"}, CommandType.DYNAMIC));
- // Unban Command
- this.add(
- new CmdUnban(plugin, new String[]{"ipc", "unban", "VAR_ARG"},
- CommandType.VARIABLE));
- // Unban-All Command
- this.add(
- new CmdUnbanAll(plugin, new String[]{"ipc", "unbanall",
- "VAR_ARG", "VAR_ARG"}, CommandType.VARIABLE));
- // Mod-Ban Command
- this.add(
- new CmdModBan(plugin, new String[]{"ipc", "modban", "VAR_ARG"},
- CommandType.DYNAMIC));
- // Kick Command
- this.add(
- new CmdKick(plugin, new String[]{"ipc", "kick", "VAR_ARG"},
- CommandType.DYNAMIC));
- // Exempt Command
- this.add(
- new CmdExempt(plugin, new String[]{"ipc", "exempt", "VAR_ARG"},
- CommandType.VARIABLE));
- // Unexempt Command
- this.add(
- new CmdUnexempt(plugin, new String[]{"ipc", "unexempt",
- "VAR_ARG"}, CommandType.VARIABLE));
- // Exempt-List (IP)
- this.add(
- new CmdExemptListIP(plugin, new String[]{"ipc", "exempt-list",
- "ip"}, CommandType.STATIC));
- // Exempt-List (Player)
- this.add(
- new CmdExemptListPlayer(plugin, new String[]{"ipc",
- "exempt-list", "player"}, CommandType.STATIC));
- // Exempt-List (All)
- this.add(
- new CmdExemptListAll(plugin, new String[]{"ipc",
- "exempt-list"}, CommandType.STATIC));
- // Block Command
- this.add(
- new CmdBlock(plugin, new String[]{"ipc", "block", "VAR_ARG"},
- CommandType.VARIABLE));
- // Unblock Command
- this.add(
- new CmdUnblock(plugin, new String[]{"ipc", "unblock",
- "VAR_ARG"}, CommandType.VARIABLE));
- // Protect Command
- this.add(
- new CmdProtect(plugin, new String[]{"ipc", "protect",
- "VAR_ARG"}, CommandType.VARIABLE));
- // Unprotect Command
- this.add(
- new CmdUnprotect(plugin, new String[]{"ipc", "unprotect",
- "VAR_ARG"}, CommandType.VARIABLE));
- // Scan Command
- this.add(
- new CmdScan(plugin, new String[]{"ipc", "scan"},
- CommandType.STATIC));
- // Status Command
- this.add(
- new CmdStatus(plugin, new String[]{"ipc", "status"},
- CommandType.STATIC));
- // Purge Command
- this.add(
- new CmdPurge(plugin, new String[]{"ipc", "purge", "VAR_ARG"},
- CommandType.VARIABLE));
- // Toggle Command
- this.add(
- new CmdToggle(plugin, new String[]{"ipc", "toggle", "VAR_ARG"},
- CommandType.VARIABLE));
- // Reload Command
- this.add(
- new CmdReload(plugin, new String[]{"ipc", "reload"},
- CommandType.STATIC));
- // ROOT COMMAND
- this.add(
- new CmdCheck(plugin, new String[]{"ipc", "VAR_ARG"},
- CommandType.VARIABLE));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement