This commit is contained in:
Jules 2023-03-03 15:06:13 +01:00
parent 69f9c89959
commit 1339af2604
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package net.Indyuce.mmoitems.api.interaction.weapon.untargeted;
import org.bukkit.event.block.Action;
import org.jetbrains.annotations.NotNull;
/**
* Used to determine if the item must be left or right clicked in order to
@ -13,8 +14,9 @@ public enum UntargetedWeaponType {
RIGHT_CLICK,
LEFT_CLICK;
public boolean corresponds(Action action) {
return (this == RIGHT_CLICK && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK))
|| (this == LEFT_CLICK && (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK));
public boolean corresponds(@NotNull Action action) {
return this == RIGHT_CLICK ?
action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK :
action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK;
}
}

View File

@ -494,6 +494,7 @@ public class Enchants extends ItemStat<RandomEnchantListData, EnchantListData> i
* @return Found bukkit enchantment instance
*/
@SuppressWarnings("deprecation")
@Nullable
public static Enchantment getEnchant(String key) {
key = key.toLowerCase().replace("-", "_");
Enchantment enchant = Enchantment.getByKey(NamespacedKey.minecraft(key));