Prevent various auto-boxing operations by using primitive getters.

This commit is contained in:
MobiusDevelopment
2020-06-27 23:45:29 +00:00
parent 5dc0351dbc
commit 7ee1d55060
343 changed files with 757 additions and 703 deletions

View File

@ -141,9 +141,9 @@ public class OfflineTraderTable
for (Entry<Integer, Long> entry : pc.getManufactureItems().entrySet())
{
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, entry.getKey());
stmItems.setInt(2, entry.getKey().intValue());
stmItems.setLong(3, 0);
stmItems.setLong(4, entry.getValue());
stmItems.setLong(4, entry.getValue().longValue());
stmItems.executeUpdate();
stmItems.clearParameters();
}
@ -414,9 +414,9 @@ public class OfflineTraderTable
for (Entry<Integer, Long> entry : trader.getManufactureItems().entrySet())
{
stm3.setInt(1, trader.getObjectId());
stm3.setInt(2, entry.getKey());
stm3.setInt(2, entry.getKey().intValue());
stm3.setLong(3, 0);
stm3.setLong(4, entry.getValue());
stm3.setLong(4, entry.getValue().longValue());
stm3.executeUpdate();
stm3.clearParameters();
}

View File

@ -70,6 +70,6 @@ public enum StatusUpdateType
public int getValue(Creature creature)
{
return _valueSupplier.apply(creature);
return _valueSupplier.apply(creature).intValue();
}
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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())

View File

@ -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);