I forget this one, Fix #507

This commit is contained in:
DNx5 2016-02-19 22:40:37 +07:00
parent c3e3bdf3a4
commit 760d2a9fe6

View File

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