mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Use CompletableFuture.runAsync
This commit is contained in:
parent
757654aa9d
commit
248fd92f6e
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user