How to prevent liquid from flowing down?

In this way, I can only prevent the flow of liquid, and I can’t get the properties related to the downward flow.
I want to allow liquid to flow laterally, not downward.

for (Transaction<BlockSnapshot> trans : event.getTransactions()) {
            Optional<MatterProperty> matter = trans.getFinal().getState().getProperty(MatterProperty.class);
            if (matter.isPresent() && matter.get().getValue() == MatterProperty.Matter.LIQUID) {

You should be able to get the position of the original liquid block via event.getCause().first(LocatableBlock.class) - hopefully this helps.

EDIT: I just tried that, and apparently that doesn’t work.