Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.coreprotect.utility.BlockTypeUtils;
import net.coreprotect.utility.WorldUtils;
import net.coreprotect.utility.ErrorReporter;
import net.coreprotect.utility.MaterialUtils;

public class BlockBreakLogger {

Expand Down Expand Up @@ -54,6 +55,16 @@ else if (checkType != null && (checkType.equals(Material.AIR) || checkType.equal
CacheHandler.spreadCache.remove(cacheId);
}


if (checkType != null && blockKey.length() > 0) {
Material blockDataType = MaterialUtils.getType(blockKey);
if (blockDataType != null && !blockDataType.equals(type)) {
blockKey = checkType.getKey().toString();
blockData = null;
}
}


if (checkType == Material.LECTERN) {
blockData = blockData.replaceFirst("has_book=true", "has_book=false");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ else if (forceType != null && (type == null || !type.equals(forceType))) {
type = forceType;
data = forceData;
}

if (forceType != null && type != null && blockKey.length() > 0) {
Material blockDataType = MaterialUtils.getType(blockKey);
if (blockDataType != null && !blockDataType.equals(type)) {
blockKey = type.getKey().toString();
blockData = null;
}
}

if (blockKey.length() == 0) {
if (type == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private PlayerInteractLogger() {

public static void log(PreparedStatement preparedStmt, int batchCount, String user, BlockState block, Material blockType) {
try {
String blockData = block.getBlockData().getAsString();
String blockData = blockType == null ? block.getBlockData().getAsString() : blockType.toString();
String blockKey = BlockTypeUtils.getBlockDataKey(blockData);
if (blockKey.length() == 0 && blockType != null) {
blockKey = blockType.getKey().toString();
Expand Down