Merge pull request #1 from Folia-Inquisitors/Master-Folia-Third-Revision
Updated FoliaLib dependency. Fixed ProcessPlayerEvent scheduler in Wo…
This commit is contained in:
commit
6edbb60e00
|
@ -38,9 +38,12 @@ Please read CONTRIBUTING.md for important guidelines to follow.
|
|||
Submissions must be licensed under the GNU Lesser General Public License v3.
|
||||
|
||||
# Folia Inquisitors
|
||||
This Folia support is maintained by the following organizations and people:
|
||||
|
||||
[<img src="https://github.com/Folia-Inquisitors.png" width=80 alt="Folia-Inquisitors">](https://github.com/orgs/Folia-Inquisitors/repositories)
|
||||
[<img src="https://github.com/TechnicallyCoded.png" width=80 alt="TechnicallyCoded">](https://github.com/TechnicallyCoded)
|
||||
[<img src="https://github.com/Yomamaeatstoes.png" width=80 alt="Yomamaeatstoes">](https://github.com/Yomamaeatstoes)
|
||||
[<img src="https://github.com/Loving11ish.png" width=80 alt="Loving11ish">](https://github.com/Loving11ish)
|
||||
|
||||
Links
|
||||
-----
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
group=com.sk89q.worldguard
|
||||
version=7.1.0-SNAPSHOT-Custom-Folia
|
||||
version=7.1.0-SNAPSHOT
|
||||
|
|
|
@ -24,13 +24,13 @@ configurations {
|
|||
|
||||
dependencies {
|
||||
"api"(project(":worldguard-core"))
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.20-R0.1-SNAPSHOT")
|
||||
"runtimeOnly"("org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT") {
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
|
||||
"runtimeOnly"("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
|
||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
||||
"implementation"("com.tcoded:FoliaLib:0.2.3")
|
||||
"implementation"("com.tcoded:FoliaLib:0.3.1")
|
||||
"compileOnly"("com.sk89q:commandbook:2.3") { isTransitive = false }
|
||||
"shadeOnly"("io.papermc:paperlib:1.0.8")
|
||||
"shadeOnly"("org.bstats:bstats-bukkit:3.0.1")
|
||||
|
|
|
@ -96,7 +96,7 @@ public class BukkitRegionContainer extends RegionContainer {
|
|||
}, plugin);
|
||||
|
||||
int interval = CACHE_INVALIDATION_INTERVAL * 50;
|
||||
plugin.foliaLib.getImpl().runTimerAsync(cache::invalidateAll, interval, interval, TimeUnit.MILLISECONDS);
|
||||
plugin.getFoliaLib().getImpl().runTimerAsync(cache::invalidateAll, interval, interval, TimeUnit.MILLISECONDS);
|
||||
|
||||
// Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, cache::invalidateAll, CACHE_INVALIDATION_INTERVAL, CACHE_INVALIDATION_INTERVAL);
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
private static final int BSTATS_PLUGIN_ID = 3283;
|
||||
|
||||
|
||||
public FoliaLib foliaLib;
|
||||
private FoliaLib foliaLib;
|
||||
|
||||
/**
|
||||
* Construct objects. Actual loading occurs when the plugin is enabled, so
|
||||
|
@ -174,7 +174,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
}
|
||||
|
||||
int runDelayMs = BukkitSessionManager.RUN_DELAY * 50;
|
||||
foliaLib.getImpl().runTimer(sessionManager, runDelayMs, runDelayMs, TimeUnit.MILLISECONDS);
|
||||
foliaLib.getImpl().runTimerAsync(sessionManager, runDelayMs, runDelayMs, TimeUnit.MILLISECONDS);
|
||||
// getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
|
||||
|
||||
// Register events
|
||||
|
@ -216,25 +216,28 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
}
|
||||
worldListener.registerEvents();
|
||||
|
||||
if (foliaLib.isFolia()) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
foliaLib.getImpl().runAtEntity(player, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||
Events.fire(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
Bukkit.getScheduler().runTask(this, () -> {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||
Events.fire(event);
|
||||
}
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
foliaLib.getImpl().runAtEntity(player, (task) -> {
|
||||
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||
Events.fire(event);
|
||||
});
|
||||
}
|
||||
// if (foliaLib.isFolia()) {
|
||||
// for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
// foliaLib.getImpl().runAtEntity(player, (task) -> {
|
||||
// ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||
// Events.fire(event);
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// Bukkit.getScheduler().runTask(this, () -> {
|
||||
// for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
// ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||
// Events.fire(event);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
((SimpleFlagRegistry) WorldGuard.getInstance().getFlagRegistry()).setInitialized(true);
|
||||
((SimpleDomainRegistry) WorldGuard.getInstance().getDomainRegistry()).setInitialized(true);
|
||||
|
@ -290,7 +293,9 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
@Override
|
||||
public void onDisable() {
|
||||
WorldGuard.getInstance().disable();
|
||||
// this.getServer().getScheduler().cancelTasks(this);
|
||||
if (!foliaLib.isFolia()) {
|
||||
this.getServer().getScheduler().cancelTasks(this);
|
||||
}
|
||||
foliaLib.getImpl().cancelAllTasks();
|
||||
}
|
||||
|
||||
|
@ -551,4 +556,7 @@ public class WorldGuardPlugin extends JavaPlugin {
|
|||
return playerMoveListener;
|
||||
}
|
||||
|
||||
public FoliaLib getFoliaLib() {
|
||||
return foliaLib;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ public class EventAbstractionListener extends AbstractListener {
|
|||
Hopper hopperCauseHolder = (Hopper) causeHolder;
|
||||
Location location = hopperCauseHolder.getLocation();
|
||||
|
||||
getPlugin().foliaLib.getImpl().runAtLocationLater(location, () -> {
|
||||
getPlugin().getFoliaLib().getImpl().runAtLocationLater(location, () -> {
|
||||
Block block = location.getBlock();
|
||||
if (block.getType() == Material.HOPPER) {
|
||||
block.breakNaturally();
|
||||
|
|
|
@ -133,7 +133,7 @@ public class PlayerMoveListener extends AbstractListener {
|
|||
|
||||
player.teleport(override.clone().add(0, 1, 0));
|
||||
|
||||
getPlugin().foliaLib.getImpl().runAtEntityLater(player, () -> {
|
||||
getPlugin().getFoliaLib().getImpl().runAtEntityLater(player, () -> {
|
||||
player.teleport(override.clone().add(0, 1, 0));
|
||||
}, 50, TimeUnit.MILLISECONDS);
|
||||
// Bukkit.getScheduler().runTaskLater(getPlugin(), () -> player.teleport(override.clone().add(0, 1, 0)), 1);
|
||||
|
|
|
@ -72,10 +72,10 @@ public class BukkitSessionManager extends AbstractSessionManager implements Runn
|
|||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||
Session session = get(localPlayer);
|
||||
|
||||
FoliaLib foliaLib = WorldGuardPlugin.inst().foliaLib;
|
||||
FoliaLib foliaLib = WorldGuardPlugin.inst().getFoliaLib();
|
||||
ServerImplementation impl = foliaLib.getImpl();
|
||||
|
||||
if (foliaLib.isFolia()) impl.runAtEntity(player, () -> session.tick(localPlayer));
|
||||
if (foliaLib.isFolia()) impl.runAtEntity(player, (task) -> session.tick(localPlayer));
|
||||
else session.tick(localPlayer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.google.common.cache.CacheLoader;
|
|||
import com.google.common.cache.LoadingCache;
|
||||
import com.sk89q.worldedit.util.report.DataReport;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.tcoded.folialib.wrapper.task.WrappedTask;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class SchedulerReport extends DataReport {
|
|||
public SchedulerReport() {
|
||||
super("Scheduler");
|
||||
|
||||
append("Error", "MODDED FOLIA VERSION - DO NOT REPORT TO WORLDGUARD");
|
||||
append("Error", "FOLIA VERSION - PLEASE REPORT TO WORLDGUARD");
|
||||
|
||||
// List<BukkitTask> tasks = Bukkit.getServer().getScheduler().getPendingTasks();
|
||||
//// WorldGuardPlugin.inst().foliaLib.getImpl().
|
||||
|
|
|
@ -4,4 +4,4 @@ version: "${internalVersion}"
|
|||
depend: [WorldEdit]
|
||||
softdepend: [CommandBook]
|
||||
api-version: "1.20"
|
||||
folia-supported: true
|
||||
folia-supported: true
|
||||
|
|
Loading…
Reference in New Issue