From fe2f7f22cee762c9f0840e0460b1fdcb3ecf8c43 Mon Sep 17 00:00:00 2001 From: Jaime Martinez Rincon Date: Mon, 23 Jan 2017 15:03:15 +0100 Subject: [PATCH] Localized provider using country ISO standard codes instead of country names --- .../lobbybalancer/connection/ProviderType.java | 10 +++++----- src/main/resources/config.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/me/jaimemartz/lobbybalancer/connection/ProviderType.java b/src/main/java/me/jaimemartz/lobbybalancer/connection/ProviderType.java index 54cc57e..b30ddbe 100644 --- a/src/main/java/me/jaimemartz/lobbybalancer/connection/ProviderType.java +++ b/src/main/java/me/jaimemartz/lobbybalancer/connection/ProviderType.java @@ -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 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; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 963fb70..b072d77 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -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