mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-27 00:45:40 +01:00
Attribute modifiers available in ML
This commit is contained in:
parent
2c0f8094c0
commit
28be26b9c8
@ -8,6 +8,7 @@ import io.lumine.mythic.utils.plugin.LuminePlugin;
|
||||
import net.Indyuce.mmocore.api.ConfigFile;
|
||||
import net.Indyuce.mmocore.api.PlayerActionBar;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.attribute.AttributeModifier;
|
||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||
import net.Indyuce.mmocore.api.util.debug.DebugMode;
|
||||
@ -31,7 +32,6 @@ import net.Indyuce.mmocore.listener.event.PlayerPressKeyListener;
|
||||
import net.Indyuce.mmocore.listener.option.*;
|
||||
import net.Indyuce.mmocore.listener.profession.FishingListener;
|
||||
import net.Indyuce.mmocore.listener.profession.PlayerCollectStats;
|
||||
import net.Indyuce.mmocore.loot.chest.LootChest;
|
||||
import net.Indyuce.mmocore.manager.*;
|
||||
import net.Indyuce.mmocore.manager.data.DataProvider;
|
||||
import net.Indyuce.mmocore.manager.data.mysql.MySQLDataProvider;
|
||||
@ -55,7 +55,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class MMOCore extends LuminePlugin {
|
||||
@ -116,8 +115,9 @@ public class MMOCore extends LuminePlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
// Register MMOCore-specific target restrictions
|
||||
// Register MMOCore-specific objects
|
||||
MythicLib.plugin.getEntities().registerRestriction(new PartyMemberTargetRestriction());
|
||||
MythicLib.plugin.getModifiers().registerModifierType("attribute", configObject -> new AttributeModifier(configObject));
|
||||
|
||||
// Register extra objective, drop items...
|
||||
if (Bukkit.getPluginManager().getPlugin("WorldGuard") != null)
|
||||
|
@ -12,6 +12,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AttributeModifier extends PlayerModifier {
|
||||
private final String attribute;
|
||||
@ -74,9 +75,10 @@ public class AttributeModifier extends PlayerModifier {
|
||||
public AttributeModifier(ConfigObject object) {
|
||||
super(object.getString("key"), EquipmentSlot.OTHER, ModifierSource.OTHER);
|
||||
|
||||
String str = Objects.requireNonNull(object.getString("value"));
|
||||
type = str.toCharArray()[str.length() - 1] == '%' ? ModifierType.RELATIVE : ModifierType.FLAT;
|
||||
value = Double.parseDouble(type == ModifierType.RELATIVE ? str.substring(0, str.length() - 1) : str);
|
||||
this.attribute = object.getString("attribute");
|
||||
this.value = object.getDouble("value");
|
||||
type = object.getBoolean("multiplicative", false) ? ModifierType.RELATIVE : ModifierType.FLAT;
|
||||
}
|
||||
|
||||
public String getAttribute() {
|
||||
|
@ -7,11 +7,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* General implementation for professions and classes.
|
||||
* General implementation for professions, classes and attributes.
|
||||
* <p>
|
||||
* An experience object is a type of object that can
|
||||
* level up. It has an experience curve and table and
|
||||
* can receive EXP
|
||||
* An experience object is a type of object that can level up.
|
||||
* It has an experience curve and table and can receive EXP
|
||||
*
|
||||
* @author jules
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user