mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-26 18:47:37 +01:00
I forget this one, Fix #507
This commit is contained in:
parent
c3e3bdf3a4
commit
760d2a9fe6
@ -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