Fixed item frames and paintings not logging directional data

This commit is contained in:
Intelli 2022-02-16 19:16:56 -07:00
parent 7398f7dfe6
commit e462e68806
15 changed files with 132 additions and 68 deletions

View file

@ -338,7 +338,7 @@ public class Rollback extends Queue {
}
BlockData blockData = null;
if (blockDataString != null && blockDataString.length() > 0) {
if (blockDataString != null && blockDataString.contains(":")) {
try {
blockData = Bukkit.getServer().createBlockData(blockDataString);
}
@ -564,11 +564,11 @@ public class Rollback extends Queue {
if ((rowType == Material.AIR) && ((BukkitAdapter.ADAPTER.isItemFrame(oldTypeMaterial)) || (oldTypeMaterial == Material.PAINTING))) {
int delay = Util.getHangingDelay(hangingDelay, rowWorldId, rowX, rowY, rowZ);
Queue.queueHangingRemove(rowUser, block.getState(), delay);
Queue.queueHangingRemove(rowUser, block.getState(), blockDataString, delay);
}
else if ((BukkitAdapter.ADAPTER.isItemFrame(rowType)) || (rowType == Material.PAINTING)) {
int delay = Util.getHangingDelay(hangingDelay, rowWorldId, rowX, rowY, rowZ);
Queue.queueHangingSpawn(rowUser, block.getState(), rowType, rowData, delay);
Queue.queueHangingSpawn(rowUser, block.getState(), rowType, blockDataString, rowData, delay);
}
else if ((rowType == Material.ARMOR_STAND)) {
Location location1 = block.getLocation();

View file

@ -8,6 +8,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.ConfigHandler;
import net.coreprotect.database.statement.BlockStatement;
import net.coreprotect.database.statement.UserStatement;
@ -21,7 +22,7 @@ public class BlockBreakLogger {
throw new IllegalStateException("Database class");
}
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int type, int data, List<Object> meta, String blockData) {
public static void log(PreparedStatement preparedStmt, int batchCount, String user, Location location, int type, int data, List<Object> meta, String blockData, String overrideData) {
try {
if (ConfigHandler.blacklist.get(user.toLowerCase(Locale.ROOT)) != null || location == null) {
return;
@ -42,6 +43,9 @@ public class BlockBreakLogger {
if (checkType == Material.LECTERN) {
blockData = blockData.replaceFirst("has_book=true", "has_book=false");
}
else if (checkType == Material.PAINTING || BukkitAdapter.ADAPTER.isItemFrame(checkType)) {
blockData = overrideData;
}
CoreProtectPreLogEvent event = new CoreProtectPreLogEvent(user);
CoreProtect.getInstance().getServer().getPluginManager().callEvent(event);

View file

@ -36,7 +36,7 @@ public class SkullBreakLogger {
keys.close();
}
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), type, skullKey, null, block.getBlockData().getAsString());
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), type, skullKey, null, block.getBlockData().getAsString(), null);
}
catch (Exception e) {
e.printStackTrace();