Skip to content

Commit

Permalink
fix: protect all types of gates in fare gates
Browse files Browse the repository at this point in the history
  • Loading branch information
sotterbeck committed Aug 12, 2024
1 parent e8ed953 commit c082a0a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import de.sotterbeck.iumetro.usecase.faregate.FareGateProtectionInteractor;
import de.sotterbeck.iumetro.usecase.faregate.GateRequestModel;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.data.type.Gate;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand All @@ -22,8 +22,9 @@ public GateInteractListener(FareGateProtectionInteractor fareGateProtectionInter

@EventHandler
public void onFenceGateInteract(PlayerInteractEvent event) {
Block clickedBlock = Objects.requireNonNull(event.getClickedBlock());
if (event.getAction() != Action.RIGHT_CLICK_BLOCK
|| Objects.requireNonNull(event.getClickedBlock()).getType() != Material.OAK_FENCE_GATE
|| !(clickedBlock.getBlockData() instanceof Gate)
) {
return;
}
Expand Down

0 comments on commit c082a0a

Please sign in to comment.