mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-06-26 14:34:53 +02:00
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.
|
Submissions must be licensed under the GNU Lesser General Public License v3.
|
||||||
|
|
||||||
# Folia Inquisitors
|
# 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/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/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/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
|
Links
|
||||||
-----
|
-----
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
group=com.sk89q.worldguard
|
group=com.sk89q.worldguard
|
||||||
version=7.1.0-SNAPSHOT-Custom-Folia
|
version=7.1.0-SNAPSHOT
|
||||||
|
|
|
@ -24,13 +24,13 @@
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
"api"(project(":worldguard-core"))
|
"api"(project(":worldguard-core"))
|
||||||
"compileOnly"("io.papermc.paper:paper-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-R0.1-SNAPSHOT") {
|
"runtimeOnly"("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT") {
|
||||||
exclude("junit", "junit")
|
exclude("junit", "junit")
|
||||||
}
|
}
|
||||||
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
|
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
|
||||||
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
|
"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 }
|
"compileOnly"("com.sk89q:commandbook:2.3") { isTransitive = false }
|
||||||
"shadeOnly"("io.papermc:paperlib:1.0.8")
|
"shadeOnly"("io.papermc:paperlib:1.0.8")
|
||||||
"shadeOnly"("org.bstats:bstats-bukkit:3.0.1")
|
"shadeOnly"("org.bstats:bstats-bukkit:3.0.1")
|
||||||
|
|
|
@ -96,7 +96,7 @@ public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
}, plugin);
|
}, plugin);
|
||||||
|
|
||||||
int interval = CACHE_INVALIDATION_INTERVAL * 50;
|
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);
|
// 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;
|
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
|
* Construct objects. Actual loading occurs when the plugin is enabled, so
|
||||||
|
@ -174,7 +174,7 @@ public void onEnable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int runDelayMs = BukkitSessionManager.RUN_DELAY * 50;
|
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);
|
// getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
|
||||||
|
|
||||||
// Register events
|
// Register events
|
||||||
|
@ -216,25 +216,28 @@ public void onEnable() {
|
||||||
}
|
}
|
||||||
worldListener.registerEvents();
|
worldListener.registerEvents();
|
||||||
|
|
||||||
if (foliaLib.isFolia()) {
|
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
foliaLib.getImpl().runAtEntity(player, (task) -> {
|
||||||
foliaLib.getImpl().runAtEntity(player, new Runnable() {
|
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
|
||||||
@Override
|
Events.fire(event);
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 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);
|
((SimpleFlagRegistry) WorldGuard.getInstance().getFlagRegistry()).setInitialized(true);
|
||||||
((SimpleDomainRegistry) WorldGuard.getInstance().getDomainRegistry()).setInitialized(true);
|
((SimpleDomainRegistry) WorldGuard.getInstance().getDomainRegistry()).setInitialized(true);
|
||||||
|
@ -290,7 +293,9 @@ private void setupCustomCharts(Metrics metrics) {
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
WorldGuard.getInstance().disable();
|
WorldGuard.getInstance().disable();
|
||||||
// this.getServer().getScheduler().cancelTasks(this);
|
if (!foliaLib.isFolia()) {
|
||||||
|
this.getServer().getScheduler().cancelTasks(this);
|
||||||
|
}
|
||||||
foliaLib.getImpl().cancelAllTasks();
|
foliaLib.getImpl().cancelAllTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,4 +556,7 @@ public PlayerMoveListener getPlayerMoveListener() {
|
||||||
return playerMoveListener;
|
return playerMoveListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FoliaLib getFoliaLib() {
|
||||||
|
return foliaLib;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -994,7 +994,7 @@ public void onInventoryMoveItem(InventoryMoveItemEvent event) {
|
||||||
Hopper hopperCauseHolder = (Hopper) causeHolder;
|
Hopper hopperCauseHolder = (Hopper) causeHolder;
|
||||||
Location location = hopperCauseHolder.getLocation();
|
Location location = hopperCauseHolder.getLocation();
|
||||||
|
|
||||||
getPlugin().foliaLib.getImpl().runAtLocationLater(location, () -> {
|
getPlugin().getFoliaLib().getImpl().runAtLocationLater(location, () -> {
|
||||||
Block block = location.getBlock();
|
Block block = location.getBlock();
|
||||||
if (block.getType() == Material.HOPPER) {
|
if (block.getType() == Material.HOPPER) {
|
||||||
block.breakNaturally();
|
block.breakNaturally();
|
||||||
|
|
|
@ -133,7 +133,7 @@ public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
|
|
||||||
player.teleport(override.clone().add(0, 1, 0));
|
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));
|
player.teleport(override.clone().add(0, 1, 0));
|
||||||
}, 50, TimeUnit.MILLISECONDS);
|
}, 50, TimeUnit.MILLISECONDS);
|
||||||
// Bukkit.getScheduler().runTaskLater(getPlugin(), () -> player.teleport(override.clone().add(0, 1, 0)), 1);
|
// Bukkit.getScheduler().runTaskLater(getPlugin(), () -> player.teleport(override.clone().add(0, 1, 0)), 1);
|
||||||
|
|
|
@ -72,10 +72,10 @@ public void run() {
|
||||||
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
|
||||||
Session session = get(localPlayer);
|
Session session = get(localPlayer);
|
||||||
|
|
||||||
FoliaLib foliaLib = WorldGuardPlugin.inst().foliaLib;
|
FoliaLib foliaLib = WorldGuardPlugin.inst().getFoliaLib();
|
||||||
ServerImplementation impl = foliaLib.getImpl();
|
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);
|
else session.tick(localPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.sk89q.worldedit.util.report.DataReport;
|
import com.sk89q.worldedit.util.report.DataReport;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
import com.tcoded.folialib.wrapper.task.WrappedTask;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ public Optional<Field> load(Class<?> clazz) throws Exception {
|
||||||
public SchedulerReport() {
|
public SchedulerReport() {
|
||||||
super("Scheduler");
|
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();
|
// List<BukkitTask> tasks = Bukkit.getServer().getScheduler().getPendingTasks();
|
||||||
//// WorldGuardPlugin.inst().foliaLib.getImpl().
|
//// WorldGuardPlugin.inst().foliaLib.getImpl().
|
||||||
|
|
|
@ -4,4 +4,4 @@ version: "${internalVersion}"
|
||||||
depend: [WorldEdit]
|
depend: [WorldEdit]
|
||||||
softdepend: [CommandBook]
|
softdepend: [CommandBook]
|
||||||
api-version: "1.20"
|
api-version: "1.20"
|
||||||
folia-supported: true
|
folia-supported: true
|
||||||
|
|
Loading…
Reference in New Issue
Block a user