Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
ea6a2d3
Reimplement Folia Support.
Yomamaeatstoes Dec 26, 2023
50e4f4a
Update README.md
Yomamaeatstoes Dec 26, 2023
b658d97
Updated FoliaLib dependency. Fixed ProcessPlayerEvent scheduler in Wo…
Loving11ish Jan 28, 2024
6edbb60
Merge pull request #1 from Folia-Inquisitors/Master-Folia-Third-Revision
Yomamaeatstoes Jan 29, 2024
1368238
Updated FoliaLib dependency. Added new Folia task methods to Schedule…
Loving11ish Feb 6, 2024
c41f279
Merge remote-tracking branch 'upstream/master' into Master-Folia-Firs…
KaspianDev May 8, 2024
17a0d9d
Merge pull request #2 from KaspianDev/Master-Folia-First-Revision
Yomamaeatstoes May 13, 2024
65431c7
Fix fire placement by blocks when fire-spread is set to deny
aurorasmiles May 12, 2024
d9424b1
Release 7.0.10.
wizjany May 14, 2024
6f5501f
Bump to snapshot.
wizjany May 14, 2024
d6ef5e9
Remove adventure snapshot repository
Joo200 May 17, 2024
8b7729e
Fix silent flag for gameplay commands (#2081)
aurorasmiles May 23, 2024
ead1e1b
Fix checking bypass on initialize (#2082)
aromaa May 24, 2024
27f0095
Fix compilation for MC 1.21. Nothing tested yet.
wizjany Jun 17, 2024
2bd426b
Update Materials.java with 1.21 tags and materials
Joo200 Jun 17, 2024
7783e9a
Fix ItemStack conversion on block place on MC 1.21 (#2093)
lenis0012 Jun 19, 2024
6898ad8
Fix ItemStack conversion for spigot compatibility
Joo200 Jun 22, 2024
887f3bf
Special handling for WindCharges
Brokkonaut Jun 4, 2024
8aa37e3
Do not call as a bulk event, because it has to check every blocks type
Brokkonaut Jun 4, 2024
8329879
WindCharge -> AbstractWindCharge
Brokkonaut Jun 25, 2024
a5ea511
Fix UseBlockFlag for multiple uses at the same time, add windburst-flag
Joo200 Jun 26, 2024
af645ea
Cleanup code
Joo200 Jun 26, 2024
b269d7e
Handle vaults as use, crafters as chest-access.
wizjany Jun 26, 2024
1bfae45
Merge pull request #2089 from EngineHub/feat/mc-1.21
wizjany Jun 26, 2024
a801a9d
Release 7.0.11-beta1.
wizjany Jun 26, 2024
fa357f4
Back to snapshot.
wizjany Jun 26, 2024
c6fbfb8
remove double space
CyberFlameGO Jul 4, 2024
5749210
Port build-logic from WorldEdit
aurorasmiles Jul 2, 2024
ca49458
A bit of cleanup.
wizjany Jul 22, 2024
16ea462
Merge pull request #2100 from aurorasmiles/feat/buildlogic
wizjany Jul 22, 2024
8ffc81a
Fix NPE for teleport events without target location
Joo200 Jul 22, 2024
0de567d
Merge remote-tracking branch 'upstream/version/7.0.x' into WG7.0
KaspianDev Aug 8, 2024
7a0458d
Fix compilation
KaspianDev Aug 8, 2024
76c9092
Merge pull request #5 from KaspianDev/WG7.0
KaspianDev Aug 8, 2024
aa46529
Extend use flag to all (trap)doors.
wizjany Sep 8, 2024
70d225e
Split chest boat ride/open.
wizjany Sep 8, 2024
2ea5068
Workaround books no longer sending change block for lecterns.
wizjany Sep 8, 2024
b73a0a7
Check mob-damage for potion splashes from e.g. witches.
wizjany Sep 8, 2024
afb619d
Fix breeze damage flags
Joo200 Jul 22, 2024
9dd7d7c
Fix wind-charge-burst flag for player knockback
Joo200 Jul 27, 2024
679b569
Split wind charge into breeze/player flags.
wizjany Sep 8, 2024
0f3ea50
Merge pull request #2115 from EngineHub/feature/fix-breeze-stuff
wizjany Sep 8, 2024
cb011a8
Add moisture-change flag (#1879) (#2096)
ploppyperson Sep 9, 2024
068ad68
Release 7.0.11.
wizjany Sep 9, 2024
fb88d56
Bump to SNAPSHOT for dev.
wizjany Sep 9, 2024
03aac83
Match explosion flag coverage with EntityListener.
wizjany Sep 13, 2024
830472d
Revert previous changes to explosion event handling.
wizjany Sep 13, 2024
829a4a4
Release 7.0.12.
wizjany Sep 13, 2024
02dc89b
Bump to snapshot.
wizjany Sep 13, 2024
a0e397e
Use more snapshot-less holders on Paper.
wizjany Sep 13, 2024
d9716a5
Ignore arrow combustion.
wizjany Sep 13, 2024
92adfa9
Merge branch 'EngineHub:version/7.0.x' into Master-Folia-First-Revision
Yomamaeatstoes Oct 2, 2024
3b9ab47
Avoid using metadata storage if possible (#2150)
Joo200 Oct 16, 2024
5579d19
Remove stack size bypassing perm.
wizjany Oct 28, 2024
764d258
Fix deprecations on stack methods.
wizjany Oct 28, 2024
af8b023
Merge branch 'EngineHub:version/7.0.x' into Master-Folia-First-Revision
Yomamaeatstoes Nov 5, 2024
1a59d1e
Update to 1.21.3. (#2153)
wizjany Nov 9, 2024
2f13ae0
Release 7.0.13-beta-1
wizjany Nov 9, 2024
7ae07a9
Back to snapshot.
wizjany Nov 9, 2024
b1c0eb4
Merge branch 'EngineHub:version/7.0.x' into Master-Folia-First-Revision
Yomamaeatstoes Dec 1, 2024
89b6bdc
Fix typo.
wizjany Dec 10, 2024
b08da82
Merge branch 'EngineHub:version/7.0.x' into Master-Folia-First-Revision
Yomamaeatstoes Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ Please read CONTRIBUTING.md for important guidelines to follow.

Submissions must be licensed under the GNU Lesser General Public License v3.

# Folia Inquisitors
[<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)

Comment on lines +40 to +47
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in WorldEdit:
EngineHub/WorldEdit#2462 (comment)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heyy @Joo200 I have updated it. What do you think of it now?

Links
-----

Expand Down
1 change: 1 addition & 0 deletions config/checkstyle/import-control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<allow pkg="junit.framework"/>
<allow pkg="com.sk89q"/>
<allow pkg="com.google.common"/>
<allow pkg="com.tcoded.folialib"/>

<subpackage name="worldguard">
<allow pkg="org.khelekore"/>
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=com.sk89q.worldguard
version=7.1.0-SNAPSHOT
version=7.1.0-SNAPSHOT-Custom-Folia
Comment thread
Yomamaeatstoes marked this conversation as resolved.
Outdated
8 changes: 8 additions & 0 deletions worldguard-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ repositories {
name = "paper"
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = "devmart-other"
url = uri("https://nexuslite.gcnt.net/repos/other/")
}
}

configurations {
Expand All @@ -26,6 +30,7 @@ dependencies {
}
"api"("com.sk89q.worldedit:worldedit-bukkit:${Versions.WORLDEDIT}") { isTransitive = false }
"implementation"("com.google.guava:guava:${Versions.GUAVA}")
"implementation"("com.tcoded:FoliaLib:0.2.3")
Comment thread
Yomamaeatstoes marked this conversation as resolved.
Outdated
"compileOnly"("com.sk89q:commandbook:2.3") { isTransitive = false }
"shadeOnly"("io.papermc:paperlib:1.0.8")
"shadeOnly"("org.bstats:bstats-bukkit:3.0.1")
Expand Down Expand Up @@ -61,6 +66,9 @@ tasks.named<ShadowJar>("shadowJar") {
relocate ("co.aikar.timings.lib", "com.sk89q.worldguard.bukkit.timingslib") {
include(dependency("co.aikar:minecraft-timings"))
}
relocate ("com.tcoded.folialib", "com.sk89q.worldguard.bukkit.folialib") {
include(dependency("com.tcoded:FoliaLib"))
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nullable;

Expand Down Expand Up @@ -94,7 +95,10 @@ public void onChunkUnload(ChunkUnloadEvent event) {
}
}, plugin);

Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, cache::invalidateAll, CACHE_INVALIDATION_INTERVAL, CACHE_INVALIDATION_INTERVAL);
int interval = CACHE_INVALIDATION_INTERVAL * 50;
plugin.foliaLib.getImpl().runTimerAsync(cache::invalidateAll, interval, interval, TimeUnit.MILLISECONDS);

// Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, cache::invalidateAll, CACHE_INVALIDATION_INTERVAL, CACHE_INVALIDATION_INTERVAL);
}

public void shutdown() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import com.sk89q.worldguard.protection.managers.storage.sql.SQLDriver;
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import com.sk89q.worldguard.util.logging.RecordMessagePrefixer;
import com.tcoded.folialib.FoliaLib;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.DrilldownPie;
import org.bstats.charts.SimplePie;
Expand All @@ -96,6 +97,7 @@
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand All @@ -111,6 +113,9 @@ public class WorldGuardPlugin extends JavaPlugin {

private static final int BSTATS_PLUGIN_ID = 3283;


public FoliaLib foliaLib;
Comment thread
Yomamaeatstoes marked this conversation as resolved.
Outdated

/**
* Construct objects. Actual loading occurs when the plugin is enabled, so
* this merely instantiates the objects.
Expand Down Expand Up @@ -138,6 +143,10 @@ public static WorldGuardPlugin inst() {
*/
@Override
public void onEnable() {

// FoliaLib Util
foliaLib = new FoliaLib(this);

// Catch bad things being done by naughty plugins that include WorldGuard's classes
ClassSourceValidator verifier = new ClassSourceValidator(this);
verifier.reportMismatches(ImmutableList.of(WorldGuard.class, ProtectedRegion.class, Flag.class));
Expand All @@ -164,7 +173,9 @@ public void onEnable() {
reg.register(GeneralCommands.class);
}

getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);
int runDelayMs = BukkitSessionManager.RUN_DELAY * 50;
foliaLib.getImpl().runTimer(sessionManager, runDelayMs, runDelayMs, TimeUnit.MILLISECONDS);
// getServer().getScheduler().scheduleSyncRepeatingTask(this, sessionManager, BukkitSessionManager.RUN_DELAY, BukkitSessionManager.RUN_DELAY);

// Register events
getServer().getPluginManager().registerEvents(sessionManager, this);
Expand Down Expand Up @@ -205,12 +216,25 @@ public void onEnable() {
}
worldListener.registerEvents();

Bukkit.getScheduler().runTask(this, () -> {
if (foliaLib.isFolia()) {
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
ProcessPlayerEvent event = new ProcessPlayerEvent(player);
Events.fire(event);
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);
}
});
}

((SimpleFlagRegistry) WorldGuard.getInstance().getFlagRegistry()).setInitialized(true);
((SimpleDomainRegistry) WorldGuard.getInstance().getDomainRegistry()).setInitialized(true);
Expand Down Expand Up @@ -266,7 +290,8 @@ private void setupCustomCharts(Metrics metrics) {
@Override
public void onDisable() {
WorldGuard.getInstance().disable();
this.getServer().getScheduler().cancelTasks(this);
// this.getServer().getScheduler().cancelTasks(this);
foliaLib.getImpl().cancelAllTasks();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class EventAbstractionListener extends AbstractListener {
Expand Down Expand Up @@ -990,8 +991,16 @@ public void onInventoryMoveItem(InventoryMoveItemEvent event) {
handleInventoryHolderUse(event, cause, targetHolder);

if (event.isCancelled() && causeHolder instanceof Hopper && wcfg.breakDeniedHoppers) {
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(),
() -> ((Hopper) causeHolder).getBlock().breakNaturally());
Hopper hopperCauseHolder = (Hopper) causeHolder;
Location location = hopperCauseHolder.getLocation();

getPlugin().foliaLib.getImpl().runAtLocationLater(location, () -> {
Block block = location.getBlock();
if (block.getType() == Material.HOPPER) {
block.breakNaturally();
}
}, 50, TimeUnit.MILLISECONDS);

} else {
entry.setCancelled(event.isCancelled());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.bukkit.plugin.PluginManager;
import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityMountEvent;
import java.util.concurrent.TimeUnit;

public class PlayerMoveListener extends AbstractListener {

Expand Down Expand Up @@ -132,7 +133,10 @@ public void onPlayerMove(PlayerMoveEvent event) {

player.teleport(override.clone().add(0, 1, 0));

Bukkit.getScheduler().runTaskLater(getPlugin(), () -> player.teleport(override.clone().add(0, 1, 0)), 1);
getPlugin().foliaLib.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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.sk89q.worldguard.bukkit.util.Entities;
import com.sk89q.worldguard.session.AbstractSessionManager;
import com.sk89q.worldguard.session.Session;
import com.tcoded.folialib.FoliaLib;
import com.tcoded.folialib.impl.ServerImplementation;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -68,7 +70,13 @@ public void onPlayerProcess(ProcessPlayerEvent event) {
public void run() {
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
LocalPlayer localPlayer = WorldGuardPlugin.inst().wrapPlayer(player);
get(localPlayer).tick(localPlayer);
Session session = get(localPlayer);

FoliaLib foliaLib = WorldGuardPlugin.inst().foliaLib;
ServerImplementation impl = foliaLib.getImpl();

if (foliaLib.isFolia()) impl.runAtEntity(player, () -> session.tick(localPlayer));
else session.tick(localPlayer);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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 org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitTask;

Expand Down Expand Up @@ -52,19 +53,22 @@ public Optional<Field> load(Class<?> clazz) throws Exception {
public SchedulerReport() {
super("Scheduler");

List<BukkitTask> tasks = Bukkit.getServer().getScheduler().getPendingTasks();
append("Error", "MODDED FOLIA VERSION - DO NOT REPORT TO WORLDGUARD");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks like it's not finished yet? Please don't remove the whole report.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, sorry about that. Originally I wasn’t intending to PR it so I put a comment there so people wouldn’t spam you guys if they found my fork. It seems I forgot to remove that comment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having looked closer into this, until TechnicallyCoded adds a method to getAllWrappedTasks either active or pending. I will contact him as he is a work colleague.


append("Pending Task Count", tasks.size());

for (BukkitTask task : tasks) {
Class<?> taskClass = getTaskClass(task);

DataReport report = new DataReport("Task: #" + task.getTaskId());
report.append("Owner", task.getOwner().getName());
report.append("Runnable", taskClass != null ? taskClass.getName() : "<Unknown>");
report.append("Synchronous?", task.isSync());
append(report.getTitle(), report);
}
// List<BukkitTask> tasks = Bukkit.getServer().getScheduler().getPendingTasks();
//// WorldGuardPlugin.inst().foliaLib.getImpl().
//
// append("Pending Task Count", tasks.size());
//
// for (BukkitTask task : tasks) {
// Class<?> taskClass = getTaskClass(task);
//
// DataReport report = new DataReport("Task: #" + task.getTaskId());
// report.append("Owner", task.getOwner().getName());
// report.append("Runnable", taskClass != null ? taskClass.getName() : "<Unknown>");
// report.append("Synchronous?", task.isSync());
// append(report.getTitle(), report);
// }
}

@SuppressWarnings("unchecked")
Expand Down
1 change: 1 addition & 0 deletions worldguard-bukkit/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ version: "${internalVersion}"
depend: [WorldEdit]
softdepend: [CommandBook]
api-version: "1.20"
folia-supported: true
Comment thread
Yomamaeatstoes marked this conversation as resolved.
Outdated