3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-08 04:20:06 +01:00

Merge pull request #348 from BrodyBeckwith/1.15

Don't attempt to set blocks below 0 and above 255
Dieser Commit ist enthalten in:
Matt 2020-03-02 10:42:36 -05:00 committet von GitHub
Commit 149480cc3d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -820,6 +820,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @throws WorldEditException thrown on a set error * @throws WorldEditException thrown on a set error
*/ */
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException { public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, Stage stage) throws WorldEditException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
return false;
}
this.changes++; this.changes++;
switch (stage) { switch (stage) {
case BEFORE_HISTORY: case BEFORE_HISTORY:
@ -841,6 +845,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @return whether the block changed * @return whether the block changed
*/ */
public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) { public <B extends BlockStateHolder<B>> boolean rawSetBlock(BlockVector3 position, B block) {
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
return bypassAll.setBlock(position, block); return bypassAll.setBlock(position, block);
@ -857,6 +865,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @return whether the block changed * @return whether the block changed
*/ */
public <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block) { public <B extends BlockStateHolder<B>> boolean smartSetBlock(BlockVector3 position, B block) {
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
return setBlock(position, block, Stage.BEFORE_REORDER); return setBlock(position, block, Stage.BEFORE_REORDER);
@ -867,6 +879,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
@Override @Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException { public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block) throws MaxChangedBlocksException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
return this.getExtent().setBlock(position, block); return this.getExtent().setBlock(position, block);
@ -879,7 +895,11 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
@Override @Override
public <B extends BlockStateHolder<B>> boolean setBlock(int x, @Range(from = 0, to = 255) int y, int z, B block) { public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) {
if (y < 0 || y > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
return this.getExtent().setBlock(x, y, z, block); return this.getExtent().setBlock(x, y, z, block);
@ -899,6 +919,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @throws MaxChangedBlocksException thrown if too many blocks are changed * @throws MaxChangedBlocksException thrown if too many blocks are changed
*/ */
public boolean setBlock(int x, int y, int z, Pattern pattern) { public boolean setBlock(int x, int y, int z, Pattern pattern) {
if (y < 0 || y > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
BlockVector3 bv = mutablebv.setComponents(x, y, z); BlockVector3 bv = mutablebv.setComponents(x, y, z);
@ -917,6 +941,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
* @throws MaxChangedBlocksException thrown if too many blocks are changed * @throws MaxChangedBlocksException thrown if too many blocks are changed
*/ */
public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException { public boolean setBlock(BlockVector3 position, Pattern pattern) throws MaxChangedBlocksException {
if (position.getBlockY() < 0 || position.getBlockY() > 255) {
return false;
}
this.changes++; this.changes++;
try { try {
return pattern.apply(this.getExtent(), position, position); return pattern.apply(this.getExtent(), position, position);