The other way leaks memory like a sieve.

This commit is contained in:
GJ 2013-05-22 00:01:19 -04:00
parent f21fbe2d40
commit 030c8e59d7

View File

@ -383,38 +383,40 @@ public final class CombatUtils {
int numberOfTargets = Misc.getTier(attacker.getItemInHand()); // The higher the weapon tier, the more targets you hit
int damageAmount = Math.max(damage, 1);
while (numberOfTargets > 0) {
for (Entity entity : target.getNearbyEntities(2.5, 2.5, 2.5)) {
if (Misc.isNPCEntity(entity) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
continue;
}
LivingEntity livingEntity = (LivingEntity) entity;
mcMMO.p.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(attacker));
switch (type) {
case SWORDS:
if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck"));
}
BleedTimerTask.add(livingEntity, Swords.serratedStrikesBleedTicks);
break;
case AXES:
if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.Cleave.Struck"));
}
break;
default:
break;
}
dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--;
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)) {
continue;
}
LivingEntity livingEntity = (LivingEntity) entity;
mcMMO.p.getServer().getPluginManager().callEvent(new FakePlayerAnimationEvent(attacker));
switch (type) {
case SWORDS:
if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Swords.Combat.SS.Struck"));
}
BleedTimerTask.add(livingEntity, Swords.serratedStrikesBleedTicks);
break;
case AXES:
if (entity instanceof Player) {
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.Cleave.Struck"));
}
break;
default:
break;
}
dealDamage(livingEntity, damageAmount, attacker);
numberOfTargets--;
}
}