mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-01-21 21:01:56 +01:00
Add default score of unknown recipes
This commit is contained in:
parent
d1df71574a
commit
bb9088d84d
@ -35,6 +35,7 @@ public class AdvancementsManager {
|
||||
private final Map<String, IslandAdvancements> cache;
|
||||
private final YamlConfiguration advConfig;
|
||||
private int unknownAdvChange;
|
||||
private int unknownRecipeChange;
|
||||
|
||||
/**
|
||||
* @param addon addon
|
||||
@ -57,6 +58,7 @@ public class AdvancementsManager {
|
||||
try {
|
||||
advConfig.load(advFile);
|
||||
unknownAdvChange = advConfig.getInt("settings.unknown-advancement-increase", 0);
|
||||
unknownRecipeChange = advConfig.getInt("settings.unknown-recipe-increase", 0);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
addon.logError("advancements.yml cannot be found! " + e.getLocalizedMessage());
|
||||
}
|
||||
@ -215,12 +217,22 @@ public class AdvancementsManager {
|
||||
/**
|
||||
* Get the score for this advancement
|
||||
* @param key - advancement key as stored in the config file
|
||||
* @return score of advancement
|
||||
* @return score of advancement, or default values if the key is not in the file
|
||||
*/
|
||||
public int getScore(String string) {
|
||||
String adv = "advancements." + string;
|
||||
// Check score of advancement
|
||||
return !advConfig.contains(adv) && adv.endsWith("/root") ? advConfig.getInt("settings.default-root-increase") : advConfig.getInt(adv, this.unknownAdvChange);
|
||||
if (advConfig.contains(adv)) {
|
||||
return advConfig.getInt(adv, this.unknownAdvChange);
|
||||
}
|
||||
// Unknowns
|
||||
if (adv.endsWith("/root")) {
|
||||
return advConfig.getInt("settings.default-root-increase");
|
||||
}
|
||||
if (adv.contains("minecraft:recipes")) {
|
||||
return this.unknownRecipeChange;
|
||||
}
|
||||
return this.unknownAdvChange;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
settings:
|
||||
default-root-increase: 0
|
||||
unknown-advancement-increase: 1
|
||||
unknown-recipe-increase: 0
|
||||
advancements:
|
||||
'minecraft:adventure/adventuring_time': 1
|
||||
'minecraft:adventure/arbalistic': 1
|
||||
|
Loading…
Reference in New Issue
Block a user