mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-24 15:01:44 +01:00
Negative stats now show up in the lore.
This commit is contained in:
parent
8ce520cc2a
commit
ec4ae923d2
Binary file not shown.
@ -51,9 +51,16 @@ public class DoubleStat extends ItemStat implements Upgradable {
|
|||||||
@Override
|
@Override
|
||||||
public void whenApplied(ItemStackBuilder item, StatData data) {
|
public void whenApplied(ItemStackBuilder item, StatData data) {
|
||||||
double value = ((DoubleData) data).getValue();
|
double value = ((DoubleData) data).getValue();
|
||||||
item.addItemTag(new ItemTag(getNBTPath(), value));
|
// If value is not allowed to be negative it will not
|
||||||
if (value > 0)
|
// apply the stat or the lore.
|
||||||
|
if (value < 0 && !canNegative())
|
||||||
|
return;
|
||||||
|
// If the value is 0 the lore will not be applied
|
||||||
|
// but the stat will still be added to the nbt
|
||||||
|
if (value != 0)
|
||||||
item.getLore().insert(getPath(), formatNumericStat(value, "#", new StatFormat("##").format(value)));
|
item.getLore().insert(getPath(), formatNumericStat(value, "#", new StatFormat("##").format(value)));
|
||||||
|
item.addItemTag(new ItemTag(getNBTPath(), value));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -210,4 +210,10 @@ public abstract class ItemStat {
|
|||||||
String str = MMOItems.plugin.getLanguage().getStatFormat(path);
|
String str = MMOItems.plugin.getLanguage().getStatFormat(path);
|
||||||
return str == null ? "<TranslationNotFound:" + path + ">" : str;
|
return str == null ? "<TranslationNotFound:" + path + ">" : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets if the double value is allowed to be
|
||||||
|
// a negative.
|
||||||
|
public boolean canNegative() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user