mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-04 05:25:28 +02:00
Initial work on crossbows
This commit is contained in:
@@ -31,9 +31,23 @@ public final class ItemUtils {
|
||||
|
||||
|
||||
public static boolean hasItemInEitherHand(Player player, Material material) {
|
||||
return player.getInventory().getItemInMainHand().getType() == material || player.getInventory().getItemInOffHand().getType() == material;
|
||||
return hasItemInEitherHand(player, material.getKey().getKey());
|
||||
}
|
||||
|
||||
public static boolean hasItemInEitherHand(Player player, String id) {
|
||||
return player.getInventory().getItemInMainHand().getType().getKey().getKey().equalsIgnoreCase(id)
|
||||
|| player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase(id);
|
||||
}
|
||||
|
||||
public static boolean hasItemInMainHand(Player player, String id) {
|
||||
return player.getInventory().getItemInMainHand().getType().getKey().getKey().equalsIgnoreCase(id);
|
||||
}
|
||||
|
||||
public static boolean hasItemInOffHand(Player player, String id) {
|
||||
return player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the item is a sword.
|
||||
*
|
||||
|
Reference in New Issue
Block a user