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:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user