Handles default root advancement scoring and better presentation.

This commit is contained in:
tastybento 2021-03-20 10:20:21 -07:00
parent c7473785df
commit c39ded9e16
3 changed files with 9 additions and 2 deletions

View File

@ -153,8 +153,14 @@ public class AdvancementsManager {
// Wrong world
return 0;
}
String adv = "advancements." + advancement.getKey().toString();
// Check score of advancement
int score = advConfig.getInt("advancements." + advancement.getKey().toString(), this.unknownAdvChange);
int score = 0;
if (!advConfig.contains(adv) && adv.endsWith("/root")) {
score = advConfig.getInt("settings.default-root-increase");
} else {
score = advConfig.getInt(adv, this.unknownAdvChange);
}
if (score == 0) {
return 0;
}

View File

@ -104,7 +104,7 @@ public class AdvancementListener implements Listener {
private void informPlayer(User user, NamespacedKey key, int score) {
user.getPlayer().playSound(user.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
String adv = user.getTranslation("boxed.advancements." + key.toString());
String adv = user.getTranslationOrNothing("boxed.advancements." + key.toString());
if (adv.isEmpty()) {
adv = Util.prettifyText(key.getKey().substring(key.getKey().lastIndexOf("/") + 1, key.getKey().length()));
}

View File

@ -1,5 +1,6 @@
# Lists how many blocks the box will increase when advancement occurs
settings:
default-root-increase: 0
unknown-advancement-increase: 1
advancements:
'minecraft:adventure/adventuring_time': 1