mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Fix exceptions when shooting entities through worlds on folia (#5024)
This commit is contained in:
parent
f67e30641d
commit
93bb160742
@ -5,6 +5,7 @@ import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
|||||||
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
import com.gmail.nossr50.datatypes.experience.XPGainSource;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.CancellableRunnable;
|
import com.gmail.nossr50.util.CancellableRunnable;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ public class AwardCombatXpTask extends CancellableRunnable {
|
|||||||
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
|
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.beginXpGain(primarySkillType, (int) (damage * baseXp), xpGainReason, XPGainSource.SELF);
|
final double finalDamage = damage;
|
||||||
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mcMMOPlayer.getPlayer(), task -> mcMMOPlayer.beginXpGain(primarySkillType, (int) (finalDamage * baseXp), xpGainReason, XPGainSource.SELF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,6 +287,9 @@ public class TamingManager extends SkillManager {
|
|||||||
double range = 5;
|
double range = 5;
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
|
||||||
|
if (!target.getWorld().equals(player.getWorld()))
|
||||||
|
return;
|
||||||
|
|
||||||
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
for (Entity entity : player.getNearbyEntities(range, range, range)) {
|
||||||
if (entity.getType() != EntityType.WOLF) {
|
if (entity.getType() != EntityType.WOLF) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -945,7 +945,7 @@ public final class CombatUtils {
|
|||||||
baseXP *= multiplier;
|
baseXP *= multiplier;
|
||||||
|
|
||||||
if (baseXP > 0) {
|
if (baseXP > 0) {
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntity(mcMMOPlayer.getPlayer(), new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
|
mcMMO.p.getFoliaLib().getImpl().runAtEntity(target, new AwardCombatXpTask(mcMMOPlayer, primarySkillType, baseXP, target, xpGainReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user