mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-12-03 13:23:32 +01:00
Handles default root advancement scoring and better presentation.
This commit is contained in:
parent
c7473785df
commit
c39ded9e16
@ -153,8 +153,14 @@ public class AdvancementsManager {
|
|||||||
// Wrong world
|
// Wrong world
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
String adv = "advancements." + advancement.getKey().toString();
|
||||||
// Check score of advancement
|
// 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) {
|
if (score == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class AdvancementListener implements Listener {
|
|||||||
|
|
||||||
private void informPlayer(User user, NamespacedKey key, int score) {
|
private void informPlayer(User user, NamespacedKey key, int score) {
|
||||||
user.getPlayer().playSound(user.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1F, 2F);
|
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()) {
|
if (adv.isEmpty()) {
|
||||||
adv = Util.prettifyText(key.getKey().substring(key.getKey().lastIndexOf("/") + 1, key.getKey().length()));
|
adv = Util.prettifyText(key.getKey().substring(key.getKey().lastIndexOf("/") + 1, key.getKey().length()));
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Lists how many blocks the box will increase when advancement occurs
|
# Lists how many blocks the box will increase when advancement occurs
|
||||||
settings:
|
settings:
|
||||||
|
default-root-increase: 0
|
||||||
unknown-advancement-increase: 1
|
unknown-advancement-increase: 1
|
||||||
advancements:
|
advancements:
|
||||||
'minecraft:adventure/adventuring_time': 1
|
'minecraft:adventure/adventuring_time': 1
|
||||||
|
Loading…
Reference in New Issue
Block a user