From a984da5f5fa305aa55b56e78362228bfc558991c Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Mon, 14 Jun 2021 08:54:44 +0400 Subject: [PATCH] added static getting for skript reflect usage in a safe way than static value. --- .../main/java/net/limework/rediskript/RediSkript.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java b/RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java index fee04d3..b24c2e4 100644 --- a/RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java +++ b/RediSkript-bukkit/src/main/java/net/limework/rediskript/RediSkript.java @@ -6,10 +6,12 @@ import ch.njol.skript.lang.ExpressionType; import ch.njol.skript.registrations.EventValues; import ch.njol.skript.util.Date; import ch.njol.skript.util.Getter; +import com.sun.tools.javac.tree.JCTree; import net.limework.rediskript.commands.CommandReloadRedis; import net.limework.rediskript.events.RedisMessageEvent; import net.limework.rediskript.managers.RedisController; import net.limework.rediskript.skript.elements.*; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.plugin.java.JavaPlugin; @@ -89,4 +91,11 @@ public class RediSkript extends JavaPlugin { public RedisController getRC() { return redisController; } + + //Developer note: This is use for skript-reflect! DO NOT USE WITHIN THE PLUGIN! use depend injection with constructors + public static RediSkript getAPI(){ + //this safer than making static. + return (RediSkript) Bukkit.getServer().getPluginManager().getPlugin("RediSkript-bukkit"); + } + } \ No newline at end of file