mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-27 23:56:45 +01:00
Fix exceptions when shooting entities through worlds on folia
This commit is contained in:
parent
b9b1127087
commit
b9860b9ba4
@ -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;
|
||||||
|
@ -921,7 +921,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