9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-19 14:59:19 +00:00

feat: Cloud commands & Folia support

This commit is contained in:
SamB440
2023-03-31 14:45:42 +01:00
parent 48bc0f6a43
commit 7a2a06a74d
34 changed files with 936 additions and 357 deletions

View File

@@ -9,6 +9,7 @@ dependencies {
testImplementation("com.github.seeseemelk:MockBukkit-v1.17:1.13.0")
testImplementation("org.reflections:reflections:0.10.2")
compileOnly("org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("io.papermc:paperlib:1.0.4") // we include paperlib and relocate elsewhere
compileOnly("com.github.MilkBowl:VaultAPI:1.7") // vault
compileOnly("me.clip:placeholderapi:2.10.4") // PAPI

View File

@@ -2,6 +2,7 @@ package net.islandearth.rpgregions.api;
import com.convallyria.languagy.api.language.Translator;
import com.google.gson.Gson;
import net.islandearth.rpgregions.api.schedule.PlatformScheduler;
import net.islandearth.rpgregions.managers.IRPGRegionsManagers;
import org.bukkit.configuration.Configuration;
@@ -29,4 +30,10 @@ public interface IRPGRegionsAPI {
void debug(String debug);
boolean hasHeadDatabase();
/**
* Gets the scheduler used for the current platform.
* @return the scheduler for this server platform
*/
PlatformScheduler<? extends IRPGRegionsAPI> getScheduler();
}

View File

@@ -0,0 +1,30 @@
package net.islandearth.rpgregions.api.schedule;
import net.islandearth.rpgregions.api.IRPGRegionsAPI;
import org.bukkit.entity.Entity;
public abstract class PlatformScheduler<T extends IRPGRegionsAPI> {
protected final T api;
public PlatformScheduler(T api) {
this.api = api;
}
public abstract void executeOnMain(Runnable runnable);
public abstract void executeOnEntity(Entity entity, Runnable runnable);
public abstract RPGRegionsTask executeRepeating(Runnable runnable, long delay, long period);
public abstract void executeDelayed(Runnable runnable, long delay);
public abstract void executeAsync(Runnable runnable);
public abstract void registerInitTask(Runnable runnable);
@FunctionalInterface
public interface RPGRegionsTask {
void cancel();
}
}