Skip to content

Conversation

@R00tB33rMan
Copy link

@R00tB33rMan R00tB33rMan commented Nov 3, 2025

This is a thoroughly tested version of WorldEdit against Folia. Not only does it introduce the fundamentals that other forks have offered, but it also provides the ability to utilize -e tags, butchering entities, and even the //regen command on Spigot, Paper, and Folia alike. That said, this pull request is ready for review, so critical changes (if needed) can be made to ensure Folia is sufficient and prepared for WorldEdit upstream.

Supersedes: #2379
Resolves: #2348

This was also done for FastAsyncWorldEdit: IntellectualSites/FastAsyncWorldEdit#3363

This is a thoroughly tested version of WorldEdit against Folia. Not only does it introduce the fundamentals that other forks have offered, but it also provides the ability to utilize `-e` tags, butchering entities, and even the `//regen` command on Spigot, Paper, and Folia alike. That said, this pull request is ready for review, so critical changes (if needed) can be made to ensure Folia is sufficient and prepared for WorldEdit upstream.

This was also done for FastAsyncWorldEdit: IntellectualSites/FastAsyncWorldEdit#3363
@R00tB33rMan R00tB33rMan requested a review from a team as a code owner November 3, 2025 21:51
@R00tB33rMan R00tB33rMan marked this pull request as draft November 5, 2025 04:03
@R00tB33rMan
Copy link
Author

Converted into a draft as FAWE's code has been reworked due to external requirements that will be applied here once FAWE determines their preferred codestyle and approach.

Copy link
Member

@me4502 me4502 left a comment

Choose a reason for hiding this comment

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

I understand that you're reworking based on the feedback from FAWE (and I agree with most of the feedback you received there)- just thought I'd add a few notes to help with the reworking.


@Override
public boolean regenerate(World bukkitWorld, Region region, Extent extent, RegenOptions options) {
if (FoliaScheduler.isFolia()) {
Copy link
Member

Choose a reason for hiding this comment

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

IMO the regen code here is substantially more complicated than it makes sense to support (given the very low Folia user counts); I'd personally rather at least for now have this throw an unsupported error, and then possibly in the future looking into adding this in a simpler way with less maintenance burden.

Copy link
Author

Choose a reason for hiding this comment

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

Appreciate the kind responses here! We've actually created a much more simplified approach that'd likely also reduce the # of code changes needed. Once we properly implement everything on FAWE, I'll go ahead and shift all of these changes to WE in an appropriate way.

int cx = loc.getBlockX() >> 4;
int cz = loc.getBlockZ() >> 4;
if (FoliaScheduler.isFolia()) {
if (Bukkit.isOwnedByCurrentRegion(loc.getWorld(), cx, cz)) {
Copy link
Member

Choose a reason for hiding this comment

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

I do notice a lack of handling non-current-region blocks/entities in this code, what exactly happens if someone were to make an edit in a region other than the one they're in, or across two regions?

IMO supporting it isn't necessary, but it'd be better to have some actual proper handling rather than some things silently failing (or causing errors, if that's the case)

Copy link
Author

Choose a reason for hiding this comment

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

I entirely agree. I haven't ran into issues during testing but now that you mention this, I'll review this closely and will make changes if needed under such conditions


@Override
public boolean trySetPosition(Vector3 pos, float pitch, float yaw) {
if (PaperLib.isPaper()) {
Copy link
Member

Choose a reason for hiding this comment

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

While I understand having alternate async behaviour on Folia, the current API constraints imply it's an immediate teleport and the caller will receive the result of it. I don't feel breaking that constraint for all Paper users makes sense, any of this odd alternate behaviour should be for Folia users only

Copy link
Author

Choose a reason for hiding this comment

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

Would you be more inclined to us having:

  • Folia executes this same operation
  • Paper executes teleportAsync but without a scheduler
  • Spigot of course runs standard teleport

or

  • Folia executes this same operation
  • Paper + Spigot runs standard teleport?

I feel like in regards to performance, allowing Paper to use flat/standard teleportAsync could be favorable, since I don't see disparties with its raw use on Paper

Copy link
Member

Choose a reason for hiding this comment

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

The return value is important, so doing it sync is necessary. Paper shouldn't change because it may affect other plugins that use our APIs.

actor.printInfo(TranslatableComponent.of("worldedit.butcher.killed", TextComponent.of(total), TextComponent.of(finalRadius))));

return killed;
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be limiting behaviour of WorldEdit on all platforms purely for Folia here- if it's not possible for something to work on Folia without breaking behaviour on other platforms, IMO it should be an unsupported operation on Folia.

Copy link
Author

Choose a reason for hiding this comment

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

I'm thinking the best approach here is to ensure all platforms are supported whilst ensuring the alternate Folia-based implementation is appropriated. I feel like if we're supporting Folia and can support all available commands (in a cohesive, non-janky way), it's worthwhile. We'll look into introducing this change in a way that better suites the project

@Euphillya
Copy link

I was wondering, to avoid making a lot of changes, wouldn't it be worthwhile to create a worldedit-folia module similar to worldedit-bukkit?

@me4502
Copy link
Member

me4502 commented Nov 8, 2025

I was wondering, to avoid making a lot of changes, wouldn't it be worthwhile to create a worldedit-folia module similar to worldedit-bukkit?

Imo from a long term maintenance perspective, a separate module would be substantially worse- it's better to keep it in the bukkit module with as minimal changes as possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folia support

4 participants