Don't show the kit items chance if all are 100%.

This commit is contained in:
Brianna O'Keefe 2024-03-31 18:06:12 -05:00
parent 3680f9bfec
commit d8bcb4b9a7
2 changed files with 12 additions and 3 deletions

View File

@ -126,7 +126,7 @@ public class Kit implements Cloneable {
if ((!item.getSerialized().startsWith("/") && !item.getSerialized().startsWith(Settings.CURRENCY_SYMBOL.getString())) || commands) { //ToDO: I doubt this is correct.
ItemStack stack = moveable ? item.getMoveableItem() : item.getItem();
if (preview) {
stack = item.getItemForDisplay();
stack = item.getItemForDisplay(this);
}
if (stack == null) {
continue;
@ -243,6 +243,15 @@ public class Kit implements Cloneable {
return this.name;
}
public boolean all100Percent() {
for (KitItem item : this.contents) {
if (item.getChance() != 100) {
return false;
}
}
return true;
}
public ItemStack getDisplayItem() {
return this.displayItem;
}

View File

@ -206,7 +206,7 @@ public class KitItem implements Cloneable {
return compileOptions(item);
}
public ItemStack getItemForDisplay() {
public ItemStack getItemForDisplay(Kit kit) {
if (this.content == null) {
return null;
}
@ -225,7 +225,7 @@ public class KitItem implements Cloneable {
meta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', this.displayLore)));
}
if (UltimateKits.getInstance().getConfig().getBoolean("Main.Display Chance In Preview")) {
if (UltimateKits.getInstance().getConfig().getBoolean("Main.Display Chance In Preview") && !kit.all100Percent()) {
ArrayDeque<String> lore;
if (meta.hasLore()) {
lore = new ArrayDeque<>(meta.getLore());