Changed doors and beds to no longer log data as two separate blocks
This commit is contained in:
parent
f9083053b2
commit
262f27da3e
6 changed files with 106 additions and 170 deletions
|
|
@ -11,6 +11,8 @@ import org.bukkit.block.BlockState;
|
|||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.Bisected.Half;
|
||||
import org.bukkit.block.data.type.Bed;
|
||||
import org.bukkit.block.data.type.Bed.Part;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
@ -21,6 +23,7 @@ import net.coreprotect.config.Config;
|
|||
import net.coreprotect.config.ConfigHandler;
|
||||
import net.coreprotect.consumer.process.Process;
|
||||
import net.coreprotect.listener.block.BlockUtil;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
public class Queue {
|
||||
|
|
@ -99,19 +102,29 @@ public class Queue {
|
|||
CreatureSpawner mobSpawner = (CreatureSpawner) block;
|
||||
extraData = Util.getSpawnerType(mobSpawner.getSpawnedType());
|
||||
}
|
||||
else if (type.equals(Material.SUNFLOWER) || type.equals(Material.LILAC) || type.equals(Material.TALL_GRASS) || type.equals(Material.LARGE_FERN) || type.equals(Material.ROSE_BUSH) || type.equals(Material.PEONY)) { // Double plant
|
||||
else if (type == Material.IRON_DOOR || BlockGroup.DOORS.contains(type) || type.equals(Material.SUNFLOWER) || type.equals(Material.LILAC) || type.equals(Material.TALL_GRASS) || type.equals(Material.LARGE_FERN) || type.equals(Material.ROSE_BUSH) || type.equals(Material.PEONY)) { // Double plant
|
||||
if (block.getBlockData() instanceof Bisected) {
|
||||
if (((Bisected) block.getBlockData()).getHalf().equals(Half.TOP) && !user.startsWith("#")) {
|
||||
if (((Bisected) block.getBlockData()).getHalf().equals(Half.TOP)) {
|
||||
if (blockNumber == 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (block.getY() > BukkitAdapter.ADAPTER.getMinHeight(block.getWorld())) {
|
||||
block = block.getWorld().getBlockAt(block.getX(), block.getY() - 1, block.getZ()).getState();
|
||||
if (type != block.getType()) {
|
||||
return;
|
||||
}
|
||||
|
||||
blockData = block.getBlockData().getAsString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type.name().endsWith("_BED") && block.getBlockData() instanceof Bed) {
|
||||
if (((Bed) block.getBlockData()).getPart().equals(Part.HEAD)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int currentConsumer = Consumer.currentConsumer;
|
||||
int consumerId = Consumer.newConsumerId(currentConsumer);
|
||||
|
|
@ -136,7 +149,7 @@ public class Queue {
|
|||
replaceType = blockReplaced.getType();
|
||||
replaceData = 0;
|
||||
|
||||
if ((replaceType.equals(Material.SUNFLOWER) || replaceType.equals(Material.LILAC) || replaceType.equals(Material.TALL_GRASS) || replaceType.equals(Material.LARGE_FERN) || replaceType.equals(Material.ROSE_BUSH) || replaceType.equals(Material.PEONY)) && replaceData >= 8) { // Double plant top half
|
||||
if ((replaceType == Material.IRON_DOOR || BlockGroup.DOORS.contains(replaceType) || replaceType.equals(Material.SUNFLOWER) || replaceType.equals(Material.LILAC) || replaceType.equals(Material.TALL_GRASS) || replaceType.equals(Material.LARGE_FERN) || replaceType.equals(Material.ROSE_BUSH) || replaceType.equals(Material.PEONY)) && replaceData >= 8) { // Double plant top half
|
||||
BlockState blockBelow = blockReplaced.getWorld().getBlockAt(blockReplaced.getX(), blockReplaced.getY() - 1, blockReplaced.getZ()).getState();
|
||||
Material belowType = blockBelow.getType();
|
||||
Queue.queueBlockBreak(user, blockBelow, belowType, blockBelow.getBlockData().getAsString(), 0);
|
||||
|
|
|
|||
|
|
@ -3,16 +3,12 @@ package net.coreprotect.consumer.process;
|
|||
import java.sql.PreparedStatement;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.type.Door;
|
||||
|
||||
import net.coreprotect.database.logger.BlockBreakLogger;
|
||||
import net.coreprotect.database.logger.SkullBreakLogger;
|
||||
import net.coreprotect.model.BlockGroup;
|
||||
import net.coreprotect.utility.Util;
|
||||
|
||||
class BlockBreakProcess {
|
||||
|
|
@ -26,16 +22,6 @@ class BlockBreakProcess {
|
|||
}
|
||||
else {
|
||||
BlockBreakLogger.log(preparedStmt, batchCount, user, block.getLocation(), Util.getBlockId(blockType), blockDataId, meta, block.getBlockData().getAsString(), blockData);
|
||||
if (forceData == 5) { // Fix for doors
|
||||
if ((blockType == Material.IRON_DOOR || BlockGroup.DOORS.contains(blockType)) && (replaceType != Material.IRON_DOOR && !BlockGroup.DOORS.contains(replaceType))) {
|
||||
Door door = (Door) block.getBlockData();
|
||||
door.setHalf(Bisected.Half.TOP);
|
||||
blockData = door.getAsString();
|
||||
Location location = block.getLocation();
|
||||
location.setY(location.getY() + 1);
|
||||
BlockBreakLogger.log(preparedStmt, batchCount, user, location, Util.getBlockId(blockType), 0, null, blockData, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue