mirror of
https://github.com/BGHDDevelopment/PlayerBalancer.git
synced 2024-11-23 11:15:30 +01:00
Localized provider using country ISO standard codes instead of country names
This commit is contained in:
parent
36d9eeff13
commit
fe2f7f22ce
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user