Close the command scanner once stopped

This commit is contained in:
themode 2020-11-07 22:58:19 +01:00
parent 224626bdbd
commit a574c1fe2a
3 changed files with 4 additions and 1 deletions

View File

@ -61,6 +61,7 @@ public final class CommandManager {
execute(consoleSender, command);
}
}
scanner.close();
}, "ConsoleCommand-Thread");
consoleThread.setDaemon(true);
consoleThread.start();

View File

@ -21,7 +21,7 @@ public class DataImpl implements Data {
protected final ConcurrentHashMap<String, Class> dataType = new ConcurrentHashMap<>();
@Override
public <T> void set(@NotNull String key, @Nullable T value, @Nullable Class<T> type) {
public synchronized <T> void set(@NotNull String key, @Nullable T value, @Nullable Class<T> type) {
if (value != null) {
this.data.put(key, value);
this.dataType.put(key, type);

View File

@ -86,9 +86,11 @@ public class PlayerSkin {
final String url = "https://api.mojang.com/users/profiles/minecraft/" + username;
try {
// Retrieve the mojang uuid from the name
final String response = URLUtils.getText(url);
final JsonObject jsonObject = JsonParser.parseString(response).getAsJsonObject();
final String uuid = jsonObject.get("id").getAsString();
// Retrieve the skin data from the mojang uuid
return fromUuid(uuid);
} catch (IOException e) {
e.printStackTrace();