mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-24 00:56:38 +00:00
Remove folialib
This commit is contained in:
@@ -84,8 +84,8 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runPossiblyUnsafeTask(@NotNull Runnable task) {
|
||||
plugin.getFoliaLib().getImpl().runAsync(task);
|
||||
public void runPossiblyUnsafeTask(@NotNull Runnable runnable) {
|
||||
plugin.getGlobalRegionScheduler().run(plugin, task -> runnable.run());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,8 @@ import cloud.commandframework.brigadier.CloudBrigadierManager;
|
||||
import cloud.commandframework.bukkit.CloudBukkitCapabilities;
|
||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
import cloud.commandframework.paper.PaperCommandManager;
|
||||
import com.tcoded.folialib.FoliaLib;
|
||||
import io.papermc.paper.threadedregions.scheduler.AsyncScheduler;
|
||||
import io.papermc.paper.threadedregions.scheduler.GlobalRegionScheduler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@@ -32,6 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.dfsek.terra.api.command.CommandSender;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
@@ -51,7 +53,9 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
private final PlatformImpl platform = new PlatformImpl(this);
|
||||
private final Map<String, com.dfsek.terra.api.world.chunk.generation.ChunkGenerator> generatorMap = new HashMap<>();
|
||||
|
||||
private final FoliaLib foliaLib = new FoliaLib(this);
|
||||
private AsyncScheduler asyncScheduler = this.getServer().getAsyncScheduler();
|
||||
|
||||
private GlobalRegionScheduler globalRegionScheduler = this.getServer().getGlobalRegionScheduler();
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -159,7 +163,7 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
""".strip());
|
||||
};
|
||||
runnable.run();
|
||||
foliaLib.getImpl().runLaterAsync(runnable, 200L);
|
||||
asyncScheduler.runDelayed(this, task -> runnable.run(), 200L, TimeUnit.SECONDS);
|
||||
// Bukkit.shutdown(); // we're not *that* evil
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return false;
|
||||
@@ -187,7 +191,11 @@ public class TerraBukkitPlugin extends JavaPlugin {
|
||||
}), platform.getRawConfigRegistry().getByID(id).orElseThrow(), platform.getWorldHandle().air());
|
||||
}
|
||||
|
||||
public FoliaLib getFoliaLib() {
|
||||
return foliaLib;
|
||||
public AsyncScheduler getAsyncScheduler() {
|
||||
return asyncScheduler;
|
||||
}
|
||||
|
||||
public GlobalRegionScheduler getGlobalRegionScheduler() {
|
||||
return globalRegionScheduler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.dfsek.terra.bukkit.util;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.dfsek.terra.bukkit.TerraBukkitPlugin;
|
||||
|
||||
import static io.papermc.lib.PaperLib.suggestPaper;
|
||||
@@ -26,10 +28,10 @@ import static io.papermc.lib.PaperLib.suggestPaper;
|
||||
|
||||
public final class PaperUtil {
|
||||
public static void checkPaper(TerraBukkitPlugin plugin) {
|
||||
plugin.getFoliaLib().getImpl().runLaterAsync(() -> {
|
||||
plugin.getAsyncScheduler().runDelayed(plugin, task -> {
|
||||
if(!PaperLib.isPaper()) {
|
||||
suggestPaper(plugin);
|
||||
}
|
||||
}, 100L);
|
||||
}, 100L, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user