Fixed inconsistent rollback states
This commit is contained in:
parent
90a2e481f2
commit
22fa0dbc47
2 changed files with 2 additions and 61 deletions
|
|
@ -54,65 +54,7 @@ import net.coreprotect.utility.entity.HangingUtil;
|
|||
|
||||
public class RollbackBlockHandler extends Queue {
|
||||
|
||||
/**
|
||||
* Handle block-related rollback operations
|
||||
*
|
||||
* @param block
|
||||
* The block to modify
|
||||
* @param row
|
||||
* Block data from the database (used only for specific operations)
|
||||
* @param rollbackType
|
||||
* The type of rollback (0=rollback, 1=restore)
|
||||
* @param clearInventories
|
||||
* Whether to clear container inventories
|
||||
* @param chunkChanges
|
||||
* Map of block changes to apply
|
||||
* @param countBlock
|
||||
* Whether to count this block in stats
|
||||
* @param oldTypeMaterial
|
||||
* The previous material type
|
||||
* @param pendingChangeType
|
||||
* The pending change material type
|
||||
* @param pendingChangeData
|
||||
* The pending change block data
|
||||
* @param finalUserString
|
||||
* The username for this rollback
|
||||
* @param rawBlockData
|
||||
* The raw block data
|
||||
* @param changeType
|
||||
* The current block type
|
||||
* @param changeBlockData
|
||||
* The current block data
|
||||
* @param meta
|
||||
* Block metadata
|
||||
* @param blockData
|
||||
* The processed block data
|
||||
* @param rowUser
|
||||
* The username associated with this block change
|
||||
* @param rowType
|
||||
* The material type for this block change
|
||||
* @param rowX
|
||||
* The X coordinate
|
||||
* @param rowY
|
||||
* The Y coordinate
|
||||
* @param rowZ
|
||||
* The Z coordinate
|
||||
* @param rowTypeRaw
|
||||
* The raw type value
|
||||
* @param rowData
|
||||
* The data value
|
||||
* @param rowAction
|
||||
* The action value
|
||||
* @param rowWorldId
|
||||
* The world ID
|
||||
* @param blockDataString
|
||||
* The block data as a string
|
||||
* @return Updated count status
|
||||
*/
|
||||
public static boolean processBlockChange(Block block, Object[] row, int rollbackType, boolean clearInventories, Map<Block, BlockData> chunkChanges, boolean countBlock, Material oldTypeMaterial, Material pendingChangeType, BlockData pendingChangeData, String finalUserString, BlockData rawBlockData, Material changeType, BlockData changeBlockData, ArrayList<Object> meta, BlockData blockData, String rowUser, Material rowType, int rowX, int rowY, int rowZ, int rowTypeRaw, int rowData, int rowAction, int rowWorldId, String blockDataString) {
|
||||
|
||||
boolean changeBlock = true;
|
||||
World bukkitWorld = block.getWorld();
|
||||
public static boolean processBlockChange(World bukkitWorld, Block block, Object[] row, int rollbackType, boolean clearInventories, Map<Block, BlockData> chunkChanges, boolean countBlock, Material oldTypeMaterial, Material pendingChangeType, BlockData pendingChangeData, String finalUserString, BlockData rawBlockData, Material changeType, boolean changeBlock, BlockData changeBlockData, ArrayList<Object> meta, BlockData blockData, String rowUser, Material rowType, int rowX, int rowY, int rowZ, int rowTypeRaw, int rowData, int rowAction, int rowWorldId, String blockDataString) {
|
||||
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public class RollbackProcessor {
|
|||
|
||||
// Process blocks
|
||||
for (Object[] row : data) {
|
||||
int unixtimestamp = (int) (System.currentTimeMillis() / 1000L);
|
||||
int[] rollbackHashData = ConfigHandler.rollbackHash.get(finalUserString);
|
||||
int itemCount = rollbackHashData[0];
|
||||
int blockCount = rollbackHashData[1];
|
||||
|
|
@ -234,7 +233,7 @@ public class RollbackProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
if (countBlock && RollbackBlockHandler.processBlockChange(block, row, rollbackType, clearInventories, chunkChanges, countBlock, oldTypeMaterial, pendingChangeType, pendingChangeData, finalUserString, rawBlockData, changeType, changeBlockData, meta != null ? new ArrayList<>(meta) : null, blockData, rowUser, rowType, rowX, rowY, rowZ, rowTypeRaw, rowData, rowAction, rowWorldId, BlockUtils.byteDataToString((byte[]) row[13], rowTypeRaw))) {
|
||||
if (RollbackBlockHandler.processBlockChange(bukkitWorld, block, row, rollbackType, clearInventories, chunkChanges, countBlock, oldTypeMaterial, pendingChangeType, pendingChangeData, finalUserString, rawBlockData, changeType, changeBlock, changeBlockData, meta != null ? new ArrayList<>(meta) : null, blockData, rowUser, rowType, rowX, rowY, rowZ, rowTypeRaw, rowData, rowAction, rowWorldId, BlockUtils.byteDataToString((byte[]) row[13], rowTypeRaw)) && countBlock) {
|
||||
blockCount++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue