Skip to content

Commit

Permalink
feat: folia support
Browse files Browse the repository at this point in the history
  • Loading branch information
ProdPreva1l committed Mar 10, 2025
1 parent 085d419 commit ed26ed2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ allprojects {
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://repo.clojars.org/")
maven(url = "https://repo.papermc.io/repository/maven-public/")
if (currentBranch != "master") configureFinallyADecentRepository(dev = true)
configureFinallyADecentRepository()
Expand All @@ -27,6 +28,8 @@ allprojects {
dependencies {
compileOnly("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT")

implementation("com.github.puregero:multilib:1.2.4")

testImplementation("com.github.seeseemelk:MockBukkit-v1.19:3.1.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.11.4")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.11.4")
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/info/preva1l/hooker/Hooker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package info.preva1l.hooker;

import com.github.puregero.multilib.MultiLib;
import info.preva1l.hooker.annotation.*;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -124,9 +125,9 @@ public static void enable() {
int count = instance.loadHooks(instance.onEnableHooks);
instance.owningPlugin.getLogger().info("Loaded " + count + " hooks!");

Bukkit.getScheduler().runTaskLater(
MultiLib.getGlobalRegionScheduler().runDelayed(
instance.owningPlugin,
() -> {
t -> {
instance.owningPlugin.getLogger().info("Loading late hooks...");
int count2 = instance.loadHooks(instance.lateHooks);
instance.owningPlugin.getLogger().info("Loaded " + count2 + " hooks!");
Expand Down Expand Up @@ -165,15 +166,15 @@ private void reloadHooks() {
if (reloadable == null) continue;
method.setAccessible(true);
if (reloadable.async()) {
Bukkit.getScheduler().runTaskAsynchronously(owningPlugin, () -> {
MultiLib.getAsyncScheduler().runNow(owningPlugin, t -> {
try {
method.invoke(hook);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
});
} else {
Bukkit.getScheduler().runTask(owningPlugin, () -> {
MultiLib.getGlobalRegionScheduler().run(owningPlugin, t -> {
try {
method.invoke(hook);
} catch (IllegalAccessException | InvocationTargetException e) {
Expand Down

0 comments on commit ed26ed2

Please sign in to comment.