Fix load order with late-bind enabled

Fixes #362
This commit is contained in:
KennyTV 2021-06-03 11:05:51 +02:00
parent 08f6c0b1f1
commit 3d3c1a0430
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 14 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import com.viaversion.viabackwards.api.ViaBackwardsPlatform;
import com.viaversion.viabackwards.listener.FireDamageListener;
import com.viaversion.viabackwards.listener.FireExtinguishListener;
import com.viaversion.viabackwards.listener.LecternInteractListener;
import com.viaversion.viaversion.ViaVersionPlugin;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.bukkit.platform.BukkitViaLoader;
@ -29,8 +30,21 @@ import org.bukkit.plugin.java.JavaPlugin;
public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform {
@Override
public void onLoad() {
if (!ViaVersionPlugin.getInstance().isLateBind()) {
init();
}
}
@Override
public void onEnable() {
if (ViaVersionPlugin.getInstance().isLateBind()) {
init();
}
}
private void init() {
init(getDataFolder());
Via.getPlatform().runSync(this::onServerLoaded);
}

View File

@ -7,5 +7,4 @@ api-version: 1.13
authors: [Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1]
website: ${url}
load: STARTUP
depend: [ViaVersion]

View File

@ -73,7 +73,6 @@ public interface ViaBackwardsPlatform {
getLogger().info("Loading translations...");
TranslatableRewriter.loadTranslatables();
getLogger().info("Registering protocols...");
ProtocolManager protocolManager = Via.getManager().getProtocolManager();
protocolManager.registerProtocol(new Protocol1_9_4To1_10(), ProtocolVersion.v1_9_3, ProtocolVersion.v1_10);