Skip to content

Commit

Permalink
Only mark CLI clipboard world as dirty when the underlying calls retu…
Browse files Browse the repository at this point in the history
…rn a success state
  • Loading branch information
me4502 committed Jan 15, 2023
1 parent 034d721 commit 98611c2
Showing 1 changed file with 15 additions and 6 deletions.
Expand Up @@ -79,8 +79,11 @@ public String getId() {

@Override
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException {
dirty = true;
return clipboard.setBlock(position, block);
boolean retValue = clipboard.setBlock(position, block);
if (retValue) {
dirty = true;
}
return retValue;
}

@Override
Expand Down Expand Up @@ -135,8 +138,11 @@ public List<? extends Entity> getEntities() {
@Nullable
@Override
public Entity createEntity(Location location, BaseEntity entity) {
dirty = true;
return clipboard.createEntity(location, entity);
Entity createdEntity = clipboard.createEntity(location, entity);
if (createdEntity != null) {
dirty = true;
}
return createdEntity;
}

@Override
Expand All @@ -156,8 +162,11 @@ public BiomeType getBiome(BlockVector3 position) {

@Override
public boolean setBiome(BlockVector3 position, BiomeType biome) {
dirty = true;
return clipboard.setBiome(position, biome);
boolean retValue = clipboard.setBiome(position, biome);
if (retValue) {
dirty = true;
}
return retValue;
}

@Override
Expand Down

0 comments on commit 98611c2

Please sign in to comment.