You should rather use the interactive Beanshell interpreter to test out Beanshell expression. Using an IDE is way overkill for what you want to accomplish. Note that the Beanshell code is not Java per-se, but rather a separate interpreter interpreting something that looks a lot like Java.
In the above, you have a spurious ; after AmmoPressed. Try to remove that. Did you check your errorLog (see How to report problems)
OK, try the alternative with
{AmmoPressed == 0 ? 1 : 0}
Yours,
Christian