Skip to content

Commit

Permalink
refactor: use pattern matching for instanceof
Browse files Browse the repository at this point in the history
  • Loading branch information
sotterbeck committed Aug 15, 2024
1 parent 475d57c commit 7406a65
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ public GateInteractListener(FareGateProtectionInteractor fareGateProtectionInter
@EventHandler
public void onFenceGateInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.RIGHT_CLICK_BLOCK
|| !(Objects.requireNonNull(event.getClickedBlock()).getBlockData() instanceof Gate)
|| !(Objects.requireNonNull(event.getClickedBlock()).getBlockData() instanceof Gate gate)
) {
return;
}

Gate gate = (Gate) event.getClickedBlock().getBlockData();
Location location = event.getClickedBlock().getLocation();
String orientation = gate.getFacing().toString();
GateRequestModel request = new GateRequestModel(location.getBlockX(), location.getBlockY(), location.getBlockZ(), orientation);
Expand Down

0 comments on commit 7406a65

Please sign in to comment.