mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
item similarity fix
This commit is contained in:
parent
821f6dbb5a
commit
a2a01bfb42
@ -1,8 +1,27 @@
|
||||
package net.Indyuce.mmoitems.listener;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.TypeSet;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.interaction.GemStone;
|
||||
import net.Indyuce.mmoitems.api.interaction.ItemSkin;
|
||||
import net.Indyuce.mmoitems.api.interaction.Tool;
|
||||
import net.Indyuce.mmoitems.api.interaction.UseItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Gauntlet;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.Staff;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon.WeaponType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.player.inventory.EquippedItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
@ -22,32 +41,12 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.TypeSet;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.interaction.GemStone;
|
||||
import net.Indyuce.mmoitems.api.interaction.ItemSkin;
|
||||
import net.Indyuce.mmoitems.api.interaction.Tool;
|
||||
import net.Indyuce.mmoitems.api.interaction.UseItem;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Gauntlet;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.Staff;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.UntargetedWeapon.WeaponType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.DamageType;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class ItemUse implements Listener {
|
||||
private static final DecimalFormat digit = new DecimalFormat("0.#");
|
||||
|
||||
@ -284,7 +283,7 @@ public class ItemUse implements Listener {
|
||||
}
|
||||
// Have to get hand manually because 1.15 and below does not have event.getHand()
|
||||
ItemStack itemInMainHand = playerData.getPlayer().getInventory().getItemInMainHand();
|
||||
EquipmentSlot bowSlot = (itemInMainHand == event.getBow()) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND;
|
||||
EquipmentSlot bowSlot = (itemInMainHand.isSimilar(event.getBow())) ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND;
|
||||
|
||||
if (!eitherHandSuccess((Player) event.getEntity(), item, bowSlot)) {
|
||||
event.setCancelled(true);
|
||||
|
Loading…
Reference in New Issue
Block a user