mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Fixed a bug where Spectral arrow awarded too much XP
This commit is contained in:
parent
34d9f70ac0
commit
da06d5c075
@ -161,11 +161,13 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
Projectile projectile = event.getEntity();
|
||||
EntityType entityType = projectile.getType();
|
||||
|
||||
if(!(projectile instanceof Arrow))
|
||||
return;
|
||||
|
||||
if(entityType == EntityType.ARROW || entityType == EntityType.SPECTRAL_ARROW) {
|
||||
if(!projectile.hasMetadata(mcMMO.bowForceKey))
|
||||
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(pluginRef, 1.0));
|
||||
|
||||
if(!projectile.hasMetadata(mcMMO.arrowDistanceKey))
|
||||
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(pluginRef, projectile.getLocation()));
|
||||
|
||||
for (Enchantment enchantment : player.getInventory().getItemInMainHand().getEnchantments().keySet()) {
|
||||
@ -179,6 +181,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor EntityChangeBlock events.
|
||||
|
@ -36,6 +36,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
@ -117,9 +119,14 @@ public final class CombatUtils {
|
||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||
}
|
||||
|
||||
private static void printFinalDamageDebug(Player player, EntityDamageByEntityEvent event, McMMOPlayer mcMMOPlayer) {
|
||||
private static void printFinalDamageDebug(@NotNull Player player, @NotNull EntityDamageByEntityEvent event, @NotNull McMMOPlayer mcMMOPlayer, @Nullable String... extraInfoLines) {
|
||||
if(mcMMOPlayer.isDebugMode()) {
|
||||
player.sendMessage("Final Damage value after mcMMO modifiers: "+ event.getFinalDamage());
|
||||
if(extraInfoLines != null) {
|
||||
for(String str : extraInfoLines) {
|
||||
player.sendMessage(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -317,9 +324,14 @@ public final class CombatUtils {
|
||||
forceMultiplier = arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble();
|
||||
|
||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
||||
|
||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.ARCHERY, forceMultiplier * distanceMultiplier);
|
||||
|
||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||
printFinalDamageDebug(player, event, mcMMOPlayer,
|
||||
"Distance Multiplier: "+distanceMultiplier,
|
||||
"Force Multiplier: "+forceMultiplier,
|
||||
"Initial Damage: "+initialDamage,
|
||||
"Final Damage: "+finalDamage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user