Restore blocks until correct block has been restored and verified

This commit is contained in:
zontreck 2024-04-25 03:39:29 -07:00
parent 0dcf38ce2a
commit c19e971e92
2 changed files with 15 additions and 12 deletions

View file

@ -53,7 +53,7 @@ mod_name=Zontreck's Library Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPLv3 mod_license=GPLv3
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=1201.13.042524.0321 mod_version=1201.13.042524.0327
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -147,21 +147,24 @@ public abstract class BlockRestoreQueue
PrimitiveBlock block = PrimitiveBlock.deserialize(NbtIo.read(dis)); PrimitiveBlock block = PrimitiveBlock.deserialize(NbtIo.read(dis));
try { if(block.level.getBlockState(block.position).is(block.blockType))
res.deleteRow(); {
if (!res.rowDeleted()) {
try {
res.deleteRow();
if (!res.rowDeleted()) {
}
} catch (SQLException e001) {
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("DELETE FROM `blocks` WHERE queueName=? AND posX=? AND posY=? AND posZ=?;");
pstat.setString(1, getRestoreQueueName());
pstat.setInt(2, block.position.getX());
pstat.setInt(3, block.position.getY());
pstat.setInt(4, block.position.getZ());
DatabaseWrapper.get().executePreparedStatement(pstat);
} }
} catch (SQLException e001) {
PreparedStatement pstat = DatabaseWrapper.get().prepareStatement("DELETE FROM `blocks` WHERE queueName=? AND posX=? AND posY=? AND posZ=?;");
pstat.setString(1, getRestoreQueueName());
pstat.setInt(2, block.position.getX());
pstat.setInt(3, block.position.getY());
pstat.setInt(4, block.position.getZ());
DatabaseWrapper.get().executePreparedStatement(pstat);
} }
return block; return block;
} else return null; } else return null;