mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixes #1536
This commit is contained in:
parent
0b6d2d3dd6
commit
a0640a1e66
@ -13,6 +13,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
@ -123,15 +124,17 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
|||||||
HttpURLConnection connection =
|
HttpURLConnection connection =
|
||||||
(HttpURLConnection) new URL(SQLUUIDHandler.this.PROFILE_URL + uuid.toString().replace("-", ""))
|
(HttpURLConnection) new URL(SQLUUIDHandler.this.PROFILE_URL + uuid.toString().replace("-", ""))
|
||||||
.openConnection();
|
.openConnection();
|
||||||
InputStreamReader reader = new InputStreamReader(connection.getInputStream());
|
try (InputStream con = connection.getInputStream()) {
|
||||||
|
InputStreamReader reader = new InputStreamReader(con);
|
||||||
JSONObject response = (JSONObject) SQLUUIDHandler.this.jsonParser.parse(reader);
|
JSONObject response = (JSONObject) SQLUUIDHandler.this.jsonParser.parse(reader);
|
||||||
String name = (String) response.get("name");
|
String name = (String) response.get("name");
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
add(new StringWrapper(name), uuid);
|
add(new StringWrapper(name), uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (IOException | ParseException e) {
|
} catch (IOException | ParseException e) {
|
||||||
e.printStackTrace();
|
PS.debug("Invalid response from Mojang: Some UUIDs will be cached later. (`unknown` until then or player joins)");
|
||||||
}
|
}
|
||||||
TaskManager.runTaskLaterAsync(this, SQLUUIDHandler.this.INTERVAL);
|
TaskManager.runTaskLaterAsync(this, SQLUUIDHandler.this.INTERVAL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user