forked from Upstream/mmocore
You can now add action-bar: 'format'
to class files
This will override the default action bar format for that class only. Formatting is the same as the default one.
This commit is contained in:
parent
2620f67672
commit
1ec270566d
@ -31,7 +31,7 @@ public class PlayerActionBar extends BukkitRunnable {
|
|||||||
for (PlayerData data : PlayerData.getAll())
|
for (PlayerData data : PlayerData.getAll())
|
||||||
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.canSeeActionBar()) {
|
if (data.isOnline() && !data.getPlayer().isDead() && !data.isCasting() && data.canSeeActionBar()) {
|
||||||
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(),
|
data.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(MMOCore.plugin.placeholderParser.parse(data.getPlayer(),
|
||||||
MMOLib.plugin.parseColors(new String(format)
|
MMOLib.plugin.parseColors(new String(data.getProfess().hasActionBar() ? data.getProfess().getActionBar() : format)
|
||||||
.replace("{health}", digit.format(data.getPlayer().getHealth()))
|
.replace("{health}", digit.format(data.getPlayer().getHealth()))
|
||||||
.replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
.replace("{max_health}", "" + StatType.MAX_HEALTH.format(data.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()))
|
||||||
.replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon())
|
.replace("{mana_icon}", data.getProfess().getManaDisplay().getIcon())
|
||||||
|
@ -43,7 +43,7 @@ import net.mmogroup.mmolib.api.MMOLineConfig;
|
|||||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||||
|
|
||||||
public class PlayerClass extends PostLoadObject {
|
public class PlayerClass extends PostLoadObject {
|
||||||
private final String name, id;
|
private final String name, id, actionBarFormat;
|
||||||
private final List<String> description = new ArrayList<>(), attrDescription = new ArrayList<>();
|
private final List<String> description = new ArrayList<>(), attrDescription = new ArrayList<>();
|
||||||
private final ItemStack icon;
|
private final ItemStack icon;
|
||||||
private final Map<ClassOption, Boolean> options = new HashMap<>();
|
private final Map<ClassOption, Boolean> options = new HashMap<>();
|
||||||
@ -90,6 +90,7 @@ public class PlayerClass extends PostLoadObject {
|
|||||||
: ManaDisplayOptions.DEFAULT;
|
: ManaDisplayOptions.DEFAULT;
|
||||||
maxLevel = config.getInt("max-level");
|
maxLevel = config.getInt("max-level");
|
||||||
displayOrder = config.getInt("display.order");
|
displayOrder = config.getInt("display.order");
|
||||||
|
actionBarFormat = config.getString("action-bar", "");
|
||||||
|
|
||||||
expCurve = config.contains("exp-curve")
|
expCurve = config.contains("exp-curve")
|
||||||
? MMOCore.plugin.experience.getOrThrow(
|
? MMOCore.plugin.experience.getOrThrow(
|
||||||
@ -185,6 +186,7 @@ public class PlayerClass extends PostLoadObject {
|
|||||||
displayOrder = 0;
|
displayOrder = 0;
|
||||||
expCurve = ExpCurve.DEFAULT;
|
expCurve = ExpCurve.DEFAULT;
|
||||||
castParticle = new CastingParticle(Particle.SPELL_INSTANT);
|
castParticle = new CastingParticle(Particle.SPELL_INSTANT);
|
||||||
|
actionBarFormat = "";
|
||||||
|
|
||||||
this.icon = new ItemStack(material);
|
this.icon = new ItemStack(material);
|
||||||
setOption(ClassOption.DISPLAY, false);
|
setOption(ClassOption.DISPLAY, false);
|
||||||
@ -321,4 +323,12 @@ public class PlayerClass extends PostLoadObject {
|
|||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj != null && obj instanceof PlayerClass && ((PlayerClass) obj).id.equals(id);
|
return obj != null && obj instanceof PlayerClass && ((PlayerClass) obj).id.equals(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getActionBar() {
|
||||||
|
return actionBarFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasActionBar() {
|
||||||
|
return actionBarFormat.isEmpty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user