mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2025-01-15 20:32:24 +01:00
Additional cleanup in ChestTool
This commit is contained in:
parent
e178ed91ca
commit
40ff1e7778
@ -17,7 +17,6 @@ public class ChestTool {
|
||||
}
|
||||
|
||||
public static void updateDoubleChest(Block block, BlockData blockData, boolean forceValidation) {
|
||||
// modifying container, trigger physics update on both sides of double chest
|
||||
if (!(blockData instanceof Chest) || ((Chest) blockData).getType() == Type.SINGLE) {
|
||||
return;
|
||||
}
|
||||
@ -64,16 +63,18 @@ public class ChestTool {
|
||||
}
|
||||
}
|
||||
|
||||
if (newFace == null) {
|
||||
return;
|
||||
}
|
||||
if (newFace != null) {
|
||||
Type newType = (chestType == Type.LEFT) ? Type.RIGHT : Type.LEFT;
|
||||
Block relativeBlock = block.getRelative(newFace);
|
||||
if (!forceValidation && (relativeBlock.getBlockData() instanceof Chest) && ((Chest) relativeBlock.getBlockData()).getType() == newType) {
|
||||
return;
|
||||
}
|
||||
|
||||
Type newType = (chestType == Type.LEFT) ? Type.RIGHT : Type.LEFT;
|
||||
Block relativeBlock = block.getRelative(newFace);
|
||||
if (!forceValidation && (relativeBlock.getBlockData() instanceof Chest) && ((Chest) relativeBlock.getBlockData()).getType() == newType) {
|
||||
return;
|
||||
validateContainer(blockData, newType, block, relativeBlock);
|
||||
}
|
||||
}
|
||||
|
||||
private static void validateContainer(BlockData blockData, Type newType, Block block, Block relativeBlock) {
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(CoreProtect.getInstance(), () -> {
|
||||
try {
|
||||
BlockData relativeBlockData = relativeBlock.getBlockData();
|
||||
|
Loading…
Reference in New Issue
Block a user