Skip to content

Commit

Permalink
skip physics checks if not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
TehBrian committed Oct 31, 2023
1 parent 9e31148 commit 06677a4
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,19 @@ public void onSpectate(final PlayerStartSpectatingEntityEvent event) {
}
}

private boolean shouldCheckPhysics() {
return this.configConfig.data().settings().disableRedstone()
|| this.configConfig.data().settings().disableGravityPhysics()
|| this.configConfig.data().settings().disablePhysics();
}

@EventHandler
public void onBlockPhysics(final BlockPhysicsEvent event) {
// don't perform any relatively expensive checks if we don't need to.
if (!this.shouldCheckPhysics()) {
return;
}

final Block block = event.getBlock();

if (block.getLocation().add(0, -1, 0).getBlock().getType().name().toLowerCase().contains("grass_block")) {
Expand Down

0 comments on commit 06677a4

Please sign in to comment.