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:
parent
1177179c75
commit
57eab1a82c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user