Remove local address check (Related #181)

This commit is contained in:
games647
2017-10-12 09:59:05 +02:00
parent 2512c5cf67
commit bb2cc1b42a
2 changed files with 6 additions and 13 deletions

View File

@ -136,7 +136,7 @@ public class AuthStorage {
return null;
}
public boolean save(PlayerProfile playerProfile) {
public void save(PlayerProfile playerProfile) {
try (Connection con = dataSource.getConnection()) {
UUID uuid = playerProfile.getUuid();
@ -177,12 +177,10 @@ public class AuthStorage {
}
}
return true;
} catch (SQLException ex) {
core.getPlugin().getLog().error("Failed to save playerProfile", ex);
}
return false;
}
public void close() {

View File

@ -152,26 +152,21 @@ public class MojangApiConnector {
return getConnection(url, Proxy.NO_PROXY);
}
private SSLSocketFactory buildAddresses(Logger logger, Collection<String> localAddresses) {
if (localAddresses.isEmpty()) {
return HttpsURLConnection.getDefaultSSLSocketFactory();
}
private SSLSocketFactory buildAddresses(Logger logger, Iterable<String> localAddresses) {
Set<InetAddress> addresses = Sets.newHashSet();
for (String localAddress : localAddresses) {
try {
InetAddress address = InetAddress.getByName(localAddress.replace('-', '.'));
if (!address.isAnyLocalAddress()) {
logger.warn("Submitted IP-Address is not local {}", address);
continue;
}
addresses.add(address);
} catch (UnknownHostException ex) {
logger.error("IP-Address is unknown to us", ex);
}
}
if (addresses.isEmpty()) {
return HttpsURLConnection.getDefaultSSLSocketFactory();
}
return new BalancedSSLFactory(HttpsURLConnection.getDefaultSSLSocketFactory(), addresses);
}
}