mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
The other way leaks memory like a sieve.
This commit is contained in:
parent
f21fbe2d40
commit
030c8e59d7
@ -383,8 +383,11 @@ public final class CombatUtils {
|
|||||||
int numberOfTargets = Misc.getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
|
int numberOfTargets = Misc.getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
|
||||||
int damageAmount = Math.max(damage, 1);
|
int damageAmount = Math.max(damage, 1);
|
||||||
|
|
||||||
while (numberOfTargets > 0) {
|
|
||||||
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
|
||||||
|
if (numberOfTargets <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (Misc.isNPCEntity(entity) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
if (Misc.isNPCEntity(entity) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -416,7 +419,6 @@ public final class CombatUtils {
|
|||||||
numberOfTargets--;
|
numberOfTargets--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType) {
|
public static void startGainXp(McMMOPlayer mcMMOPlayer, LivingEntity target, SkillType skillType) {
|
||||||
startGainXp(mcMMOPlayer, target, skillType, 1.0);
|
startGainXp(mcMMOPlayer, target, skillType, 1.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user