diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java index 036374f..b265fd3 100644 --- a/src/com/dre/brewery/Brew.java +++ b/src/com/dre/brewery/Brew.java @@ -374,6 +374,7 @@ public class Brew { if (ageTime >= 1) { lore.updateAgeLore(false); } + lore.updateQualityStars(false); lore.write(); item.setItemMeta(meta); } @@ -507,6 +508,7 @@ public class Brew { if (BConfig.colorInBrewer != BrewLore.hasColorLore(potionMeta)) { lore.convertLore(BConfig.colorInBrewer); } + lore.updateQualityStars(BConfig.colorInBrewer); } lore.updateDistillLore(BConfig.colorInBrewer); lore.write(); @@ -585,6 +587,7 @@ public class Brew { if (BConfig.colorInBarrels && !unlabeled && currentRecipe != null) { lore.updateWoodLore(true); } + lore.updateQualityStars(BConfig.colorInBarrels); } lore.write(); touch(); diff --git a/src/com/dre/brewery/lore/BrewLore.java b/src/com/dre/brewery/lore/BrewLore.java index 23819ea..d9d549c 100644 --- a/src/com/dre/brewery/lore/BrewLore.java +++ b/src/com/dre/brewery/lore/BrewLore.java @@ -205,6 +205,28 @@ public class BrewLore { } } + public void updateQualityStars(boolean qualityColor) { + if (brew.hasRecipe() && brew.getCurrentRecipe().needsToAge() && brew.getAgeTime() < 0.5) { + return; + } + if (!brew.isUnlabeled()) { + int stars = (brew.getQuality() + 1) / 2; + StringBuilder b = new StringBuilder(stars); + for (; stars > 0; stars--) { + b.append("⭑"); + } + String color; + if (qualityColor) { + color = getQualityColor(brew.getQuality()); + } else { + color = brew.getQuality() >= 10 ? "§6" : "§8"; + } + addOrReplaceLore(Type.STARS, color, b.toString()); + } else { + removeLore(Type.STARS); + } + } + /** * Converts to/from qualitycolored Lore */ @@ -214,6 +236,7 @@ public class BrewLore { } updateCustomLore(); + updateQualityStars(toQuality); if (!brew.isUnlabeled()) { // Ingredients @@ -419,14 +442,15 @@ public class BrewLore { } public enum Type { - CUSTOM("§t", 0), - SPACE("§u", 1), + STARS("§s", 0), + CUSTOM("§t", 1), + SPACE("§u", 2), - INGR("§v", 2), - COOK("§w", 3), - DISTILL("§x", 4), - AGE("§y", 5), - WOOD("§z", 6); + INGR("§v", 3), + COOK("§w", 4), + DISTILL("§x", 5), + AGE("§y", 6), + WOOD("§z", 7); public final String id; public final int ordering;