38 lines
1.4 KiB
Java
38 lines
1.4 KiB
Java
package com.bernard.greposimu;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.util.Map;
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
import com.bernard.greposimu.model.game.GameConfig;
|
|
import com.bernard.greposimu.model.game.GrepoYaml;
|
|
import com.bernard.greposimu.model.simulator.objective.TownObjective;
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
|
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.Feature;
|
|
|
|
@SpringBootApplication
|
|
public class GrepoSimuApplication {
|
|
|
|
public static GameConfig GREPOLIS_GC;
|
|
public static Map<String, TownObjective> OBJECTIVES;
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
GREPOLIS_GC = GrepoSimu.makeGameData();
|
|
File objectiveFile = new File("/home/mysaa/Documents/Projets/eclipse-workspace/GrepoSimu/src/test/resources/objectives.yml");
|
|
|
|
ObjectMapper om = new ObjectMapper(new YAMLFactory().disable(Feature.WRITE_DOC_START_MARKER));
|
|
om.registerModule(new GrepoYaml(GREPOLIS_GC));
|
|
|
|
JavaType objType = om.getTypeFactory().constructParametricType(Map.class, String.class,TownObjective.class);
|
|
OBJECTIVES = om.readValue(objectiveFile, objType);
|
|
|
|
SpringApplication.run(GrepoSimuApplication.class, args);
|
|
}
|
|
|
|
}
|