mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Fixed an attack speed issue with MythicLib
This commit is contained in:
parent
e2239d341f
commit
2fd09206dd
17
pom.xml
17
pom.xml
@ -95,6 +95,14 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.Indyuce.mmoitems.lib</groupId>
|
||||
<artifactId>GoogleGSON</artifactId>
|
||||
@ -179,14 +187,7 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Local dependencies -->
|
||||
<dependency>
|
||||
<groupId>com.github.Eniripsa96</groupId>
|
||||
<artifactId>SkillAPI</artifactId>
|
||||
|
@ -65,13 +65,6 @@ public class PlayerStats {
|
||||
*/
|
||||
StatInstance.ModifierPacket packet = getInstance(stat).newPacket();
|
||||
|
||||
/**
|
||||
* Some stats including Atk Damage and Speed have stat offsets, when equipping
|
||||
* at least one item which grants this stat the final value must be lowered
|
||||
* by a flat amount
|
||||
*/
|
||||
boolean isHoldingWeapon = false;
|
||||
|
||||
/**
|
||||
* The index of the mmoitem stat modifier being added
|
||||
*/
|
||||
@ -80,21 +73,25 @@ public class PlayerStats {
|
||||
for (EquippedPlayerItem item : playerData.getInventory().getEquipped()) {
|
||||
double value = item.getItem().getNBT().getStat(stat.getId());
|
||||
|
||||
|
||||
if (value != 0) {
|
||||
|
||||
Type type = item.getItem().getType();
|
||||
ModifierSource source = type == null ? ModifierSource.OTHER : type.getItemSet().getModifierSource();
|
||||
|
||||
/**
|
||||
* Apply main hand weapon stat offset ie 4 for attack speed and 1 for attack damage.
|
||||
*/
|
||||
if (item.getSlot() == EquipmentSlot.MAIN_HAND && stat instanceof AttributeStat)
|
||||
value -= ((AttributeStat) stat).getOffset();
|
||||
|
||||
packet.addModifier("MMOItem-" + index++, new StatModifier(value, ModifierType.FLAT, item.getSlot(), source));
|
||||
if (!isHoldingWeapon && item.getSlot().isHand())
|
||||
isHoldingWeapon = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isHoldingWeapon && stat instanceof AttributeStat)
|
||||
packet.addModifier("MMOItemOffset", new StatModifier(-((AttributeStat) stat).getOffset()));
|
||||
|
||||
/**
|
||||
* Finally run a stat update
|
||||
* Finally run a stat update after all modifiers
|
||||
* have been gathered by MythicLib
|
||||
*/
|
||||
packet.runUpdate();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user