1
0
mirror of https://github.com/mcMMO-Dev/mcMMO.git synced 2025-07-04 22:54:44 +02:00

Increase compatiblility with crazy enchants

This commit is contained in:
nossr50
2019-06-25 22:29:02 -07:00
parent 3368625dde
commit 517ca6568f
5 changed files with 13 additions and 3 deletions
Changelog.txtpom.xml
src/main/java/com/gmail/nossr50

@ -128,7 +128,6 @@ public class EntityListener implements Listener {
if(event.getEntity().getShooter() instanceof Player)
{
Player player = (Player) event.getEntity().getShooter();
/* WORLD GUARD MAIN FLAG CHECK */

@ -53,6 +53,10 @@ public class ArcheryManager extends SkillManager {
* @param damager The {@link Entity} who shot the arrow
*/
public double distanceXpBonusMultiplier(LivingEntity target, Entity damager) {
//Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
if(!damager.hasMetadata(mcMMO.arrowDistanceKey))
return damager.getLocation().distance(target.getLocation());
Location firedLocation = (Location) damager.getMetadata(mcMMO.arrowDistanceKey).get(0).value();
Location targetLocation = target.getLocation();

@ -232,9 +232,13 @@ public final class CombatUtils {
}
double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow);
double forceMultiplier = 1.0; //Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
if(arrow.hasMetadata(mcMMO.bowForceKey))
forceMultiplier = arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble();
applyScaledModifiers(initialDamage, finalDamage, event);
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, arrow.getMetadata(mcMMO.bowForceKey).get(0).asDouble() * distanceMultiplier);
startGainXp(mcMMOPlayer, target, PrimarySkillType.ARCHERY, forceMultiplier * distanceMultiplier);
}
/**