Whitelisted countries being kickedFixed

I saw some mistake that happend. 

->

private bool IsCountryAllowed(string country)
        {
            bool countryListed = config.CountryList.Contains(country);
            if (!config.IsWhitelist && countryListed || config.IsWhitelist && countryListed || config.NativesOnly && !serverCountry.Equals(country))
            {
                return false;
            }

            return true;
        }

!config.IsWhitelist && countryListed || config.IsWhitelist && !countryListed

it should be . 
Otherwise it will always deny listed countries. 

That setting correlates to if the configuration is set as a blacklist OR a whitelist.

I.e. Block if blacklisted OR allow if whitelisted

Hello!

We're trying to block everything but one country using "Use country code list as a whitelist (true/false)" as TRUE, we've reloaded the plugin and config, even restarted the server but the plugin keeps kicking people FROM that list, not using it as a Whitelist.

Am I missing something here?

Looking at the code, this might be the issue, the second condition is wrong. It should be a negation in countryListed.

if (!config.IsWhitelist && countryListed || config.IsWhitelist && countryListed || config.NativesOnly && !serverCountry.Equals(country))

Merged post

Yeah noticed the mistake in my code too, this one now is working smoothly.

        private bool IsCountryAllowed(string country)
        {
            bool countryListed = config.CountryList.Contains(country);
            if (!config.IsWhitelist && countryListed || config.IsWhitelist && !countryListed || config.NativesOnly && !serverCountry.Equals(country))
            {
                return false;
            }

            return true;
        }​

I am having similar problems with this plugin.
Perhaps I am using it incorrectly but when setting it to whitelist and putting in a country code it kicks and bans everyone from that country.
Not what I expected.

Merged post

{
"API key for paid IP lookup service (if applicable)": "",
"Ban player if country is blacklisted (true/false)": true,
"Only allow players from server's country (true/false)": false,
"Cache responses from IP lookup service provider (true/false)": true,
"Number of retries on IP lookup fail (0 to disable)": 3,
"Log connections from players (true/false)": true,
"Use country code list as a whitelist (true/false)": true,
"List of two-digit countries codes to check": [
"AU",
"NZ"
]
}

Merged post

Could we please have a fix for this ? I think it's broken ?

Merged post

It's a little strange why you would do it the other way around frankly ?
Why would you type in all the country codes one by one rather than just put in the one or two you need to allow ?

This works but I now need to put in all the country codes one by one ? YIKES.

{
"API key for paid IP lookup service (if applicable)": "YOUR_API_KEY",
"Ban player if country is blacklisted (true/false)": false,
"Only allow players from server's country (true/false)": false,
"Cache responses from IP lookup service provider (true/false)": true,
"Number of retries on IP lookup fail (0 to disable)": 3,
"Log connections from players (true/false)": false,
"Use country code list as a whitelist (true/false)": false,
"List of two-digit countries codes to check": [
"CN",
"JP",
"HK",
"KR",
"RU",
"US",
"PH",
"VN"
]
}

I'll be taking a look at the issue as able.

Locked automatically