9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2026-01-03 22:16:18 +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

@@ -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();
}
}