New stats to increase MMOCore attributes

This commit is contained in:
Indyuce 2022-08-19 14:59:32 +02:00
parent a3e22eda66
commit 5a0f51331c
4 changed files with 26 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import net.Indyuce.mmocore.experience.Profession;
import net.Indyuce.mmoitems.MMOItems; import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.player.PlayerData; import net.Indyuce.mmoitems.api.player.PlayerData;
import net.Indyuce.mmoitems.api.player.RPGPlayer; import net.Indyuce.mmoitems.api.player.RPGPlayer;
import net.Indyuce.mmoitems.comp.mmocore.stat.ExtraAttribute;
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute; import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute;
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Profession; import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Profession;
import net.Indyuce.mmoitems.comp.rpg.RPGHandler; import net.Indyuce.mmoitems.comp.rpg.RPGHandler;
@ -30,8 +31,11 @@ public class MMOCoreHook implements RPGHandler, Listener {
* class has to be instantiated again for the registered stats to update * class has to be instantiated again for the registered stats to update
*/ */
public MMOCoreHook() { public MMOCoreHook() {
for (PlayerAttribute attribute : MMOCore.plugin.attributeManager.getAll()) for (PlayerAttribute attribute : MMOCore.plugin.attributeManager.getAll()) {
MMOItems.plugin.getStats().register(new Required_Attribute(attribute)); MMOItems.plugin.getStats().register(new Required_Attribute(attribute));
MMOItems.plugin.getStats().register(new ExtraAttribute(attribute));
}
for (Profession profession : MMOCore.plugin.professionManager.getAll()) { for (Profession profession : MMOCore.plugin.professionManager.getAll()) {
// Adds profession specific Additional Experience stats. // Adds profession specific Additional Experience stats.

View File

@ -0,0 +1,13 @@
package net.Indyuce.mmoitems.comp.mmocore.stat;
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
import net.Indyuce.mmoitems.stat.type.DoubleStat;
import org.bukkit.Material;
public class ExtraAttribute extends DoubleStat {
public ExtraAttribute(PlayerAttribute attribute) {
super("ADDITIONAL_" + attribute.getId().toUpperCase().replace("-", "_"), Material.LIME_DYE,
"Additional " + attribute.getName() + " (MMOCore)", new String[]{"Amount of " + attribute.getName() + " points the player",
"gets when holding/wearing this item."}, new String[]{"!block", "all"});
}
}

View File

@ -101,6 +101,9 @@ lore-format:
- '#item-cooldown#' - '#item-cooldown#'
- '#lifesteal#' - '#lifesteal#'
- '#spell-vampirism#' - '#spell-vampirism#'
- '#additional-dexterity#'
- '#additional-strength#'
- '#additional-intelligence#'
- '#additional-experience#' - '#additional-experience#'
- '#additional-experience-alchemy#' - '#additional-experience-alchemy#'
- '#additional-experience-enchanting#' - '#additional-experience-enchanting#'

View File

@ -121,11 +121,15 @@ tier: '&3 &7Tier: #'
required-class: '&3 &7# Item' required-class: '&3 &7# Item'
required-level: '&eRequires Lvl #' required-level: '&eRequires Lvl #'
# Attributes # MMOCore Attributes
required-dexterity: '&eRequires &c# &eDexterity' required-dexterity: '&eRequires &c# &eDexterity'
required-strength: '&eRequires &c# &eStrength' required-strength: '&eRequires &c# &eStrength'
required-intelligence: '&eRequires &c# &eIntelligence' required-intelligence: '&eRequires &c# &eIntelligence'
additional-dexterity: '&3 &7■ Extra Dexterity: &f<plus>#'
additional-strength: '&3 &7■ Extra Strength: &f<plus>#'
additional-intelligence: '&3 &7■ Extra Intelligence: &f<plus>#'
# Professions # Professions
profession-alchemy: '&eAlchemy Level: &c#' profession-alchemy: '&eAlchemy Level: &c#'
profession-enchanting: '&eEnchanting Level: &c#' profession-enchanting: '&eEnchanting Level: &c#'