mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
!Compatibility with very latest MMOLib
This commit is contained in:
parent
d01976a314
commit
a8cf3f5190
BIN
lib/MMOLib.jar
BIN
lib/MMOLib.jar
Binary file not shown.
@ -22,6 +22,7 @@ import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageHandler;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.RegisteredAttack;
|
||||
|
||||
public class HeroesHook implements RPGHandler, Listener, DamageHandler {
|
||||
private final Map<SkillType, DamageType> damages = new HashMap<>();
|
||||
@ -40,10 +41,10 @@ public class HeroesHook implements RPGHandler, Listener, DamageHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttackResult getDamage(Entity entity) {
|
||||
public RegisteredAttack getDamage(Entity entity) {
|
||||
SkillUseInfo info = Heroes.getInstance().getDamageManager().getSpellTargetInfo(entity);
|
||||
return new AttackResult(true, 0, info.getSkill().getTypes().stream().filter(type -> damages.containsKey(type)).map(type -> damages.get(type))
|
||||
.collect(Collectors.toSet()));
|
||||
return new RegisteredAttack(new AttackResult(true, 0, info.getSkill().getTypes().stream().filter(type -> damages.containsKey(type))
|
||||
.map(type -> damages.get(type)).collect(Collectors.toSet())), info.getCharacter().getEntity());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,9 +21,10 @@ import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageHandler;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.RegisteredAttack;
|
||||
|
||||
public class SkillAPIHook implements RPGHandler, Listener, DamageHandler {
|
||||
private final Map<Integer, AttackResult> damageInfo = new HashMap<>();
|
||||
private final Map<Integer, RegisteredAttack> damageInfo = new HashMap<>();
|
||||
|
||||
public SkillAPIHook() {
|
||||
MMOLib.plugin.getDamage().registerHandler(this);
|
||||
@ -35,7 +36,7 @@ public class SkillAPIHook implements RPGHandler, Listener, DamageHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttackResult getDamage(Entity entity) {
|
||||
public RegisteredAttack getDamage(Entity entity) {
|
||||
return damageInfo.get(entity.getEntityId());
|
||||
}
|
||||
|
||||
@ -46,7 +47,7 @@ public class SkillAPIHook implements RPGHandler, Listener, DamageHandler {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void a(SkillDamageEvent event) {
|
||||
damageInfo.put(event.getTarget().getEntityId(), new AttackResult(event.getDamage(), DamageType.SKILL));
|
||||
damageInfo.put(event.getTarget().getEntityId(), new RegisteredAttack(new AttackResult(event.getDamage(), DamageType.SKILL), event.getDamager()));
|
||||
|
||||
if (event.getDamager() instanceof Player)
|
||||
event.setDamage(event.getDamage() * (1 + net.Indyuce.mmoitems.api.player.PlayerData.get((Player) event.getDamager()).getStats().getStat(ItemStat.MAGIC_DAMAGE) / 100));
|
||||
|
Loading…
Reference in New Issue
Block a user