Skip to content

Commit

Permalink
remove disable-redstone dependency on disable-physics
Browse files Browse the repository at this point in the history
  • Loading branch information
TehBrian committed Oct 31, 2023
1 parent 2f25d32 commit f6732f7
Showing 1 changed file with 24 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,32 +72,34 @@ public void onBlockPhysics(final BlockPhysicsEvent event) {
return;
}

final String lowerName = event.getChangedType().name().toLowerCase();

if (lowerName.contains("chest")
|| lowerName.contains("stair")
|| lowerName.contains("fence")
|| lowerName.contains("pane")
|| lowerName.contains("wall")
|| lowerName.contains("bar")
|| lowerName.contains("door")) {
final String changed = event.getChangedType().name().toLowerCase();

if (changed.contains("chest")
|| changed.contains("stair")
|| changed.contains("fence")
|| changed.contains("pane")
|| changed.contains("wall")
|| changed.contains("bar")
|| changed.contains("door")) {
return;
}

if (!this.configConfig.data().settings().disableRedstone()) {
if (lowerName.contains("redstone")
|| lowerName.contains("daylight")
|| lowerName.contains("diode")
|| lowerName.contains("note")
|| lowerName.contains("lever")
|| lowerName.contains("button")
|| lowerName.contains("command")
|| lowerName.contains("tripwire")
|| lowerName.contains("plate")
|| lowerName.contains("string")
|| lowerName.contains("piston")
|| lowerName.contains("observer")) {
if (this.configConfig.data().settings().disableRedstone()) {
if (changed.contains("redstone")
|| changed.contains("daylight")
|| changed.contains("diode")
|| changed.contains("note")
|| changed.contains("lever")
|| changed.contains("button")
|| changed.contains("command")
|| changed.contains("tripwire")
|| changed.contains("plate")
|| changed.contains("string")
|| changed.contains("piston")
|| changed.contains("observer")) {
if (!block.getType().name().contains("air")) {
this.logger.debug("Physics were cancelled because disable-redstone: true");
event.setCancelled(true);
return;
}
}
Expand Down

0 comments on commit f6732f7

Please sign in to comment.