!Attack results now work with sets

This commit is contained in:
Indyuce 2019-12-24 00:21:46 +01:00
parent 77edbaf992
commit 5bdfcf299a
2 changed files with 6 additions and 7 deletions

View File

@ -1,7 +1,6 @@
package net.Indyuce.mmoitems.api;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.bukkit.entity.LivingEntity;
@ -14,18 +13,18 @@ import net.mmogroup.mmolib.api.item.NBTItem;
public class ItemAttackResult extends AttackResult {
public ItemAttackResult(boolean successful, DamageType... types) {
this(successful, 0, types);
super(successful, 0, types);
}
public ItemAttackResult(double damage, DamageType... types) {
this(true, damage, types);
super(true, damage, types);
}
public ItemAttackResult(boolean successful, double damage, DamageType... types) {
this(successful, damage, Arrays.asList(types));
super(successful, damage, types);
}
public ItemAttackResult(boolean successful, double damage, List<DamageType> types) {
public ItemAttackResult(boolean successful, double damage, Set<DamageType> types) {
super(successful, damage, types);
}

View File

@ -46,7 +46,7 @@ public class HeroesHook implements RPGHandler, Listener, DamageHandler {
@Override
public AttackResult 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.toList()));
return new AttackResult(true, 0, info.getSkill().getTypes().stream().filter(type -> damages.containsKey(type)).map(type -> damages.get(type)).collect(Collectors.toSet()));
}
@Override