Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-09 17:50:23 +01:00
Don't expose executor and future map
Dieser Commit ist enthalten in:
Ursprung
248fd92f6e
Commit
563c5f830d
@ -127,8 +127,7 @@ 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 = CompletableFuture.runAsync(protocol::loadMappingData, mappingLoaderExecutor);
|
addMappingLoaderFuture(protocol.getClass(), protocol::loadMappingData);
|
||||||
mappingLoaderFutures.put(protocol.getClass(), future);
|
|
||||||
} 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();
|
||||||
@ -330,15 +329,12 @@ public class ProtocolRegistry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addMappingLoaderFuture(Class<? extends Protocol> protocolClass, Runnable runnable) {
|
||||||
|
CompletableFuture<Void> future = CompletableFuture.runAsync(runnable, mappingLoaderExecutor);
|
||||||
|
mappingLoaderFutures.put(protocolClass, future);
|
||||||
|
}
|
||||||
|
|
||||||
public static CompletableFuture<Void> getMappingLoaderFuture(Class<? extends Protocol> protocolClass) {
|
public static CompletableFuture<Void> getMappingLoaderFuture(Class<? extends Protocol> protocolClass) {
|
||||||
return mappingLoaderFutures.get(protocolClass);
|
return mappingLoaderFutures.get(protocolClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Class<? extends Protocol>, CompletableFuture<Void>> getMappingLoaderFutures() {
|
|
||||||
return mappingLoaderFutures;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ThreadPoolExecutor getMappingLoaderExecutor() {
|
|
||||||
return mappingLoaderExecutor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren