Support Folia (leaf's region threaded Minecraft server)

This commit is contained in:
Nassim Jahnke 2023-03-10 12:19:22 +01:00
parent f7acb7ce91
commit 4293289468
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 3 additions and 21 deletions

View File

@ -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()) {

View File

@ -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}