mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-09-30 04:37:29 +02:00
Added logging for destruction of suspicious sand/gravel
This commit is contained in:
parent
d414db1c0b
commit
e0d65453b6
@ -201,4 +201,9 @@ public class BukkitAdapter implements BukkitInterface {
|
|||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasGravity(Material scanType) {
|
||||||
|
return scanType.hasGravity();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,4 +63,6 @@ public interface BukkitInterface {
|
|||||||
|
|
||||||
public Material getPlantSeeds(Material material);
|
public Material getPlantSeeds(Material material);
|
||||||
|
|
||||||
|
public boolean hasGravity(Material scanType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,4 +92,9 @@ public class Bukkit_v1_20 extends Bukkit_v1_19 implements BukkitInterface {
|
|||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasGravity(Material scanType) {
|
||||||
|
return scanType.hasGravity() || scanType == Material.SUSPICIOUS_GRAVEL || scanType == Material.SUSPICIOUS_SAND;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
|||||||
Block scanBlock = world.getBlockAt(scanLocation);
|
Block scanBlock = world.getBlockAt(scanLocation);
|
||||||
Material scanType = scanBlock.getType();
|
Material scanType = scanBlock.getType();
|
||||||
if (scanMin == 5) {
|
if (scanMin == 5) {
|
||||||
if (scanType.hasGravity()) {
|
if (BukkitAdapter.ADAPTER.hasGravity(scanType)) {
|
||||||
if (Config.getConfig(world).BLOCK_MOVEMENT) {
|
if (Config.getConfig(world).BLOCK_MOVEMENT) {
|
||||||
// log the top-most sand/gravel block as being removed
|
// log the top-most sand/gravel block as being removed
|
||||||
int scanY = y + 2;
|
int scanY = y + 2;
|
||||||
@ -134,7 +134,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
|||||||
while (!topFound) {
|
while (!topFound) {
|
||||||
Block topBlock = world.getBlockAt(x, scanY, z);
|
Block topBlock = world.getBlockAt(x, scanY, z);
|
||||||
Material topMaterial = topBlock.getType();
|
Material topMaterial = topBlock.getType();
|
||||||
if (!topMaterial.hasGravity()) {
|
if (!BukkitAdapter.ADAPTER.hasGravity(topMaterial)) {
|
||||||
scanLocation = new Location(world, x, (scanY - 1), z);
|
scanLocation = new Location(world, x, (scanY - 1), z);
|
||||||
topFound = true;
|
topFound = true;
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ public final class BlockBreakListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (scanMin == 5) {
|
else if (scanMin == 5) {
|
||||||
if (scanType.hasGravity()) {
|
if (BukkitAdapter.ADAPTER.hasGravity(scanType)) {
|
||||||
log = true;
|
log = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +326,10 @@ public final class BlockBreakListener extends Queue implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Block placementBlock : placementMap) {
|
for (Block placementBlock : placementMap) {
|
||||||
queueBlockPlace(user, block.getState(), placementBlock.getType(), null, null, -1, 0, placementBlock.getBlockData().getAsString());
|
Material placementType = placementBlock.getType();
|
||||||
|
if (placementType.hasGravity()) {
|
||||||
|
queueBlockPlace(user, block.getState(), placementType, null, null, -1, 0, placementBlock.getBlockData().getAsString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user