mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-25 01:57:48 +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(){
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
String realIP = player.getAddress().getAddress().getHostAddress();
|
String realIP = player.getAddress().getAddress().getHostAddress();
|
||||||
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%";
|
if (realIp.containsKey(name))
|
||||||
sUrl = sUrl.replace("%IP%", realIP)
|
realIP = realIp.get(name);
|
||||||
.replace("%PORT%", "" + player.getAddress().getPort());
|
String sUrl = "http://monitor-1.verygames.net/api/?action=ipclean-real-ip&out=raw&ip=%IP%&port=%PORT%";
|
||||||
try {
|
sUrl = sUrl.replace("%IP%", realIP)
|
||||||
URL url = new URL(sUrl);
|
.replace("%PORT%", "" + player.getAddress().getPort());
|
||||||
URLConnection urlCon = url.openConnection();
|
try {
|
||||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
URL url = new URL(sUrl);
|
||||||
String inputLine = in.readLine();
|
URLConnection urlCon = url.openConnection();
|
||||||
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
try (BufferedReader in = new BufferedReader(new InputStreamReader(urlCon.getInputStream()))) {
|
||||||
&& !inputLine.contains("error")) {
|
String inputLine = in.readLine();
|
||||||
realIP = inputLine;
|
if (!StringUtils.isEmpty(inputLine) && !inputLine.equalsIgnoreCase("error")
|
||||||
}
|
&& !inputLine.contains("error")) {
|
||||||
} catch (IOException e) {
|
realIP = inputLine;
|
||||||
ConsoleLogger.showError("Could not read from Very Games API - " + StringUtils.formatException(e));
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
} catch (IOException e) {
|
ConsoleLogger.showError("Could not read from Very Games API - " + StringUtils.formatException(e));
|
||||||
ConsoleLogger.showError("Could not fetch Very Games API with URL '" + sUrl + "' - "
|
}
|
||||||
+ StringUtils.formatException(e));
|
} catch (IOException e) {
|
||||||
}
|
ConsoleLogger.showError("Could not fetch Very Games API with URL '" + sUrl + "' - "
|
||||||
if (realIp.containsKey(name))
|
+ StringUtils.formatException(e));
|
||||||
realIp.remove(name);
|
}
|
||||||
realIp.putIfAbsent(name, realIP);
|
if (realIp.containsKey(name))
|
||||||
|
realIp.remove(name);
|
||||||
|
realIp.putIfAbsent(name, realIP);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user