mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-24 17:47:38 +01:00
Little fix (prev commit)
This commit is contained in:
parent
705cc7ba8d
commit
a5956555a5
@ -863,29 +863,31 @@ public class AuthMe extends JavaPlugin {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
String realIP = player.getAddress().getAddress().getHostAddress();
|
||||
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%";
|
||||
sUrl = sUrl.replace("%IP%", realIP)
|
||||
.replace("%PORT%", "" + player.getAddress().getPort());
|
||||
try {
|
||||
URL url = new URL(sUrl);
|
||||
URLConnection urlCon = url.openConnection();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
||||
String inputLine = in.readLine();
|
||||
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
||||
&& !inputLine.contains("error")) {
|
||||
realIP = inputLine;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Could not read from Very Games API - " + StringUtils.formatException(e));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Could not fetch Very Games API with URL '" + sUrl + "' - "
|
||||
+ StringUtils.formatException(e));
|
||||
}
|
||||
if (realIp.containsKey(name))
|
||||
realIp.remove(name);
|
||||
realIp.putIfAbsent(name, realIP);
|
||||
String realIP = player.getAddress().getAddress().getHostAddress();
|
||||
if (realIp.containsKey(name))
|
||||
realIP = realIp.get(name);
|
||||
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%";
|
||||
sUrl = sUrl.replace("%IP%", realIP)
|
||||
.replace("%PORT%", "" + player.getAddress().getPort());
|
||||
try {
|
||||
URL url = new URL(sUrl);
|
||||
URLConnection urlCon = url.openConnection();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
||||
String inputLine = in.readLine();
|
||||
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
||||
&& !inputLine.contains("error")) {
|
||||
realIP = inputLine;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Could not read from Very Games API - " + StringUtils.formatException(e));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ConsoleLogger.showError("Could not fetch Very Games API with URL '" + sUrl + "' - "
|
||||
+ StringUtils.formatException(e));
|
||||
}
|
||||
if (realIp.containsKey(name))
|
||||
realIp.remove(name);
|
||||
realIp.putIfAbsent(name, realIP);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user