IntellectualSites / FastAsyncWorldEdit

Blazingly fast world manipulation for artists, builders and everyone else: https://www.spigotmc.org/resources/13932/
Other
612 stars 219 forks source link

`//gmask 0` causes `ArrayIndexOutOfBoundsException` #1681

Closed thomasmny closed 2 years ago

thomasmny commented 2 years ago

Server Implementation

Paper

Server Version

1.18.2

Describe the bug

I have created a custom command, similar to //forest except it uses schematics to create trees, not ones provided by vanilla. The command works perfectly fine in small regions, but whenever the region is larger than 123x123, the command no longer works and a java.lang.ArrayIndexOutOfBoundsException is thrown.

To Reproduce

  1. The command (//schemforest) is created with the following classes:

  2. Select a large region (anything greater than 123x123)

  3. Use the command //schemforest <base> <schematic>

    • \: Block type the schematic will be pasted on (e.g. grass_block)
    • \: The schematic to paste
  4. Error is thrown and edit session will not paste

Expected behaviour

No error is thrown and the schematics are pasted

Screenshots / Videos

No response

Error log (if applicable)

https://paste.gg/p/anonymous/c0e32b38ac1c4b008e6e6ad5cc3a2277

Fawe Debugpaste

https://athion.net/ISPaster/paste/view/850861b448d44c44bdc4f71c8a0f1cd0

Fawe Version

FastAsyncWorldEdit version 2.1.1-SNAPSHOT-139;4970db0

Checklist

Anything else?

No response

thomasmny commented 2 years ago

Could this be similar to (or even a duplicate of) #1151?

thomasmny commented 2 years ago

I can also replicate the issue using the normal //forest command: Note: The trees are placed, however the player is greeted with a message to report the error

To Reproduce

  1. Select a large region with //pos1 and //pos2
  2. Create a global mask with //gmask 0 (Important !)
  3. Run //forest largeoak

Error log

https://paste.gg/p/anonymous/9544e60734c84eebaaab71d6593d71f9

FAWE Debugpaste

https://athion.net/ISPaster/paste/view/d41bae61fcf6495faee48e27732b6c31

Anything else?

Running the command without //gmask 0 stops the error, so I'm guessing it's caused by the mask

WhitehatD commented 2 years ago

Can confirm, error still happens when doing Operations#complete on a bigger operation

EDIT: Code that causes the issue:

Location atLoc = e.getPlayer().getTargetBlockExact(200).getLocation();

BlockVector3 at = BlockVector3.at(atLoc.getBlockX(),
                        atLoc.getBlockY() + 1,
                        atLoc.getBlockZ());

try (EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(e.getPlayer().getWorld()))) {
        Operation operation = holder
                            .createPaste(editSession)
                            .ignoreAirBlocks(true)
                            .to(at)
                            .build();

        Operations.complete(operation);
}
dordsor21 commented 2 years ago

Can confirm, error still happens when doing Operations#complete on a bigger operation

EDIT: Code that causes the issue:

Location atLoc = e.getPlayer().getTargetBlockExact(200).getLocation();

BlockVector3 at = BlockVector3.at(atLoc.getBlockX(),
                        atLoc.getBlockY() + 1,
                        atLoc.getBlockZ());

try (EditSession editSession = WorldEdit.getInstance().newEditSession(BukkitAdapter.adapt(e.getPlayer().getWorld()))) {
        Operation operation = holder
                            .createPaste(editSession)
                            .ignoreAirBlocks(true)
                            .to(at)
                            .build();

        Operations.complete(operation);
}

This seems like to be a different issue, though without the log I can't comment further