mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
ACTUALLY fixed the MMOItems damage compatibility
This commit is contained in:
parent
ba6eb65c31
commit
cdc25b8417
@ -15,7 +15,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
import com.codingforcookies.armorequip.ArmorEquipEvent;
|
import com.codingforcookies.armorequip.ArmorEquipEvent;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
|
||||||
import net.Indyuce.mmocore.api.event.PlayerAttackEvent;
|
import net.Indyuce.mmocore.api.event.PlayerAttackEvent;
|
||||||
import net.Indyuce.mmocore.api.event.PlayerCombatEvent;
|
import net.Indyuce.mmocore.api.event.PlayerCombatEvent;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
@ -23,6 +22,7 @@ import net.Indyuce.mmocore.api.player.stats.PlayerStats;
|
|||||||
import net.Indyuce.mmocore.api.player.stats.StatType;
|
import net.Indyuce.mmocore.api.player.stats.StatType;
|
||||||
import net.Indyuce.mmocore.comp.rpg.damage.DamageInfo.DamageType;
|
import net.Indyuce.mmocore.comp.rpg.damage.DamageInfo.DamageType;
|
||||||
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
import net.Indyuce.mmocore.gui.api.PluginInventory;
|
||||||
|
import net.Indyuce.mmoitems.api.AttackResult;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@ -99,19 +99,20 @@ public class PlayerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void h(PlayerAttackEvent event) {
|
public void h(PlayerAttackEvent event) {
|
||||||
double d = 1;
|
double damage = event.getDamage();
|
||||||
|
double d = 1, s = 1;
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().isPluginEnabled("MMOItems") &&
|
if(Bukkit.getPluginManager().isPluginEnabled("MMOItems"))
|
||||||
event.getDamageInfo().getTypes().contains(DamageType.SKILL)) {
|
for (DamageType type : event.getDamageInfo().getTypes())
|
||||||
event.setDamage(event.getDamage());
|
s += (net.Indyuce.mmoitems.api.player.PlayerData.get(event.getPlayer()).getStats()
|
||||||
return;
|
.getStat(AttackResult.DamageType.valueOf(type.name()).getStat()) / 100);
|
||||||
}
|
|
||||||
|
damage /= s;
|
||||||
|
|
||||||
PlayerStats stats = event.getData().getStats();
|
PlayerStats stats = event.getData().getStats();
|
||||||
for (DamageType type : event.getDamageInfo().getTypes())
|
for (DamageType type : event.getDamageInfo().getTypes())
|
||||||
d += stats.getStat(type.getStat()) / 100;
|
d += (stats.getStat(type.getStat())) / 100;
|
||||||
|
|
||||||
MMOCore.log("Damage: " + event.getDamage() * d);
|
event.setDamage(damage * d);
|
||||||
event.setDamage(event.getDamage() * d);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user