fancydialogs: Validate Minecraft server version and disable plugin if unsupported

This commit is contained in:
Oliver
2025-06-02 09:28:54 +02:00
committed by Oliver
parent a9b3399389
commit fee90d32a9

View File

@@ -17,6 +17,7 @@ import de.oliver.fancylib.serverSoftware.ServerSoftware;
import de.oliver.fancylib.translations.Language;
import de.oliver.fancylib.translations.TextConfig;
import de.oliver.fancylib.translations.Translator;
import de.oliver.fancysitula.api.utils.ServerVersion;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import revxrsal.commands.Lamp;
@@ -105,6 +106,19 @@ public class FancyDialogsPlugin extends JavaPlugin {
""");
}
String version = Bukkit.getMinecraftVersion();
if (ServerVersion.getByVersion(version).getProtocolVersion() < 771) {
fancyLogger.error("""
--------------------------------------------------
FancyDialogs requires Minecraft version 1.21.6 or higher.
Your server is running version %s, which is not supported.
Please update your server to the latest version.
--------------------------------------------------
""".formatted(version));
Bukkit.getPluginManager().disablePlugin(this);
return;
}
registerListeners();
Lamp<BukkitCommandActor> lamp = BukkitLamp