mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-04 05:25:28 +02:00
Added isUnarmed Method
Checks if the player is not holding a tool, as opposed to checking if the player is holding air. This means that attacking with something such as a dirt block would count as unarmed.
This commit is contained in:
@@ -13,6 +13,7 @@ import org.bukkit.material.Dye;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.party.ItemWeightConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public final class ItemUtils {
|
||||
@@ -146,6 +147,20 @@ public final class ItemUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item counts as unarmed.
|
||||
*
|
||||
* @param item Item to check
|
||||
* @return true if the item counts as unarmed, false otherwise
|
||||
*/
|
||||
public static boolean isUnarmed(ItemStack item) {
|
||||
if (Config.getInstance().getUnarmedItemsAsUnarmed()) {
|
||||
return !isMinecraftTool(item);
|
||||
}
|
||||
|
||||
return item.getType() == Material.AIR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the item is a helmet.
|
||||
*
|
||||
|
Reference in New Issue
Block a user