Fixed config saving and value setting. Probably fixes #798
This commit is contained in:
parent
575a6b6ea0
commit
f2b0e3e3c3
@ -6,6 +6,7 @@ import java.io.FileWriter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@ -55,15 +56,23 @@ public class YamlConfiguration extends ConfigurationProvider
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Configuration load(Reader reader)
|
public Configuration load(Reader reader)
|
||||||
{
|
{
|
||||||
Configuration conf = new Configuration( (Map<String, Object>) yaml.get().loadAs( reader, Map.class ), null );
|
Map<String,Object> map = yaml.get().loadAs( reader, LinkedHashMap.class );
|
||||||
return conf;
|
if( map == null )
|
||||||
|
{
|
||||||
|
map = new LinkedHashMap<>();
|
||||||
|
}
|
||||||
|
return new Configuration( map , null );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Configuration load(String string)
|
public Configuration load(String string)
|
||||||
{
|
{
|
||||||
Configuration conf = new Configuration( (Map<String, Object>) yaml.get().loadAs( string, Map.class ), null );
|
Map<String,Object> map = yaml.get().loadAs( string, LinkedHashMap.class );
|
||||||
return conf;
|
if( map == null )
|
||||||
|
{
|
||||||
|
map = new LinkedHashMap<>();
|
||||||
|
}
|
||||||
|
return new Configuration( map, null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user