fix spectral arrows (#5173)

This commit is contained in:
Josh Taylor 2025-05-06 21:08:09 +01:00 committed by GitHub
parent f3a2199fd6
commit a8976ae953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -181,7 +181,7 @@ public final class CombatUtils {
}
private static void processCrossbowsCombat(@NotNull LivingEntity target, @NotNull Player player,
@NotNull EntityDamageByEntityEvent event, @NotNull Arrow arrow) {
@NotNull EntityDamageByEntityEvent event, @NotNull AbstractArrow arrow) {
double initialDamage = event.getDamage();
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
@ -384,7 +384,7 @@ public final class CombatUtils {
}
private static void processArcheryCombat(@NotNull LivingEntity target, @NotNull Player player,
@NotNull EntityDamageByEntityEvent event, @NotNull Arrow arrow) {
@NotNull EntityDamageByEntityEvent event, @NotNull AbstractArrow arrow) {
double initialDamage = event.getDamage();
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
@ -566,7 +566,7 @@ public final class CombatUtils {
}
}
}
} else if (painSource instanceof Arrow arrow) {
} else if (painSource instanceof AbstractArrow arrow) {
ProjectileSource projectileSource = arrow.getShooter();
boolean isCrossbow = isCrossbowProjectile(arrow);
if (projectileSource instanceof Player player) {
@ -1055,7 +1055,7 @@ public final class CombatUtils {
*
* @param arrow the projectile
*/
public static void delayArrowMetaCleanup(@NotNull Arrow arrow) {
public static void delayArrowMetaCleanup(@NotNull AbstractArrow arrow) {
mcMMO.p.getFoliaLib().getScheduler().runLater(() -> ProjectileUtils.cleanupProjectileMetadata(arrow), 20*120);
}
}

View File

@ -3,6 +3,7 @@ package com.gmail.nossr50.util.skills;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.MetadataConstants;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
@ -32,7 +33,7 @@ public class ProjectileUtils {
*
* @param arrow projectile
*/
public static void cleanupProjectileMetadata(@NotNull Arrow arrow) {
public static void cleanupProjectileMetadata(@NotNull AbstractArrow arrow) {
ARROW_METADATA_KEYS.stream()
.filter(arrow::hasMetadata)
.forEach(key -> arrow.removeMetadata(key, mcMMO.p));
@ -61,7 +62,7 @@ public class ProjectileUtils {
});
}
public static boolean isCrossbowProjectile(@NotNull Arrow arrow) {
public static boolean isCrossbowProjectile(@NotNull AbstractArrow arrow) {
return arrow.isShotFromCrossbow()
|| arrow.hasMetadata(MetadataConstants.METADATA_KEY_CROSSBOW_PROJECTILE);
}