// player has clan and is the clan leader, check the castle info
if ((clan != null) && (clan.getLeader().getPlayerInstance() == this))
{
// if the clan has a castle and it is actually the queried castle, return true
Castle castle = CastleManager.getInstance().getCastleByOwner(clan);
if ((castle != null) && (castle == CastleManager.getInstance().getCastleById(castleId)))
{
return true;
}
}