mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Show stars in lore according to quality
This commit is contained in:
@@ -374,6 +374,7 @@ public class Brew {
|
|||||||
if (ageTime >= 1) {
|
if (ageTime >= 1) {
|
||||||
lore.updateAgeLore(false);
|
lore.updateAgeLore(false);
|
||||||
}
|
}
|
||||||
|
lore.updateQualityStars(false);
|
||||||
lore.write();
|
lore.write();
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
@@ -507,6 +508,7 @@ public class Brew {
|
|||||||
if (BConfig.colorInBrewer != BrewLore.hasColorLore(potionMeta)) {
|
if (BConfig.colorInBrewer != BrewLore.hasColorLore(potionMeta)) {
|
||||||
lore.convertLore(BConfig.colorInBrewer);
|
lore.convertLore(BConfig.colorInBrewer);
|
||||||
}
|
}
|
||||||
|
lore.updateQualityStars(BConfig.colorInBrewer);
|
||||||
}
|
}
|
||||||
lore.updateDistillLore(BConfig.colorInBrewer);
|
lore.updateDistillLore(BConfig.colorInBrewer);
|
||||||
lore.write();
|
lore.write();
|
||||||
@@ -585,6 +587,7 @@ public class Brew {
|
|||||||
if (BConfig.colorInBarrels && !unlabeled && currentRecipe != null) {
|
if (BConfig.colorInBarrels && !unlabeled && currentRecipe != null) {
|
||||||
lore.updateWoodLore(true);
|
lore.updateWoodLore(true);
|
||||||
}
|
}
|
||||||
|
lore.updateQualityStars(BConfig.colorInBarrels);
|
||||||
}
|
}
|
||||||
lore.write();
|
lore.write();
|
||||||
touch();
|
touch();
|
||||||
|
|||||||
@@ -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
|
* Converts to/from qualitycolored Lore
|
||||||
*/
|
*/
|
||||||
@@ -214,6 +236,7 @@ public class BrewLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateCustomLore();
|
updateCustomLore();
|
||||||
|
updateQualityStars(toQuality);
|
||||||
|
|
||||||
if (!brew.isUnlabeled()) {
|
if (!brew.isUnlabeled()) {
|
||||||
// Ingredients
|
// Ingredients
|
||||||
@@ -419,14 +442,15 @@ public class BrewLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
CUSTOM("§t", 0),
|
STARS("§s", 0),
|
||||||
SPACE("§u", 1),
|
CUSTOM("§t", 1),
|
||||||
|
SPACE("§u", 2),
|
||||||
|
|
||||||
INGR("§v", 2),
|
INGR("§v", 3),
|
||||||
COOK("§w", 3),
|
COOK("§w", 4),
|
||||||
DISTILL("§x", 4),
|
DISTILL("§x", 5),
|
||||||
AGE("§y", 5),
|
AGE("§y", 6),
|
||||||
WOOD("§z", 6);
|
WOOD("§z", 7);
|
||||||
|
|
||||||
public final String id;
|
public final String id;
|
||||||
public final int ordering;
|
public final int ordering;
|
||||||
|
|||||||
Reference in New Issue
Block a user