mirror of https://github.com/Soyandroid/aqua
[chuni] Read reboot time from database
parent
7fc1127026
commit
49d105de4e
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
|||
</parent>
|
||||
<groupId>icu.samnya</groupId>
|
||||
<artifactId>aqua</artifactId>
|
||||
<version>0.0.13-RELEASE</version>
|
||||
<version>0.0.14-RELEASE</version>
|
||||
<name>Aqua Server</name>
|
||||
<description>A multipurpose game server</description>
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import icu.samnyan.aqua.sega.chunithm.handler.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.GetGameSettingResp;
|
||||
import icu.samnyan.aqua.sega.chunithm.model.response.data.GameSetting;
|
||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -22,21 +24,29 @@ public class GetGameSettingHandler implements BaseHandler {
|
|||
|
||||
private final StringMapper mapper;
|
||||
|
||||
private final PropertyEntryRepository propertyEntryRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameSettingHandler(StringMapper mapper) {
|
||||
public GetGameSettingHandler(StringMapper mapper, PropertyEntryRepository propertyEntryRepository) {
|
||||
this.mapper = mapper;
|
||||
this.propertyEntryRepository = propertyEntryRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
PropertyEntry start = propertyEntryRepository.findByPropertyKey("reboot_start_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_start_time", "2020-01-01 23:59:00.0"));
|
||||
PropertyEntry end = propertyEntryRepository.findByPropertyKey("reboot_end_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_end_time", "2020-01-01 23:59:00.0"));
|
||||
|
||||
GameSetting gameSetting = new GameSetting(
|
||||
1,
|
||||
false,
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
start.getPropertyValue(),
|
||||
end.getPropertyValue(),
|
||||
false,
|
||||
300,
|
||||
300,
|
||||
|
|
|
@ -16,8 +16,8 @@ public class GameSetting {
|
|||
@JsonProperty("isMaintenance")
|
||||
private boolean isMaintenance;
|
||||
private int requestInterval;
|
||||
private int rebootStartTime;
|
||||
private int rebootEndTime;
|
||||
private String rebootStartTime;
|
||||
private String rebootEndTime;
|
||||
@JsonProperty("isBackgroundDistribute")
|
||||
private boolean isBackgroundDistribute;
|
||||
private int maxCountCharacter;
|
||||
|
|
Loading…
Reference in New Issue