From aa5ccb906384b26243edfced56ab9315cbd9fe52 Mon Sep 17 00:00:00 2001 From: Florian Stober Date: Sun, 5 Nov 2023 20:15:46 +0100 Subject: [PATCH] check minimum required BungeeCord version --- .../bungeetablistplus/BungeeTabListPlus.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bungee/src/main/java/codecrafter47/bungeetablistplus/BungeeTabListPlus.java b/bungee/src/main/java/codecrafter47/bungeetablistplus/BungeeTabListPlus.java index 0a245fa5..7b8d6a52 100644 --- a/bungee/src/main/java/codecrafter47/bungeetablistplus/BungeeTabListPlus.java +++ b/bungee/src/main/java/codecrafter47/bungeetablistplus/BungeeTabListPlus.java @@ -66,8 +66,10 @@ import lombok.val; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.connection.Connection; import net.md_5.bungee.api.plugin.Plugin; +import net.md_5.bungee.protocol.packet.PlayerListHeaderFooter; import org.bstats.bungeecord.Metrics; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; @@ -185,19 +187,25 @@ public void onLoad() { try { Class.forName("net.md_5.bungee.api.Title"); } catch (ClassNotFoundException ex) { - throw new RuntimeException("You need to run at least BungeeCord version #1671"); + throw new RuntimeException("You need to run at least BungeeCord version #1760"); } try { Connection.class.getMethod("isConnected"); } catch (NoSuchMethodException ex) { - throw new RuntimeException("You need to run at least BungeeCord version #1671"); + throw new RuntimeException("You need to run at least BungeeCord version #1760"); } try { Class.forName("net.md_5.bungee.protocol.packet.PlayerListItemUpdate"); } catch (ClassNotFoundException ex) { - throw new RuntimeException("You need to run at least BungeeCord version #1671"); + throw new RuntimeException("You need to run at least BungeeCord version #1760"); + } + + try { + PlayerListHeaderFooter.class.getMethod("setHeader", BaseComponent.class); + } catch (NoSuchMethodException ex) { + throw new RuntimeException("You need to run at least BungeeCord version #1760"); } INSTANCE = this;