From b6463c70e7c345395a53bf4a3bde8331d26a796e Mon Sep 17 00:00:00 2001 From: Moderocky Date: Mon, 15 Apr 2024 18:29:26 +0100 Subject: [PATCH] Make connected pattern paper-only. (#6573) * Make connected pattern paper-only. * Add required papermc for connected. --- src/main/java/ch/njol/skript/conditions/CondIsOnline.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/njol/skript/conditions/CondIsOnline.java b/src/main/java/ch/njol/skript/conditions/CondIsOnline.java index a783a3eca64..6f3f22e40c5 100644 --- a/src/main/java/ch/njol/skript/conditions/CondIsOnline.java +++ b/src/main/java/ch/njol/skript/conditions/CondIsOnline.java @@ -18,6 +18,7 @@ */ package ch.njol.skript.conditions; +import ch.njol.skript.Skript; import org.bukkit.OfflinePlayer; import ch.njol.skript.conditions.base.PropertyCondition; @@ -25,6 +26,7 @@ import ch.njol.skript.doc.Examples; import ch.njol.skript.doc.Name; import ch.njol.skript.doc.Since; +import ch.njol.skript.doc.RequiredPlugins; import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser.ParseResult; import ch.njol.util.Kleenean; @@ -45,10 +47,14 @@ "\twait 1 tick" }) @Since("1.4") +@RequiredPlugins("Paper 1.20+ (Connected)") public class CondIsOnline extends PropertyCondition { static { - register(CondIsOnline.class, "(online|:offline|:connected)", "offlineplayers"); + if (Skript.methodExists(OfflinePlayer.class, "isConnected")) + register(CondIsOnline.class, "(online|:offline|:connected)", "offlineplayers"); + else + register(CondIsOnline.class, "(online|:offline)", "offlineplayers"); } private boolean connected; // https://github.com/SkriptLang/Skript/issues/6100