mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Ignore observers during block tracking. Fixes #164
This commit is contained in:
parent
17ac028d7c
commit
e79100c6f1
@ -33,6 +33,7 @@
|
||||
import com.griefdefender.internal.util.BlockUtil;
|
||||
import com.griefdefender.internal.util.NMSUtil;
|
||||
import com.griefdefender.internal.util.VecHelper;
|
||||
import com.griefdefender.permission.GDPermissionManager;
|
||||
import com.griefdefender.permission.GDPermissionUser;
|
||||
import com.griefdefender.util.CauseContextHelper;
|
||||
import com.griefdefender.util.Direction;
|
||||
@ -104,13 +105,22 @@ public void onBlockPlaceMonitor(BlockPlaceEvent event) {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPhysicsMonitor(BlockPhysicsEvent event) {
|
||||
if (!event.isCancelled()) {
|
||||
final Vector3i testPos = VecHelper.toVector3i(event.getBlock().getLocation());
|
||||
final String targetBlockName = GDPermissionManager.getInstance().getPermissionIdentifier(event.getBlock());
|
||||
if (targetBlockName.equals("minecraft:observer")) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Block sourceBlock = NMSUtil.getInstance().getSourceBlock(event);
|
||||
final Location sourceLocation = sourceBlock != null ? sourceBlock.getLocation() : null;
|
||||
if (sourceLocation != null && sourceLocation.equals(event.getBlock().getLocation())) {
|
||||
return;
|
||||
}
|
||||
if (sourceBlock != null) {
|
||||
final String sourceBlockName = GDPermissionManager.getInstance().getPermissionIdentifier(sourceBlock);
|
||||
if (sourceBlockName.equals("minecraft:observer")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(event.getBlock().getWorld().getUID());
|
||||
final GDChunk gpChunk = claimWorldManager.getChunk(event.getBlock().getChunk());
|
||||
@ -129,7 +139,6 @@ public void onBlockPhysicsMonitor(BlockPhysicsEvent event) {
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerInteractBlockSecondary(PlayerInteractEvent event) {
|
||||
|
Loading…
Reference in New Issue
Block a user