Delay version detection when using legacy injector

This commit is contained in:
Nassim Jahnke 2023-03-10 14:29:54 +01:00
parent 4293289468
commit fc565f8cd5
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -36,6 +36,15 @@ public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
@Override
public void onEnable() {
if (Via.getManager().getInjector().lateProtocolVersionSetting()) {
// Enable in the next tick
Via.getPlatform().runSync(this::enable);
} else {
enable();
}
}
private void enable() {
BukkitViaLoader loader = (BukkitViaLoader) Via.getManager().getLoader();
int protocolVersion = Via.getAPI().getServerVersion().highestSupportedVersion();
if (protocolVersion >= ProtocolVersion.v1_17.getVersion()) {