3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 17:10:13 +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 (protocol.hasMappingDataToLoad()) {
if (mappingLoaderExecutor != null) { if (mappingLoaderExecutor != null) {
// Submit mapping data loading // Submit mapping data loading
CompletableFuture<Void> future = new CompletableFuture<>(); CompletableFuture<Void> future = CompletableFuture.runAsync(protocol::loadMappingData, mappingLoaderExecutor);
mappingLoaderFutures.put(protocol.getClass(), future); mappingLoaderFutures.put(protocol.getClass(), future);
mappingLoaderExecutor.execute(() -> {
try {
protocol.loadMappingData();
} catch (Exception e) {
e.printStackTrace();
}
future.complete(null);
});
} else { } else {
// Late protocol adding - just do it on the current thread // Late protocol adding - just do it on the current thread
protocol.loadMappingData(); protocol.loadMappingData();