mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-10 07:47:35 +01:00
item similarity fix
This commit is contained in:
parent
821f6dbb5a
commit
a2a01bfb42
@ -1,8 +1,27 @@
|
|||||||
package net.Indyuce.mmoitems.listener;
|
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.player.inventory.EquippedItem;
|
||||||
|
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
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.PlayerInteractEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
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.EquipmentSlot;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
public class ItemUse implements Listener {
|
public class ItemUse implements Listener {
|
||||||
private static final DecimalFormat digit = new DecimalFormat("0.#");
|
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()
|
// Have to get hand manually because 1.15 and below does not have event.getHand()
|
||||||
ItemStack itemInMainHand = playerData.getPlayer().getInventory().getItemInMainHand();
|
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)) {
|
if (!eitherHandSuccess((Player) event.getEntity(), item, bowSlot)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user