mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-31 06:07:34 +01:00
Offhand ranged check for melee hits.
This commit is contained in:
parent
9ba20dd408
commit
dccb394775
@ -118,7 +118,9 @@ public class ItemUse implements Listener {
|
||||
*/
|
||||
PlayerData playerData = PlayerData.get(player);
|
||||
NBTItem item = MMOItems.plugin.getNMS().getNBTItem(player.getInventory().getItemInMainHand());
|
||||
NBTItem offhandItem = MMOItems.plugin.getNMS().getNBTItem(player.getInventory().getItemInOffHand());
|
||||
AttackResult result = new AttackResult(event.getDamage(), DamageType.WEAPON, DamageType.PHYSICAL);
|
||||
|
||||
if (item.hasType()) {
|
||||
Weapon weapon = new Weapon(playerData, item, item.getType());
|
||||
|
||||
@ -138,6 +140,19 @@ public class ItemUse implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (offhandItem.hasType()) {
|
||||
Weapon weapon = new Weapon(playerData, offhandItem, offhandItem.getType());
|
||||
|
||||
if(weapon.getMMOItem().getType().getItemSet() == TypeSet.RANGE) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!weapon.canBeUsed()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* cast on-hit abilities and add the extra damage to the damage event
|
||||
|
Loading…
Reference in New Issue
Block a user