mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
Remove folialib
This commit is contained in:
@@ -49,12 +49,12 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val paper = "1.18.2-R0.1-20220920.010157-167"
|
||||
const val paperBuild = "1.20.2-R0.1-20231203.034718"
|
||||
const val paper = "$paperBuild-122"
|
||||
const val paperLib = "1.0.8"
|
||||
const val foliaLib = "0.2.5"
|
||||
const val minecraft = "1.20.2"
|
||||
const val reflectionRemapper = "0.1.0"
|
||||
const val paperDevBundle = "1.20.2-R0.1-20231203.034718-121"
|
||||
const val paperDevBundle = "$paperBuild-121"
|
||||
const val runPaper = "2.2.2"
|
||||
const val paperWeight = "1.5.10"
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ dependencies {
|
||||
tasks {
|
||||
shadowJar {
|
||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
||||
relocate("com.tcoded.folialib", "com.dfsek.terra.lib.folialib")
|
||||
relocate("com.google.common", "com.dfsek.terra.lib.google.common")
|
||||
relocate("org.apache.logging.slf4j", "com.dfsek.terra.lib.slf4j-over-log4j")
|
||||
exclude("org/slf4j/**")
|
||||
|
||||
@@ -8,9 +8,7 @@ dependencies {
|
||||
compileOnly("io.papermc.paper", "paper-api", Versions.Bukkit.paper)
|
||||
|
||||
shadedApi("io.papermc", "paperlib", Versions.Bukkit.paperLib)
|
||||
// TODO: 2023-11-08 When we drop support for 1.18 and 1.19, we can remove FoliaLib and instead use `RegionScheduler`,
|
||||
// AsyncScheduler, or GlobalRegionScheduler.
|
||||
shadedApi("com.tcoded", "FoliaLib", Versions.Bukkit.foliaLib)
|
||||
|
||||
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
|
||||
|
||||
shadedApi("cloud.commandframework", "cloud-paper", Versions.Libraries.cloud)
|
||||
|
||||
@@ -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