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; package net.Indyuce.mmoitems.api.interaction.weapon.untargeted;
import org.bukkit.event.block.Action; 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 * Used to determine if the item must be left or right clicked in order to
@ -13,8 +14,9 @@ public enum UntargetedWeaponType {
RIGHT_CLICK, RIGHT_CLICK,
LEFT_CLICK; LEFT_CLICK;
public boolean corresponds(Action action) { public boolean corresponds(@NotNull Action action) {
return (this == RIGHT_CLICK && (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK)) return this == RIGHT_CLICK ?
|| (this == LEFT_CLICK && (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK)); 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 * @return Found bukkit enchantment instance
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Nullable
public static Enchantment getEnchant(String key) { public static Enchantment getEnchant(String key) {
key = key.toLowerCase().replace("-", "_"); key = key.toLowerCase().replace("-", "_");
Enchantment enchant = Enchantment.getByKey(NamespacedKey.minecraft(key)); Enchantment enchant = Enchantment.getByKey(NamespacedKey.minecraft(key));