3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Use CompletableFuture.runAsync

Dieser Commit ist enthalten in:
KennyTV 2020-03-23 11:53:04 +01:00
Ursprung 757654aa9d
Commit 248fd92f6e

Datei anzeigen

@ -127,16 +127,8 @@ public class ProtocolRegistry {
if (protocol.hasMappingDataToLoad()) {
if (mappingLoaderExecutor != null) {
// Submit mapping data loading
CompletableFuture<Void> future = new CompletableFuture<>();
CompletableFuture<Void> future = CompletableFuture.runAsync(protocol::loadMappingData, mappingLoaderExecutor);
mappingLoaderFutures.put(protocol.getClass(), future);
mappingLoaderExecutor.execute(() -> {
try {
protocol.loadMappingData();
} catch (Exception e) {
e.printStackTrace();
}
future.complete(null);
});
} else {
// Late protocol adding - just do it on the current thread
protocol.loadMappingData();