Localized provider using country ISO standard codes instead of country names

This commit is contained in:
Jaime Martinez Rincon 2017-01-23 15:03:15 +01:00
parent 36d9eeff13
commit fe2f7f22ce
2 changed files with 6 additions and 6 deletions

View File

@ -42,20 +42,20 @@ public enum ProviderType {
InetAddress address = player.getAddress().getAddress();
try {
CountryResponse countryResponse = plugin.getGeolocationManager().getReader().country(address);
Country country = countryResponse.getCountry();
CountryResponse response = plugin.getGeolocationManager().getReader().country(address);
Country country = response.getCountry();
if (ConfigEntries.GEOLOCATION_PRINT_INFO.get()) {
plugin.getLogger().info(String.format(
"Player Address: \"%s\", Country Name: \"%s\"",
"Player Address: \"%s\", Country Code: \"%s\"",
address.toString(),
country.getName()
country.getIsoCode()
));
}
for (String name : rule.getKeys()) {
List<String> countries = rule.getStringList(name);
if (countries.contains(country.getName())) {
if (countries.contains(country.getIsoCode())) {
ServerInfo server = plugin.getProxy().getServerInfo(name);
if (server != null) {
return server;

View File

@ -93,7 +93,7 @@ settings:
rules: {}
# This gets the country of a player and decides to which server the player should go
# Country codes: http://dev.maxmind.com/geoip/legacy/codes/iso3166/
# Country ISO codes: http://dev.maxmind.com/geoip/legacy/codes/iso3166/
# WARNING: In testing stage
geolocation:
# If disabled the localized provider will choose a random server