fixed issue with no damage type

This commit is contained in:
Indyuce 2019-08-30 00:46:25 +02:00
parent 5f7ef21178
commit 419b3ef4f9
4 changed files with 10 additions and 6 deletions

View File

@ -26,6 +26,7 @@ import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.MMOUtils;
import net.Indyuce.mmoitems.api.Ability;
import net.Indyuce.mmoitems.api.Ability.CastingMode;
import net.Indyuce.mmoitems.api.AttackResult.DamageType;
import net.Indyuce.mmoitems.api.ItemSet.SetBonuses;
import net.Indyuce.mmoitems.api.AttackResult;
import net.Indyuce.mmoitems.api.ConfigFile;
@ -375,11 +376,11 @@ public class PlayerData {
* cast
*/
public void cast(Ability ability) {
cast(getStats().newTemporary(), null, new AttackResult(true), new AbilityData(ability), true);
cast(getStats().newTemporary(), null, new AttackResult(true, DamageType.SKILL), new AbilityData(ability), true);
}
public void cast(AbilityData data) {
cast(getStats().newTemporary(), null, new AttackResult(true), data, true);
cast(getStats().newTemporary(), null, new AttackResult(true, DamageType.SKILL), data, true);
}
public void cast(TemporaryStats stats, LivingEntity target, AttackResult result, AbilityData ability, boolean message) {

View File

@ -12,6 +12,7 @@ import com.evill4mer.RealDualWield.Api.PlayerDamageEntityWithOffhandEvent;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.AttackResult;
import net.Indyuce.mmoitems.api.TypeSet;
import net.Indyuce.mmoitems.api.AttackResult.DamageType;
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
import net.Indyuce.mmoitems.api.item.NBTItem;
import net.Indyuce.mmoitems.api.player.PlayerData;
@ -40,7 +41,7 @@ public class RealDualWieldHook implements Listener {
*/
PlayerData playerData = PlayerData.get(player);
NBTItem item = MMOItems.plugin.getNMS().getNBTItem(event.getItemInOffhand());
AttackResult result = new AttackResult(true, event.getDamage());
AttackResult result = new AttackResult(event.getDamage(), DamageType.WEAPON, DamageType.PHYSICAL);
if (item.hasType()) {
Weapon weapon = new Weapon(playerData, item, item.getType());

View File

@ -29,6 +29,7 @@ import net.Indyuce.mmoitems.api.AttackResult;
import net.Indyuce.mmoitems.api.Message;
import net.Indyuce.mmoitems.api.Type;
import net.Indyuce.mmoitems.api.TypeSet;
import net.Indyuce.mmoitems.api.AttackResult.DamageType;
import net.Indyuce.mmoitems.api.interaction.Consumable;
import net.Indyuce.mmoitems.api.interaction.GemStone;
import net.Indyuce.mmoitems.api.interaction.GemStone.ApplyResult;
@ -117,7 +118,7 @@ public class ItemUse implements Listener {
*/
PlayerData playerData = PlayerData.get(player);
NBTItem item = MMOItems.plugin.getNMS().getNBTItem(player.getInventory().getItemInMainHand());
AttackResult result = new AttackResult(true, event.getDamage());
AttackResult result = new AttackResult(event.getDamage(), DamageType.WEAPON, DamageType.PHYSICAL);
if (item.hasType()) {
Weapon weapon = new Weapon(playerData, item, item.getType());

View File

@ -23,6 +23,7 @@ import org.bukkit.inventory.ItemStack;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.ability.Magical_Shield;
import net.Indyuce.mmoitems.api.Ability.CastingMode;
import net.Indyuce.mmoitems.api.AttackResult.DamageType;
import net.Indyuce.mmoitems.api.AttackResult;
import net.Indyuce.mmoitems.api.SoulboundInfo;
import net.Indyuce.mmoitems.api.player.PlayerData;
@ -87,7 +88,7 @@ public class PlayerListener implements Listener {
LivingEntity damager = (LivingEntity) event.getDamager();
Player player = (Player) event.getEntity();
PlayerData.get(player).castAbilities(damager, new AttackResult(true, event.getDamage()), CastingMode.WHEN_HIT);
PlayerData.get(player).castAbilities(damager, new AttackResult(event.getDamage(), DamageType.SKILL), CastingMode.WHEN_HIT);
}
@EventHandler(priority = EventPriority.LOW)
@ -97,7 +98,7 @@ public class PlayerListener implements Listener {
Player player = event.getPlayer();
boolean left = event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK;
PlayerData.get(player).castAbilities(null, new AttackResult(true), player.isSneaking() ? (left ? CastingMode.SHIFT_LEFT_CLICK : CastingMode.SHIFT_RIGHT_CLICK) : (left ? CastingMode.LEFT_CLICK : CastingMode.RIGHT_CLICK));
PlayerData.get(player).castAbilities(null, new AttackResult(true, DamageType.SKILL), player.isSneaking() ? (left ? CastingMode.SHIFT_LEFT_CLICK : CastingMode.SHIFT_RIGHT_CLICK) : (left ? CastingMode.LEFT_CLICK : CastingMode.RIGHT_CLICK));
}
/*