NPCLogic.java

package io.github.some_example_name;

public class NPCLogic {

    public static boolean update(
        boolean currentlyShowing,
        float distanceToPlayer,
        boolean ePressed,
        boolean spacePressed
    ) {
        if (distanceToPlayer < 50f && ePressed) {
            return true;
        }

        if (currentlyShowing && distanceToPlayer > 60f) {
            return false;
        }

        if (spacePressed) {
            return false;
        }

        return currentlyShowing;
    }
}