mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-01 20:15:28 +02:00
WIP starting work on supers for archery/crossbow
This commit is contained in:
@@ -36,14 +36,33 @@ public final class ItemUtils {
|
||||
* @param item Item to check
|
||||
* @return true if the item is a bow, false otherwise
|
||||
*/
|
||||
// TODO: Unit tests
|
||||
public static boolean isBow(@NotNull ItemStack item) {
|
||||
return mcMMO.getMaterialMapStore().isBow(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
// TODO: Unit tests
|
||||
public static boolean isCrossbow(@NotNull ItemStack item) {
|
||||
return mcMMO.getMaterialMapStore().isCrossbow(item.getType().getKey().getKey());
|
||||
}
|
||||
|
||||
// TODO: Unit tests
|
||||
public static boolean isBowOrCrossbow(@NotNull ItemStack item) {
|
||||
return isBow(item) || isCrossbow(item);
|
||||
}
|
||||
|
||||
// TODO: Unit tests
|
||||
public static BowType getBowType(@NotNull ItemStack item) {
|
||||
if (isBow(item)) {
|
||||
return BowType.BOW;
|
||||
} else if (isCrossbow(item)) {
|
||||
return BowType.CROSSBOW;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(item + " is not a bow or crossbow");
|
||||
}
|
||||
|
||||
// TODO: Unit tests
|
||||
public static boolean isTrident(@NotNull ItemStack item) {
|
||||
return mcMMO.getMaterialMapStore().isTrident(item.getType().getKey().getKey());
|
||||
}
|
||||
|
@@ -49,6 +49,14 @@ public final class CombatUtils {
|
||||
return mcMMO.getMetadataService().getMobMetadataService();
|
||||
}
|
||||
|
||||
// TODO: Unit tests
|
||||
public static void processProjectileSkillSuperAbilityActivation(McMMOPlayer mmoPlayer, ItemStack heldItem) {
|
||||
if (heldItem != null && mmoPlayer != null) {
|
||||
if (ItemUtils.isBowOrCrossbow(heldItem))
|
||||
mmoPlayer.checkAbilityActivationProjectiles(ItemUtils.getBowType(heldItem));
|
||||
}
|
||||
}
|
||||
|
||||
//Likely.. because who knows what plugins are throwing around
|
||||
public static boolean isDamageLikelyFromNormalCombat(@NotNull DamageCause damageCause) {
|
||||
return switch (damageCause) {
|
||||
|
Reference in New Issue
Block a user