try to fix #53

This commit is contained in:
creeper123123321 2020-09-15 19:01:40 -03:00
parent cca25be859
commit 29630db0f9
2 changed files with 6 additions and 1 deletions

View File

@ -20,7 +20,7 @@ val branch = if (!travisBranch.isNullOrBlank()) travisBranch else try {
"unknown"
}
version = "0.2.11-SNAPSHOT+" + try {
version = "0.2.12-SNAPSHOT+" + try {
gitVersion() + "-" + branch
} catch (e: Exception) {
"unknown"

View File

@ -50,6 +50,7 @@ import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.MappingDataLoader;
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
@ -59,12 +60,14 @@ public class ViaFabric implements ModInitializer {
public static final Logger JLOGGER = new JLoggerToLog4j(LogManager.getLogger("ViaFabric"));
public static final ExecutorService ASYNC_EXECUTOR;
public static final EventLoop EVENT_LOOP;
public static CompletableFuture<Void> INIT_FUTURE = new CompletableFuture<>();
public static VRConfig config;
static {
ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ViaFabric-%d").build();
ASYNC_EXECUTOR = Executors.newFixedThreadPool(8, factory);
EVENT_LOOP = new DefaultEventLoop(factory);
EVENT_LOOP.submit(INIT_FUTURE::join); // https://github.com/ViaVersion/ViaFabric/issues/53 ugly workaround code but works tm
}
public static String getVersion() {
@ -112,6 +115,8 @@ public class ViaFabric implements ModInitializer {
config = new VRConfig(FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaFabric")
.resolve("viafabric.yml").toFile());
INIT_FUTURE.complete(null);
}
private void registerCommandsV1() {