// Check if config.json exists. If not, we generate a new config.
if(!configFile.exists()){
getLogger().info("config.json could not be found. Generating a default configuration ...");
config=newConfigContainer();
Grasscutter.saveConfig(config);
return;
}
// If the file already exists, we attempt to load it.
try(FileReaderfile=newFileReader(configFile)){
config=gson.fromJson(file,ConfigContainer.class);
}catch(Exceptionexception){
getLogger().error("There was an error while trying to load the configuration from config.json. Please make sure that there are no syntax errors. If you want to start with a default configuration, delete your existing config.json.");
System.exit(1);
}
}
/**
* Saves the provided server configuration.
* @param config The configuration to save, or null for a new one.
// Check if config.json exists. If not, we generate a new config.
if(!configFile.exists()){
getLogger().info("config.json could not be found. Generating a default configuration ...");
config=newConfigContainer();
Grasscutter.saveConfig(config);
return;
}
// If the file already exists, we attempt to load it.
try(FileReaderfile=newFileReader(configFile)){
config=gson.fromJson(file,ConfigContainer.class);
}catch(Exceptionexception){
getLogger().error("There was an error while trying to load the configuration from config.json. Please make sure that there are no syntax errors. If you want to start with a default configuration, delete your existing config.json.");
System.exit(1);
}
}
/**
* Saves the provided server configuration.
*
* @param config The configuration to save, or null for a new one.
// If there's still no targetPlayer at this point, use previously-set target
if(targetPlayer==null){
if(targetPlayerIds.containsKey(playerId)){
targetPlayer=Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId),true);// We check every time in case the target is deleted after being targeted
if(this.targetPlayerIds.containsKey(playerId)){
targetPlayer=Grasscutter.getGameServer().getPlayerByUid(this.targetPlayerIds.get(playerId),true);// We check every time in case the target is deleted after being targeted
"success":"Changed climate type to %s with weather type %s.",
"invalid_id":"Invalid ID.",
"description":"Changes the weather"
"usage":"Usage: weather [weatherId] [climateType]\nWeather IDs can be found in WeatherExcelConfigData.json.\nClimate types: sunny, cloudy, rain, thunderstorm, snow, mist",
"success":"Set weather ID to %s with climate type %s.",
"status":"Current weather ID is %s with climate type %s.",
"description":"Changes weather ID and climate type. Weather IDs can be found in WeatherExcelConfigData.json.\nClimate types: sunny, cloudy, rain, thunderstorm, snow, mist"
},
"ban":{
"description":"Ban a player",
"command_usage":"Usage: ban <playerId> [timestamp] [reason]",
"success":"Successful.",
"failure":"Failed, player not found.",
"invalid_time":"Unable to parse timestamp.",
"invalid_player_id":"Unable to parse player ID.",
"command_usage":"Usage: ban <playerId> [timestamp] [reason]"
"success":"Le type de climat a été changé à %s avec le type de météo %s.",
"invalid_id":"ID invalide.",
"description":"Change la météo"
"description":"Change la météo. Weather IDs can be found in WeatherExcelConfigData.json.\nClimate types: sunny, cloudy, rain, thunderstorm, snow, mist.",
"usage":"Utilisation: weather [weatherId] [climateType]\nWeather IDs can be found in WeatherExcelConfigData.json.\nClimate types: sunny, cloudy, rain, thunderstorm, snow, mist.",
"success":"Set weather ID to %s with climate type %s.",
"status":"Current weather ID is %s with climate type %s."