From 29908523b08d2fedd899b5b2c940bdb709e1266c Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sat, 25 Apr 2020 13:30:26 +0200 Subject: [PATCH] Async mapping loader change --- .../nl/matsv/viabackwards/api/BackwardsProtocol.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/api/BackwardsProtocol.java b/core/src/main/java/nl/matsv/viabackwards/api/BackwardsProtocol.java index bca22a29..46140d09 100644 --- a/core/src/main/java/nl/matsv/viabackwards/api/BackwardsProtocol.java +++ b/core/src/main/java/nl/matsv/viabackwards/api/BackwardsProtocol.java @@ -15,8 +15,6 @@ import us.myles.ViaVersion.api.protocol.ProtocolRegistry; import us.myles.ViaVersion.api.remapper.PacketRemapper; import us.myles.ViaVersion.packets.State; -import java.util.concurrent.CompletableFuture; - public abstract class BackwardsProtocol extends Protocol { protected BackwardsProtocol() { @@ -46,13 +44,6 @@ public abstract class BackwardsProtocol extends Protocol { * Waits for the given protocol to be loaded to then asynchronously execute the runnable for this protocol. */ protected void executeAsyncAfterLoaded(Class protocolClass, Runnable runnable) { - CompletableFuture future = ProtocolRegistry.getMappingLoaderFuture(protocolClass); - if (future == null) { - runnable.run(); - return; - } - - // If the protocol to depend on has been loaded, execute the new runnable async and schedule it for necessary completion - future.whenComplete((v, t) -> ProtocolRegistry.addMappingLoaderFuture(getClass(), runnable)); + ProtocolRegistry.addMappingLoaderFuture(getClass(), protocolClass, runnable); } }