Increase section reload delay

This commit is contained in:
s809
2024-06-01 19:49:23 +05:00
parent e08faa7943
commit 24a2a48deb
3 changed files with 9 additions and 15 deletions
@@ -86,7 +86,7 @@ public class ClientApi
private long lastFlushNanoTime = 0;
private ClientPluginChannelApi pluginChannelApi = new ClientPluginChannelApi(this::clientLevelLoadEvent, this::clientLevelUnloadEvent);
private final ClientPluginChannelApi pluginChannelApi = new ClientPluginChannelApi(this::clientLevelLoadEvent, this::clientLevelUnloadEvent);
/** Holds any levels that were loaded before the {@link ClientApi#onClientOnlyConnected} was fired. */
@@ -155,9 +155,6 @@ public class ClientApi
SharedApi.setDhWorld(null);
}
// clear the previous server's information
this.pluginChannelApi = new ClientPluginChannelApi(this::clientLevelLoadEvent, this::clientLevelUnloadEvent);
// remove any waiting items
this.waitingChunkByClientLevelAndPos.clear();
this.waitingClientLevels.clear();
@@ -16,7 +16,10 @@ import org.apache.logging.log4j.LogManager;
import java.util.function.Consumer;
/** This class is used to manage the plugin channel session and Multiverse level keys. */
/**
* This class is used to manage the level keys.
* Its purpose is to separate MC's and plugin channel's event handling.
*/
public class ClientPluginChannelApi
{
private static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(),
@@ -60,6 +60,8 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
private final SupplierBasedRateLimiter<Void> rateLimiter = new SupplierBasedRateLimiter<>(this::getRequestConcurrencyLimit);
private final ScheduledExecutorService taskFinishScheduler = Executors.newScheduledThreadPool(1);
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
protected boolean showInDebug() { return true; }
@@ -235,17 +237,9 @@ public abstract class AbstractFullDataRequestQueue implements IDebugRenderable,
// Hack to work around a race condition
// If you finish the request too quickly, the section will never render
new Thread(() -> {
try
{
Thread.sleep(5000);
this.taskFinishScheduler.schedule(() -> {
entry.future.complete(true);
}
catch (InterruptedException e)
{
throw new RuntimeException(e);
}
}).start();
}, 10, TimeUnit.SECONDS);
return null;
});
}