package me.StevenLawson.TotalFreedomMod.commands; import me.StevenLawson.TotalFreedomMod.player.PlayerList; import me.StevenLawson.TotalFreedomMod.player.PlayerRank; import org.apache.commons.lang3.StringUtils; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import java.util.ArrayList; @CommandPermissions(level = AdminLevel.SUPER, source = SourceType.BOTH) public class Command_findip extends FreedomCommand { @Override public boolean run(CommandSender sender, org.bukkit.entity.Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length != 1) { return false; } final Player player = getPlayer(args[0]); if (player == null) { playerMsg(sender, FreedomCommand.PLAYER_NOT_FOUND); return true; } PlayerRank rank = PlayerRank.fromSender(sender); PlayerRank targetRank = PlayerRank.fromSender(player); ArrayList ipsToShow = (ArrayList) PlayerList.getEntry(player).getIps(); if(rank.getOrdinal() < PlayerRank.SENIOR.getOrdinal() || targetRank.getOrdinal() >= rank.getOrdinal()) { ipsToShow = (ArrayList) PlayerList.getEntry(player).getFuzziedIps(); } playerMsg(sender, "Player IPs: " + StringUtils.join(ipsToShow, ", ")); return true; } }