Prevent various auto-boxing operations by using primitive getters.
This commit is contained in:
@@ -54,7 +54,7 @@ public class AttackTrait extends AbstractEffect
|
||||
{
|
||||
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
|
||||
{
|
||||
effected.getStat().mergeAttackTrait(trait.getKey(), trait.getValue());
|
||||
effected.getStat().mergeAttackTrait(trait.getKey(), trait.getValue().floatValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AttackTrait extends AbstractEffect
|
||||
{
|
||||
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
|
||||
{
|
||||
effected.getStat().removeAttackTrait(trait.getKey(), trait.getValue());
|
||||
effected.getStat().removeAttackTrait(trait.getKey(), trait.getValue().floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -54,9 +54,9 @@ public class DefenceTrait extends AbstractEffect
|
||||
{
|
||||
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
|
||||
{
|
||||
if (trait.getValue() < 1.0f)
|
||||
if (trait.getValue().floatValue() < 1.0f)
|
||||
{
|
||||
effected.getStat().mergeDefenceTrait(trait.getKey(), trait.getValue());
|
||||
effected.getStat().mergeDefenceTrait(trait.getKey(), trait.getValue().floatValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -70,9 +70,9 @@ public class DefenceTrait extends AbstractEffect
|
||||
{
|
||||
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
|
||||
{
|
||||
if (trait.getValue() < 1.0f)
|
||||
if (trait.getValue().floatValue() < 1.0f)
|
||||
{
|
||||
effected.getStat().removeDefenceTrait(trait.getKey(), trait.getValue());
|
||||
effected.getStat().removeDefenceTrait(trait.getKey(), trait.getValue().floatValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -80,7 +80,7 @@ public class DispelBySlot extends AbstractEffect
|
||||
{
|
||||
// Dispel transformations (buff and by GM)
|
||||
final Short transformToDispel = _dispelAbnormals.get(AbnormalType.TRANSFORM);
|
||||
if ((transformToDispel != null) && ((transformToDispel == effected.getTransformationId()) || (transformToDispel < 0)))
|
||||
if ((transformToDispel != null) && ((transformToDispel.intValue() == effected.getTransformationId()) || (transformToDispel.intValue() < 0)))
|
||||
{
|
||||
effected.stopTransformation(true);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class DispelBySlot extends AbstractEffect
|
||||
}
|
||||
|
||||
final Short abnormalLevel = _dispelAbnormals.get(info.getSkill().getAbnormalType());
|
||||
return (abnormalLevel != null) && ((abnormalLevel < 0) || (abnormalLevel >= info.getSkill().getAbnormalLvl()));
|
||||
return (abnormalLevel != null) && ((abnormalLevel.shortValue() < 0) || (abnormalLevel.shortValue() >= info.getSkill().getAbnormalLvl()));
|
||||
}, true, true);
|
||||
}
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ public class KnockBack extends AbstractEffect
|
||||
ACTIVE_KNOCKBACKS.add(effected);
|
||||
|
||||
// Prevent knocking back raids and town NPCs.
|
||||
if ((effected == null) || effected.isRaid() || (effected.isNpc() && !effected.isAttackable()))
|
||||
if (effected.isRaid() || (effected.isNpc() && !effected.isAttackable()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ public class PhysicalAttackWeaponBonus extends AbstractEffect
|
||||
|
||||
// Skill specific mods.
|
||||
final double weaponMod = effector.getAttackType().isRanged() ? 70 : 77;
|
||||
final double weaponBonus = _weaponBonus.getOrDefault(effector.getAttackType(), 1.0);
|
||||
final double weaponBonus = _weaponBonus.containsKey(effector.getAttackType()) ? _weaponBonus.get(effector.getAttackType()).doubleValue() : 1d;
|
||||
final double power = _power + effector.getStat().getValue(Stat.SKILL_POWER_ADD, 0);
|
||||
final double rangedBonus = effector.getAttackType().isRanged() ? attack + power : 0;
|
||||
final double critMod = critical ? Formulas.calcCritDamage(effector, effected, skill) : 1;
|
||||
|
@@ -131,7 +131,7 @@ public class RestorationRandom extends AbstractEffect
|
||||
newItem.setEnchantLevel(Rnd.get(createdItem.getMinEnchant(), createdItem.getMaxEnchant()));
|
||||
}
|
||||
|
||||
if (extractedItems.get(newItem) != null)
|
||||
if (extractedItems.containsKey(newItem))
|
||||
{
|
||||
extractedItems.put(newItem, extractedItems.get(newItem) + itemCount);
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class RestorationRandom extends AbstractEffect
|
||||
playerIU.addModifiedItem(itemInstance);
|
||||
}
|
||||
}
|
||||
sendMessage(player, entry.getKey(), entry.getValue());
|
||||
sendMessage(player, entry.getKey(), entry.getValue().longValue());
|
||||
}
|
||||
player.sendPacket(playerIU);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class RestorationRandom extends AbstractEffect
|
||||
return EffectType.EXTRACT_ITEM;
|
||||
}
|
||||
|
||||
private void sendMessage(PlayerInstance player, ItemInstance item, Long count)
|
||||
private void sendMessage(PlayerInstance player, ItemInstance item, long count)
|
||||
{
|
||||
final SystemMessage sm;
|
||||
if (count > 1)
|
||||
|
@@ -61,7 +61,7 @@ public class ServitorShare extends AbstractEffect
|
||||
{
|
||||
for (Entry<Stat, Float> stats : _sharedStats.entrySet())
|
||||
{
|
||||
effected.getStat().mergeAdd(stats.getKey(), owner.getStat().getValue(stats.getKey()) * stats.getValue());
|
||||
effected.getStat().mergeAdd(stats.getKey(), owner.getStat().getValue(stats.getKey()) * stats.getValue().floatValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ public class Transformation extends AbstractEffect
|
||||
{
|
||||
if (!_id.isEmpty())
|
||||
{
|
||||
effected.transform(_id.get(Rnd.get(_id.size())), true);
|
||||
effected.transform(_id.get(Rnd.get(_id.size())).intValue(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -201,7 +201,7 @@ public class ExtractableItems implements IItemHandler
|
||||
|
||||
for (Entry<ItemInstance, Long> entry : extractedItems.entrySet())
|
||||
{
|
||||
sendMessage(player, entry.getKey(), entry.getValue());
|
||||
sendMessage(player, entry.getKey(), entry.getValue().longValue());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -216,7 +216,7 @@ public class ExtractableItems implements IItemHandler
|
||||
return;
|
||||
}
|
||||
|
||||
if (extractedItems.get(newItem) != null)
|
||||
if (extractedItems.containsKey(newItem))
|
||||
{
|
||||
extractedItems.put(newItem, extractedItems.get(newItem) + 1);
|
||||
}
|
||||
@@ -226,7 +226,7 @@ public class ExtractableItems implements IItemHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void sendMessage(PlayerInstance player, ItemInstance item, Long count)
|
||||
private void sendMessage(PlayerInstance player, ItemInstance item, long count)
|
||||
{
|
||||
final SystemMessage sm;
|
||||
if (count > 1)
|
||||
|
@@ -70,6 +70,6 @@ public enum StatusUpdateType
|
||||
|
||||
public int getValue(Creature creature)
|
||||
{
|
||||
return _valueSupplier.apply(creature);
|
||||
return _valueSupplier.apply(creature).intValue();
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,8 @@ public class EnchantSkillHolder
|
||||
|
||||
public long getSp(SkillEnchantType type)
|
||||
{
|
||||
return _sp.getOrDefault(type, 0L);
|
||||
final Long val = _sp.get(type);
|
||||
return val != null ? val.longValue() : 0;
|
||||
}
|
||||
|
||||
public void addChance(SkillEnchantType type, int chance)
|
||||
@@ -69,7 +70,8 @@ public class EnchantSkillHolder
|
||||
|
||||
public int getChance(SkillEnchantType type)
|
||||
{
|
||||
return _chance.getOrDefault(type, 100);
|
||||
final Integer val = _chance.get(type);
|
||||
return val != null ? val.intValue() : 100;
|
||||
}
|
||||
|
||||
public void addRequiredItem(SkillEnchantType type, ItemHolder item)
|
||||
|
@@ -65,7 +65,7 @@ public class EnchantRateItem
|
||||
*/
|
||||
public void setMagicWeapon(boolean magicWeapon)
|
||||
{
|
||||
_isMagicWeapon = magicWeapon;
|
||||
_isMagicWeapon = magicWeapon ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +82,7 @@ public class EnchantRateItem
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if ((_isMagicWeapon != null) && (item.isMagicWeapon() != _isMagicWeapon))
|
||||
else if ((_isMagicWeapon != null) && (item.isMagicWeapon() != _isMagicWeapon.booleanValue()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ public class CreatureFollowTaskManager
|
||||
|
||||
for (Entry<Creature, Integer> entry : NORMAL_FOLLOW_CREATURES.entrySet())
|
||||
{
|
||||
follow(entry.getKey(), entry.getValue());
|
||||
follow(entry.getKey(), entry.getValue().intValue());
|
||||
}
|
||||
|
||||
_workingNormal = false;
|
||||
@@ -67,7 +67,7 @@ public class CreatureFollowTaskManager
|
||||
|
||||
for (Entry<Creature, Integer> entry : ATTACK_FOLLOW_CREATURES.entrySet())
|
||||
{
|
||||
follow(entry.getKey(), entry.getValue());
|
||||
follow(entry.getKey(), entry.getValue().intValue());
|
||||
}
|
||||
|
||||
_workingAttack = false;
|
||||
|
@@ -47,7 +47,7 @@ public class DecayTaskManager
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Entry<Creature, Long> entry : DECAY_SCHEDULES.entrySet())
|
||||
{
|
||||
if (time > entry.getValue())
|
||||
if (time > entry.getValue().longValue())
|
||||
{
|
||||
final Creature creature = entry.getKey();
|
||||
DECAY_SCHEDULES.remove(creature);
|
||||
@@ -107,7 +107,7 @@ public class DecayTaskManager
|
||||
public long getRemainingTime(Creature creature)
|
||||
{
|
||||
final Long time = DECAY_SCHEDULES.get(creature);
|
||||
return time != null ? time - System.currentTimeMillis() : Long.MAX_VALUE;
|
||||
return time != null ? time.longValue() - System.currentTimeMillis() : Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +130,7 @@ public class DecayTaskManager
|
||||
ret.append('/');
|
||||
ret.append(entry.getKey().getName());
|
||||
ret.append(" decay timer: ");
|
||||
ret.append(entry.getValue() - time);
|
||||
ret.append(entry.getValue().longValue() - time);
|
||||
ret.append(Config.EOL);
|
||||
}
|
||||
|
||||
|
@@ -46,15 +46,15 @@ public class MessageDeletionTaskManager
|
||||
}
|
||||
_working = true;
|
||||
|
||||
int msgId;
|
||||
Integer msgId;
|
||||
Message msg;
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Entry<Integer, Long> entry : PENDING_MESSAGES.entrySet())
|
||||
{
|
||||
if (time > entry.getValue())
|
||||
if (time > entry.getValue().longValue())
|
||||
{
|
||||
msgId = entry.getKey();
|
||||
msg = MailManager.getInstance().getMessage(msgId);
|
||||
msg = MailManager.getInstance().getMessage(msgId.intValue());
|
||||
if (msg == null)
|
||||
{
|
||||
PENDING_MESSAGES.remove(msgId);
|
||||
@@ -83,7 +83,7 @@ public class MessageDeletionTaskManager
|
||||
}
|
||||
}
|
||||
|
||||
MailManager.getInstance().deleteMessageInDb(msgId);
|
||||
MailManager.getInstance().deleteMessageInDb(msgId.intValue());
|
||||
PENDING_MESSAGES.remove(msgId);
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public class RandomAnimationTaskManager
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Entry<Npc, Long> entry : PENDING_ANIMATIONS.entrySet())
|
||||
{
|
||||
if (time > entry.getValue())
|
||||
if (time > entry.getValue().longValue())
|
||||
{
|
||||
final Npc npc = entry.getKey();
|
||||
if (npc.isInActiveRegion() && !npc.isDead() && !npc.isInCombat() && !npc.isMoving() && !npc.hasBlockActions())
|
||||
|
@@ -45,7 +45,7 @@ public class RespawnTaskManager
|
||||
final long time = System.currentTimeMillis();
|
||||
for (Entry<Npc, Long> entry : PENDING_RESPAWNS.entrySet())
|
||||
{
|
||||
if (time > entry.getValue())
|
||||
if (time > entry.getValue().longValue())
|
||||
{
|
||||
final Npc npc = entry.getKey();
|
||||
PENDING_RESPAWNS.remove(npc);
|
||||
|
Reference in New Issue
Block a user