mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2025-01-08 19:07:46 +01:00
Adds a default box change setting for unknown advancements.
Makes adding custom advancement datapacks easier because the default advancement reward will be to increase the box by 1.
This commit is contained in:
parent
cac0c64654
commit
c7473785df
@ -32,6 +32,7 @@ public class AdvancementsManager {
|
||||
// A cache of island levels.
|
||||
private final Map<String, IslandAdvancements> cache;
|
||||
private final YamlConfiguration advConfig;
|
||||
private int unknownAdvChange;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
@ -53,6 +54,7 @@ public class AdvancementsManager {
|
||||
} else {
|
||||
try {
|
||||
advConfig.load(advFile);
|
||||
unknownAdvChange = advConfig.getInt("settings.unknown-advancement-increase", 0);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
addon.logError("advancements.yml cannot be found! " + e.getLocalizedMessage());
|
||||
}
|
||||
@ -152,7 +154,7 @@ public class AdvancementsManager {
|
||||
return 0;
|
||||
}
|
||||
// Check score of advancement
|
||||
int score = advConfig.getInt("advancements." + advancement.getKey().toString());
|
||||
int score = advConfig.getInt("advancements." + advancement.getKey().toString(), this.unknownAdvChange);
|
||||
if (score == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Lists how many blocks the box will increase when advancement occurs
|
||||
settings:
|
||||
unknown-advancement-increase: 1
|
||||
advancements:
|
||||
'minecraft:adventure/adventuring_time': 1
|
||||
'minecraft:adventure/arbalistic': 1
|
||||
|
Loading…
Reference in New Issue
Block a user