From 4293289468a6840001ece99fb4285ba5215f9bbc Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 10 Mar 2023 12:19:22 +0100 Subject: [PATCH] Support Folia (leaf's region threaded Minecraft server) --- .../viaversion/viabackwards/BukkitPlugin.java | 23 ++----------------- bukkit/src/main/resources/plugin.yml | 1 + 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java b/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java index c0c0955d..9ebbb6a6 100644 --- a/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java +++ b/bukkit/src/main/java/com/viaversion/viabackwards/BukkitPlugin.java @@ -19,13 +19,11 @@ package com.viaversion.viabackwards; import com.viaversion.viabackwards.api.ViaBackwardsPlatform; -import com.viaversion.viabackwards.listener.PlayerItemDropListener; 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.viabackwards.listener.PlayerItemDropListener; import com.viaversion.viaversion.api.Via; -import com.viaversion.viaversion.api.data.MappingDataLoader; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.bukkit.platform.BukkitViaLoader; import org.bukkit.plugin.java.JavaPlugin; @@ -33,28 +31,11 @@ import org.bukkit.plugin.java.JavaPlugin; public class BukkitPlugin extends JavaPlugin implements ViaBackwardsPlatform { public BukkitPlugin() { - } - - @Override - public void onLoad() { - if (!ViaVersionPlugin.getInstance().isLateBind()) { - init(); - } + Via.getManager().addEnableListener(() -> init(getDataFolder())); } @Override public void onEnable() { - if (ViaVersionPlugin.getInstance().isLateBind()) { - init(); - } - } - - private void init() { - init(getDataFolder()); - Via.getPlatform().runSync(this::onServerLoaded); - } - - private void onServerLoaded() { BukkitViaLoader loader = (BukkitViaLoader) Via.getManager().getLoader(); int protocolVersion = Via.getAPI().getServerVersion().highestSupportedVersion(); if (protocolVersion >= ProtocolVersion.v1_17.getVersion()) { diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 2f3554e6..5c6bcd26 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -3,6 +3,7 @@ version: ${version} description: Allow older Minecraft versions to connect to a newer server version. main: com.viaversion.viabackwards.BukkitPlugin api-version: 1.13 +folia-supported: true authors: [Matsv, kennytv, Gerrygames, creeper123123321, ForceUpdate1] website: ${url}