Don't show the kit items chance if all are 100%.
This commit is contained in:
parent
3680f9bfec
commit
d8bcb4b9a7
|
@ -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.
|
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();
|
ItemStack stack = moveable ? item.getMoveableItem() : item.getItem();
|
||||||
if (preview) {
|
if (preview) {
|
||||||
stack = item.getItemForDisplay();
|
stack = item.getItemForDisplay(this);
|
||||||
}
|
}
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -243,6 +243,15 @@ public class Kit implements Cloneable {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean all100Percent() {
|
||||||
|
for (KitItem item : this.contents) {
|
||||||
|
if (item.getChance() != 100) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getDisplayItem() {
|
public ItemStack getDisplayItem() {
|
||||||
return this.displayItem;
|
return this.displayItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class KitItem implements Cloneable {
|
||||||
return compileOptions(item);
|
return compileOptions(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemForDisplay() {
|
public ItemStack getItemForDisplay(Kit kit) {
|
||||||
if (this.content == null) {
|
if (this.content == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +225,7 @@ public class KitItem implements Cloneable {
|
||||||
meta.setLore(Collections.singletonList(ChatColor.translateAlternateColorCodes('&', this.displayLore)));
|
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;
|
ArrayDeque<String> lore;
|
||||||
if (meta.hasLore()) {
|
if (meta.hasLore()) {
|
||||||
lore = new ArrayDeque<>(meta.getLore());
|
lore = new ArrayDeque<>(meta.getLore());
|
||||||
|
|
Loading…
Reference in New Issue