I forget this one, Fix #507

This commit is contained in:
DNx5 2016-02-19 22:40:37 +07:00
parent c11fa9f158
commit 6dfdcf103b

View File

@ -28,17 +28,13 @@ public class AuthMeServerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onServerPing(ServerListPingEvent event) {
if (!Settings.enableProtection) {
return;
}
if (!Settings.countriesBlacklist.isEmpty() || !Settings.countries.isEmpty()){
String countryCode = GeoLiteAPI.getCountryCode(event.getAddress().getHostAddress());
if( Settings.countriesBlacklist.contains(countryCode)) {
event.setMotd(m.retrieveSingle(MessageKey.COUNTRY_BANNED_ERROR));
return;
}
if (!Settings.countries.contains(countryCode)) {
if (Settings.enableProtection && !Settings.countries.contains(countryCode)) {
event.setMotd(m.retrieveSingle(MessageKey.COUNTRY_BANNED_ERROR));
}
}