PreferencesGameSettings problem

Hello darkfrog!

There is a problem in PreferencesGameSettings: It's not possible to remove a key. This wouldn't be so bad if we could store a null value with PreferencesGameSettings.set(key, null), but this gives a NPE. Of course there are workarounds for this, but I think removing keys as a very basic operation should be supported.

I see two possible solutions:

  1. add a remove(String key) method to the GameSettings interface and and PreferencesGameSettings (simply calling preferences.remove(key)). I'd prefer this.

  2. include a check for null:

public void set(String name, String value) {
   if (value == null) {
   } else {
        preferences.put(name, value);

Fortunately for you I already had jME open so I made both of those changes.  I didn't realize it would throw an exception if you tried to set the value to null on a preference so I just expected you could use that to remove (but that will work now).

Thank you  :D  :D  :smiley: