mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-08 07:27:39 +01:00
Fixed abilities not displaying in the lore
This commit is contained in:
parent
c1ecc198e3
commit
9142ca4183
@ -114,7 +114,6 @@ public class MMOItemBuilder extends Buildable<MMOItem> {
|
||||
|
||||
// Get name data
|
||||
StatHistory hist = StatHistory.from(mmoitem, ItemStats.NAME);
|
||||
if (!mmoitem.hasData(ItemStats.NAME)) mmoitem.setData(ItemStats.NAME, new NameData("Item"));
|
||||
|
||||
nameModifiers.forEach((obs, mod) -> {
|
||||
|
||||
@ -123,7 +122,7 @@ public class MMOItemBuilder extends Buildable<MMOItem> {
|
||||
|
||||
// Include modifier information
|
||||
if (mod.getType() == ModifierType.PREFIX) modName.addPrefix(mod.getFormat());
|
||||
if (mod.getType() == ModifierType.SUFFIX) modName.addSuffix(mod.getFormat());
|
||||
else if (mod.getType() == ModifierType.SUFFIX) modName.addSuffix(mod.getFormat());
|
||||
|
||||
// Register onto SH
|
||||
hist.registerModifierBonus(obs, modName);
|
||||
|
@ -7,8 +7,8 @@ import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
@ -51,32 +51,32 @@ public class Abilities extends ItemStat<RandomAbilityListData, AbilityListData>
|
||||
return list;
|
||||
}
|
||||
|
||||
private String generalFormat, modifierForEach, modifierSplitter, abilitySplitter;
|
||||
private String generalFormat, modifierIfAny, modifierForEach, modifierSplitter, abilitySplitter;
|
||||
private boolean legacyFormat, useAbilitySplitter;
|
||||
private int modifiersPerLine;
|
||||
|
||||
@Deprecated
|
||||
@BackwardsCompatibility(version = "6.10")
|
||||
@Override
|
||||
public void loadConfiguration(@NotNull ConfigurationSection legacyLanguageFile, @NotNull Object configObject) {
|
||||
|
||||
// MI <7 config
|
||||
if (configObject instanceof ConfigurationSection) {
|
||||
legacyFormat = false;
|
||||
final ConfigurationSection config = (ConfigurationSection) configObject;
|
||||
generalFormat = config.getString("general-format");
|
||||
modifierForEach = config.getString("modifier-foreach");
|
||||
modifierSplitter = config.getString("modifier-splitter");
|
||||
abilitySplitter = config.getString("ability-splitter.format");
|
||||
useAbilitySplitter = config.getBoolean("ability-splitter.enabled");
|
||||
modifiersPerLine = config.getInt("modifiers-per-line");
|
||||
|
||||
} else {
|
||||
// COMPATIBILITY CODE FOR MI <6.10
|
||||
if (!(configObject instanceof ConfigurationSection)) {
|
||||
legacyFormat = true;
|
||||
generalFormat = legacyLanguageFile.getString("ability-format");
|
||||
modifierForEach = legacyLanguageFile.getString("ability-modifier");
|
||||
abilitySplitter = legacyLanguageFile.getString("ability-splitter");
|
||||
useAbilitySplitter = abilitySplitter != null && !abilitySplitter.isEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
final ConfigurationSection config = (ConfigurationSection) configObject;
|
||||
generalFormat = config.getString("general-format");
|
||||
modifierIfAny = config.getString("modifier-if-any");
|
||||
modifierForEach = config.getString("modifier-foreach");
|
||||
modifierSplitter = config.getString("modifier-splitter");
|
||||
abilitySplitter = config.getString("ability-splitter.format");
|
||||
useAbilitySplitter = config.getBoolean("ability-splitter.enabled");
|
||||
modifiersPerLine = config.getInt("modifiers-per-line");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -111,6 +111,8 @@ public class Abilities extends ItemStat<RandomAbilityListData, AbilityListData>
|
||||
.replace("{trigger}", MMOItems.plugin.getLanguage().getCastingModeName(ability.getTrigger()))
|
||||
.replace("{ability}", ability.getAbility().getName()));
|
||||
|
||||
if (!ability.getModifiers().isEmpty()) builder.append(modifierIfAny);
|
||||
|
||||
boolean modifierAppened = false;
|
||||
int lineCounter = 0;
|
||||
for (String modifier : ability.getModifiers()) {
|
||||
@ -126,12 +128,11 @@ public class Abilities extends ItemStat<RandomAbilityListData, AbilityListData>
|
||||
if (modifiersPerLine > 0 && lineCounter >= modifiersPerLine) {
|
||||
lineCounter = 0;
|
||||
modifierAppened = false;
|
||||
abilityLore.add(builder.toString());
|
||||
builder.setLength(0);
|
||||
builder.append("\n"); // Will be processed later on by MMOItems
|
||||
}
|
||||
}
|
||||
|
||||
if (modifierAppened) abilityLore.add(builder.toString());
|
||||
abilityLore.add(builder.toString());
|
||||
|
||||
if (useAbilitySplitter)
|
||||
abilityLore.add(abilitySplitter);
|
||||
|
@ -323,7 +323,7 @@ public class DisplayName extends StringStat implements GemStoneStat {
|
||||
@NotNull
|
||||
@Override
|
||||
public StringData getClearStatData() {
|
||||
return new NameData("");
|
||||
return new NameData("Item");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,7 +4,10 @@ import net.Indyuce.mmoitems.stat.data.type.Mergeable;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class AbilityListData implements StatData, Mergeable<AbilityListData> {
|
||||
private final List<AbilityData> abilities = new ArrayList<>();
|
||||
@ -18,16 +21,16 @@ public class AbilityListData implements StatData, Mergeable<AbilityListData> {
|
||||
}
|
||||
|
||||
public void add(@NotNull AbilityData... abilities) {
|
||||
this.abilities.addAll(Arrays.asList(abilities));
|
||||
Collections.addAll(this.abilities, abilities);
|
||||
}
|
||||
|
||||
public void add(@NotNull Collection<AbilityData> abilit) {
|
||||
abilities.addAll(abilit);
|
||||
public void add(@NotNull Collection<AbilityData> abilities) {
|
||||
this.abilities.addAll(abilities);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<AbilityData> getAbilities() {
|
||||
return new HashSet<>(abilities);
|
||||
public List<AbilityData> getAbilities() {
|
||||
return abilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -38,9 +41,7 @@ public class AbilityListData implements StatData, Mergeable<AbilityListData> {
|
||||
@NotNull
|
||||
@Override
|
||||
public AbilityListData clone() {
|
||||
final AbilityListData clone = new AbilityListData();
|
||||
clone.abilities.addAll(this.abilities);
|
||||
return clone;
|
||||
return new AbilityListData(this.abilities);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.stat.type;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
@ -141,8 +142,8 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
||||
* actual Stat Data from the NBT stored within the item. Reverses
|
||||
* <code>getAppliedNBT()</code> actually.
|
||||
* <p></p>
|
||||
* Shall return null if the tags passed dont provide enough
|
||||
* information to generate a useable StatData.
|
||||
* Shall return null if the tags passed don't provide enough
|
||||
* information to generate a usable StatData.
|
||||
*
|
||||
* @author gunging
|
||||
*/
|
||||
@ -163,7 +164,7 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
||||
|
||||
protected String generalStatFormat;
|
||||
|
||||
@Deprecated
|
||||
@BackwardsCompatibility(version = "6.10")
|
||||
public void loadConfiguration(@NotNull ConfigurationSection legacyLanguageFile, @NotNull Object configObject) {
|
||||
loadConfiguration(configObject);
|
||||
}
|
||||
@ -172,7 +173,7 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
||||
generalStatFormat = configObject.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@BackwardsCompatibility(version = "6.10")
|
||||
public String getLegacyTranslationPath() {
|
||||
return getPath();
|
||||
}
|
||||
@ -200,7 +201,7 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
||||
* Mainly for backwards compatibility. Aliases are basically
|
||||
* other string identifiers that point to the same item stat.
|
||||
* Useful when changing stat keys inside the item configs.
|
||||
*
|
||||
* <p>
|
||||
* Aliases have to follow the UPPER_CASE stat identifier format.
|
||||
*/
|
||||
@Nullable
|
||||
|
@ -14,17 +14,13 @@ public abstract class Buildable<B> {
|
||||
|
||||
protected abstract B whenBuilt();
|
||||
|
||||
public void validateNotBuilt() {
|
||||
Validate.isTrue(lock, "Has already been built");
|
||||
}
|
||||
|
||||
public boolean isBuilt() {
|
||||
return !lock;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public B build() {
|
||||
validateNotBuilt();
|
||||
Validate.isTrue(lock, "Has already been built");
|
||||
lock = false;
|
||||
return whenBuilt();
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ faction-damage-undead: '&3 &7■ Undead Faction Damage: &f<plus>{value}%'
|
||||
|
||||
# Abilities (changed in MI 6.9.5)
|
||||
ability:
|
||||
general-format: "&8| &7{trigger} &8|&e|&8| &7&l{ability}\n"
|
||||
general-format: "&8| &7{trigger} &8|&e|&8| &7&l{ability}"
|
||||
modifier-if-any: "\n" # Appended to general-format if the skill has at least one modifier
|
||||
modifier-foreach: "&7{modifier}&8: &f{value}"
|
||||
modifier-splitter: " &8&l|&7 "
|
||||
modifiers-per-line: 3
|
||||
|
Loading…
Reference in New Issue
Block a user