Fix compile

This commit is contained in:
games647
2017-09-22 21:41:24 +02:00
parent 2932de5588
commit 66b808c999
4 changed files with 15 additions and 14 deletions

View File

@ -31,7 +31,7 @@ public class PremiumPlaceholder extends PlaceholderHook {
} }
} }
return null; return "";
} }
public static void register(FastLoginBukkit plugin) { public static void register(FastLoginBukkit plugin) {

View File

@ -11,6 +11,7 @@ import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Collections;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
@ -112,6 +113,6 @@ public class BungeeCordListener implements PluginMessageListener {
plugin.getLogger().log(Level.SEVERE, "Failed to retrieve proxy Id. Disabling BungeeCord support", ex); plugin.getLogger().log(Level.SEVERE, "Failed to retrieve proxy Id. Disabling BungeeCord support", ex);
} }
return null; return Collections.emptySet();
} }
} }

View File

@ -21,6 +21,11 @@
<id>vik1395-repo</id> <id>vik1395-repo</id>
<url>https://vik1395.github.io/repo.vik1395.me/repositories</url> <url>https://vik1395.github.io/repo.vik1395.me/repositories</url>
</repository> </repository>
<repository>
<id>luck-repo</id>
<url>https://ci.lucko.me/plugin/repository/everything</url>
</repository>
</repositories> </repositories>
<dependencies> <dependencies>

View File

@ -30,6 +30,7 @@ import java.util.logging.Logger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
public class MojangApiConnector { public class MojangApiConnector {
@ -48,7 +49,7 @@ public class MojangApiConnector {
private final Iterator<Proxy> proxies; private final Iterator<Proxy> proxies;
private final Map<Object, Object> requests = CommonUtil.buildCache(10, -1); private final Map<Object, Object> requests = CommonUtil.buildCache(10, -1);
private final BalancedSSLFactory sslFactory; private final SSLSocketFactory sslFactory;
private final int rateLimit; private final int rateLimit;
private long lastRateLimit; private long lastRateLimit;
@ -96,9 +97,7 @@ public class MojangApiConnector {
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String line = reader.readLine(); String line = reader.readLine();
if (!"null".equals(line)) { return getUUIDFromJson(line);
return CommonUtil.parseId(getUUIDFromJson(line));
}
} }
} else if (connection.getResponseCode() == RATE_LIMIT_CODE) { } else if (connection.getResponseCode() == RATE_LIMIT_CODE) {
logger.info("RATE_LIMIT REACHED"); logger.info("RATE_LIMIT REACHED");
@ -120,7 +119,7 @@ public class MojangApiConnector {
return false; return false;
} }
private String getUUIDFromJson(String json) { private UUID getUUIDFromJson(String json) {
boolean isArray = json.startsWith("["); boolean isArray = json.startsWith("[");
Player mojangPlayer; Player mojangPlayer;
@ -131,11 +130,7 @@ public class MojangApiConnector {
} }
String id = mojangPlayer.getId(); String id = mojangPlayer.getId();
if ("null".equals(id)) { return CommonUtil.parseId(id);
return null;
}
return id;
} }
protected HttpsURLConnection getConnection(String url, Proxy proxy) throws IOException { protected HttpsURLConnection getConnection(String url, Proxy proxy) throws IOException {
@ -158,9 +153,9 @@ public class MojangApiConnector {
return getConnection(url, Proxy.NO_PROXY); return getConnection(url, Proxy.NO_PROXY);
} }
private BalancedSSLFactory buildAddresses(Logger logger, Collection<String> localAddresses) { private SSLSocketFactory buildAddresses(Logger logger, Collection<String> localAddresses) {
if (localAddresses.isEmpty()) { if (localAddresses.isEmpty()) {
return null; return HttpsURLConnection.getDefaultSSLSocketFactory();
} else { } else {
Set<InetAddress> addresses = Sets.newHashSet(); Set<InetAddress> addresses = Sets.newHashSet();
for (String localAddress : localAddresses) { for (String localAddress : localAddresses) {