fix worldguard hook failing to initialize

This commit is contained in:
2024-10-28 19:52:35 +01:00
parent ee3526c55d
commit 6a5e5f8d44
3 changed files with 9 additions and 4 deletions
@@ -15,17 +15,19 @@ import com.sk89q.worldguard.protection.regions.RegionQuery;
import me.youhavetrouble.preventstabby.PreventStabby;
import org.bukkit.entity.Player;
import java.util.logging.Logger;
public class WorldGuardHook {
private static FlagRegistry flagRegistry;
public static StateFlag FORCE_PVP_FLAG;
public static void init() {
public static void init(Logger logger) {
try {
Class.forName("com.sk89q.worldguard.protection.flags.registry.FlagRegistry");
WorldGuardPlugin worldGuardPlugin = WorldGuardPlugin.inst();
if (WorldGuard.getInstance() == null || worldGuardPlugin == null) return;
PreventStabby.getPlugin().getLogger().info("[PreventStabby] Hooking into WorldGuard");
logger.info("Hooking into WorldGuard");
flagRegistry = WorldGuard.getInstance().getFlagRegistry();
createForcePvpFlag();
} catch (NoClassDefFoundError | ClassNotFoundException ignored) {