0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Add fix for corrupted keybinds.json

This commit is contained in:
Alexander01998 2019-08-14 04:46:10 +02:00
parent 1177179c75
commit 57eab1a82c

View File

@ -12,6 +12,7 @@ import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import com.google.gson.JsonObject;
@ -34,7 +35,7 @@ public final class KeybindsFile
try
{
WsonObject wson = JsonUtils.parseFileToObject(path);
HashSet<Keybind> newKeybinds = new HashSet<>();
Set<Keybind> newKeybinds = new HashSet<>();
for(Entry<String, String> entry : wson.getAllStrings().entrySet())
{
@ -48,6 +49,9 @@ public final class KeybindsFile
newKeybinds.add(keybind);
}
if(newKeybinds.isEmpty())
newKeybinds = KeybindList.DEFAULT_KEYBINDS;
list.setKeybinds(newKeybinds);
}catch(NoSuchFileException e)