mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-24 11:15:19 +01:00
I forget this one, Fix #507
This commit is contained in:
parent
c11fa9f158
commit
6dfdcf103b
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user