Dont allow repeats on Joystick buttons?

i have a portal to enter, a joystick button triggers a command weather to enter or not.



sometimes i return to the map i came from because the trigger repeats. Is there a way to disable the repeats?

please help me, this is my codeā€¦


package salipawpaw.actions;

import com.jme.input.controls.GameControl;
import com.jme.input.controls.GameControlManager;
import com.jme.input.controls.binding.JoystickAxisBinding;
import com.jme.input.controls.binding.JoystickButtonBinding;
import com.jme.input.controls.binding.KeyboardBinding;
import com.jme.input.controls.binding.MouseAxisBinding;
import com.jme.input.joystick.Joystick;
import com.jme.input.joystick.JoystickInput;
import com.jme.math.Matrix3f;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.scene.Controller;
import com.jme.scene.Node;
import com.jme.system.DisplaySystem;
import com.jmex.model.ogrexml.anim.MeshAnimationController;
import salipawpaw.SalipawpawGameState;
import static salipawpaw.actions.PlayerController.PlayerAction.*;
import static com.jme.input.KeyInput.*;
import static com.jme.input.controls.binding.MouseAxisBinding.*;
/**
 *
 * @author dru
 */
public class PlayerController extends Controller{

    private Node node;
    private GameControlManager manager;

    private Joystick joystick;
    private MeshAnimationController animWalk;

    //temp variables for turn actions
    Matrix3f incr = new Matrix3f();
    Matrix3f tempMa = new Matrix3f();
    Matrix3f tempMb = new Matrix3f();

    protected float turnSpeed = 2.0f;
    protected float speed = 14.0f;
    private Vector3f tempVa = new Vector3f();

    private Camera cam;
   
    public enum PlayerAction {FORWARD, BACKWARD, TURN_RIGHT, TURN_LEFT,
                        CAM_LEFT, CAM_RIGHT, CAM_UP, CAM_DOWN,
                        ENTER};
   
    public PlayerController(Node node, MeshAnimationController anim){
        this.node = node;
        this.setRepeatType(0);
        manager = new GameControlManager();
        cam = DisplaySystem.getDisplaySystem().getRenderer().getCamera();

        animWalk = anim;
        animWalk.setAnimation("WalkCycle");
        animWalk.setSpeed(3.2f);
        animWalk.setActive(false);

        //create action / game control based on the enums
        for(PlayerAction action: PlayerAction.values()){
            manager.addControl(action.name());
        }

        setJoystick();
        setKey();
        setMouse();

    }

    private void setKey(){

        bindKey(TURN_LEFT, KEY_A);
        bindKey(TURN_RIGHT, KEY_D);
        bindKey(FORWARD, KEY_W);
        bindKey(BACKWARD, KEY_S);
        bindKey(ENTER, KEY_SPACE);
    }

    private void setJoystick(){

        if(JoystickInput.get().getJoystickCount() > 0){
            joystick = JoystickInput.get().getJoystick(0);

            //left joystick
            bindJoystickAxis(TURN_LEFT, 0, true);
            bindJoystickAxis(TURN_RIGHT, 0, false);
            bindJoystickAxis(FORWARD, 1, true);
            bindJoystickAxis(BACKWARD, 1, false);

            //right joystick
            bindJoystickAxis(CAM_LEFT, 3, true);
            bindJoystickAxis(CAM_RIGHT, 3, false);
            bindJoystickAxis(CAM_UP, 4, true);
            bindJoystickAxis(CAM_DOWN, 4, false);

            bindJoystickButton(ENTER,2);
        }
    }

    private void setMouse(){

        bindMouseAxis(CAM_RIGHT, AXIS_X, false);
        bindMouseAxis(CAM_LEFT, AXIS_X, true);
        bindMouseAxis(CAM_UP, AXIS_Y, false);
        bindMouseAxis(CAM_DOWN, AXIS_Y, true);
    }


    private void bindKey(PlayerAction action, int key){
        final GameControl control = manager.getControl(action.name());
        control.addBinding(new KeyboardBinding((key)));
    }


    private void bindMouseAxis(PlayerAction action, int axis, boolean isReverse){
        final GameControl control = manager.getControl(action.name());
        control.addBinding(new MouseAxisBinding(axis, isReverse));
    }

    private void bindJoystickAxis(PlayerAction action, int axis, boolean isReverse){
        final GameControl control = manager.getControl(action.name());
        control.addBinding(new JoystickAxisBinding(joystick, axis, isReverse));
    }

    private void bindJoystickButton(PlayerAction action, int button){
        final GameControl control = manager.getControl(action.name());
        control.addBinding(new JoystickButtonBinding(joystick, button));
    }


    private float value(PlayerAction action){
        return manager.getControl(action.name()).getValue();
    }
   
    @Override
    public void update(float time){

        if((value(BACKWARD) == 0) && value(FORWARD) == 0)
            animWalk.setActive(false);

        if(value(FORWARD) == 1){
            forwardAction(time);
            animWalk.setActive(true);
        }

        if(value(BACKWARD) == 1){
            backwardAction(time);
            animWalk.setActive(true);
        }

        if(value(TURN_RIGHT) == 1){
            turnAction(-1, time);
        }

        if(value(TURN_LEFT) == 1){
            turnAction(1, time);
        }

        if((value(ENTER) == 1) && (!SalipawpawGameState.isEntered)){
            System.out.println("REPEAT");
        }

        if(value(CAM_UP) == 1){
        }
    }

    private void forwardAction(float time){
        node.getLocalTranslation().addLocal(node.getLocalRotation().getRotationColumn(2, tempVa).multLocal(time*speed));
    }

    private void backwardAction(float time){
        node.getLocalTranslation().addLocal(node.getLocalRotation().getRotationColumn(2, tempVa).multLocal(-time*speed/1.5f));
    }

    private void turnAction(int modifier, float time){

        if(value(FORWARD) == 1){
            incr.fromAngleNormalAxis(modifier * (time*turnSpeed), Vector3f.UNIT_Y);
        }
       
        if(value(BACKWARD) == 1){
            incr.fromAngleNormalAxis(-modifier * (time*turnSpeed), Vector3f.UNIT_Y);
        }

        node.getLocalRotation().fromRotationMatrix(
                incr.mult(node.getLocalRotation().toRotationMatrix(tempMa), tempMb));

        node.getLocalRotation().normalize();
    }

}