forked from SteamWar/SteamWar
Improve YMLWrapper
This commit is contained in:
@@ -34,8 +34,12 @@ import java.util.stream.Collectors;
|
||||
@ToString
|
||||
public final class GameModeConfig<M, ST, W> {
|
||||
|
||||
private static final Random random = new Random();
|
||||
public static final Function<String, String> ToString = Function.identity();
|
||||
public static final Function<String, SchematicType> ToSchematicType = SchematicType::fromDB;
|
||||
public static final Function<File, String> ToStaticWarGear = __ -> "WarGear";
|
||||
public static final Function<File, String> ToInternalName = file -> file.getName().replace(".yml", "");
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm");
|
||||
private static final Random random = new Random();
|
||||
|
||||
public final boolean loaded;
|
||||
public final File configFile;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.data;
|
||||
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.File;
|
||||
@@ -32,15 +31,8 @@ import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class YMLWrapper<M, ST, W> {
|
||||
final class YMLWrapper<M, ST, W> {
|
||||
|
||||
public static final Function<String, String> ToString = Function.identity();
|
||||
public static final Function<String, SchematicType> ToSchematicType = SchematicType::fromDB;
|
||||
|
||||
public static final Function<File, String> ToStaticWarGear = __ -> "WarGear";
|
||||
public static final Function<File, String> ToInternalName = file -> file.getName().replace(".yml", "");
|
||||
|
||||
private final File file;
|
||||
final Function<String, M> materialMapper;
|
||||
final Function<String, ST> schematicTypeMapper;
|
||||
final Function<String, W> winconditionMapper;
|
||||
@@ -48,8 +40,7 @@ public final class YMLWrapper<M, ST, W> {
|
||||
private final boolean canLoad;
|
||||
private final Map<String, Object> document;
|
||||
|
||||
public YMLWrapper(File file, Function<String, M> materialMapper, Function<String, ST> schematicTypeMapper, Function<String, W> winconditionMapper) {
|
||||
this.file = file;
|
||||
YMLWrapper(File file, Function<String, M> materialMapper, Function<String, ST> schematicTypeMapper, Function<String, W> winconditionMapper) {
|
||||
this.materialMapper = materialMapper;
|
||||
this.schematicTypeMapper = schematicTypeMapper;
|
||||
this.winconditionMapper = winconditionMapper;
|
||||
@@ -70,7 +61,6 @@ public final class YMLWrapper<M, ST, W> {
|
||||
}
|
||||
|
||||
private YMLWrapper(boolean canLoad, Map<String, Object> document, Function<String, M> materialMapper, Function<String, ST> schematicTypeMapper, Function<String, W> winconditionMapper) {
|
||||
this.file = null;
|
||||
this.materialMapper = materialMapper;
|
||||
this.schematicTypeMapper = schematicTypeMapper;
|
||||
this.winconditionMapper = winconditionMapper;
|
||||
|
||||
Reference in New Issue
Block a user