All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bukkit.command.defaults.PardonIpCommand Maven / Gradle / Ivy

The newest version!
package org.bukkit.command.defaults;

import com.google.common.collect.ImmutableList;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

@Deprecated
public class PardonIpCommand extends VanillaCommand {
  public PardonIpCommand() {
    super("pardon-ip");
    this.description = "Allows the specified IP address to use this server";
    this.usageMessage = "/pardon-ip 
"; this.setPermission("bukkit.command.unban.ip"); } @Override public boolean execute(CommandSender sender, String currentAlias, String[] args) { if (!testPermission(sender)) return true; if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } if (BanIpCommand.ipValidity.matcher(args[0]).matches()) { Bukkit.unbanIP(args[0]); Command.broadcastCommandMessage(sender, "Pardoned ip " + args[0]); } else { sender.sendMessage("Invalid ip"); } return true; } @Override public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be null"); if (args.length == 1) { return StringUtil.copyPartialMatches(args[0], Bukkit.getIPBans(), new ArrayList()); } return ImmutableList.of(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy