Because some teachers don't explain their requirements very well. The idea is to demonstrate that the students can write if‑elses. So you tell them not to use Maps, which would usually be regarded as poor programming.
Of course a Map is the best solution. So would be a MorseCharacter class, but the OP is being tested on writing if elses.I used 131071 for hash because it is a Mersenne prime. The %0x20 bit means you get the same hash code for 'A' and for 'a'.
The reason the code only works for single characters is because you are comparing the entire input String against the code for each character. If the string does not exactly match the code for a single character only then it won't do anything.
You are going to have to find an approach to take your string and see if it starts with the code for a character. You will then need to discard the part of the input used and repeat for the next character.