From 7ff819097716d13d6d2e0beab7d03ced2d1cdaea Mon Sep 17 00:00:00 2001 From: P0nk Date: Thu, 8 Apr 2021 07:39:02 +0200 Subject: [PATCH] cleanup: remove unnecessary boxing --- src/main/java/client/BuddyList.java | 8 +- src/main/java/client/SkillFactory.java | 2 +- .../java/client/inventory/PetDataFactory.java | 15 +- .../handlers/AbstractDealDamageHandler.java | 10 +- .../handlers/PlayerLoggedinHandler.java | 2 +- src/main/java/provider/wz/WZIMGFile.java | 17 +- src/main/java/server/MapleStatEffect.java | 170 +++++++++--------- .../java/server/life/MapleLifeFactory.java | 6 +- src/main/java/server/life/MapleMonster.java | 8 +- src/main/java/server/life/MobSkill.java | 18 +- .../java/server/life/MobSkillFactory.java | 15 +- src/main/java/server/maps/MapleMap.java | 8 +- .../java/server/maps/MapleReactorFactory.java | 20 +-- src/main/java/tools/MaplePacketCreator.java | 2 +- 14 files changed, 150 insertions(+), 151 deletions(-) diff --git a/src/main/java/client/BuddyList.java b/src/main/java/client/BuddyList.java index d6abe79136..2fac16afc2 100644 --- a/src/main/java/client/BuddyList.java +++ b/src/main/java/client/BuddyList.java @@ -49,7 +49,7 @@ public class BuddyList { public boolean contains(int characterId) { synchronized(buddies) { - return buddies.containsKey(Integer.valueOf(characterId)); + return buddies.containsKey(characterId); } } @@ -76,7 +76,7 @@ public class BuddyList { public BuddylistEntry get(int characterId) { synchronized(buddies) { - return buddies.get(Integer.valueOf(characterId)); + return buddies.get(characterId); } } @@ -93,13 +93,13 @@ public class BuddyList { public void put(BuddylistEntry entry) { synchronized(buddies) { - buddies.put(Integer.valueOf(entry.getCharacterId()), entry); + buddies.put(entry.getCharacterId(), entry); } } public void remove(int characterId) { synchronized(buddies) { - buddies.remove(Integer.valueOf(characterId)); + buddies.remove(characterId); } } diff --git a/src/main/java/client/SkillFactory.java b/src/main/java/client/SkillFactory.java index 1b1e9df2c4..5f337e2d36 100644 --- a/src/main/java/client/SkillFactory.java +++ b/src/main/java/client/SkillFactory.java @@ -36,7 +36,7 @@ public class SkillFactory { public static Skill getSkill(int id) { if (!skills.isEmpty()) { - return skills.get(Integer.valueOf(id)); + return skills.get(id); } return null; } diff --git a/src/main/java/client/inventory/PetDataFactory.java b/src/main/java/client/inventory/PetDataFactory.java index fb80aca432..e62f54d3c6 100644 --- a/src/main/java/client/inventory/PetDataFactory.java +++ b/src/main/java/client/inventory/PetDataFactory.java @@ -21,14 +21,15 @@ */ package client.inventory; -import java.io.File; -import java.util.HashMap; -import java.util.Map; import provider.MapleData; import provider.MapleDataProvider; import provider.MapleDataProviderFactory; import provider.MapleDataTool; +import java.io.File; +import java.util.HashMap; +import java.util.Map; + /** * * @author Danny (Leifde) @@ -39,7 +40,7 @@ public class PetDataFactory { private static Map petHunger = new HashMap(); public static PetCommand getPetCommand(int petId, int skillId) { - PetCommand ret = petCommands.get(Integer.valueOf(petId) + "" + skillId); + PetCommand ret = petCommands.get(petId + "" + skillId); if (ret != null) { return ret; } @@ -61,14 +62,14 @@ public class PetDataFactory { } public static int getHunger(int petId) { - Integer ret = petHunger.get(Integer.valueOf(petId)); + Integer ret = petHunger.get(petId); if (ret != null) { return ret; } synchronized (petHunger) { - ret = petHunger.get(Integer.valueOf(petId)); + ret = petHunger.get(petId); if (ret == null) { - ret = Integer.valueOf(MapleDataTool.getInt(dataRoot.getData("Pet/" + petId + ".img").getChildByPath("info/hungry"), 1)); + ret = MapleDataTool.getInt(dataRoot.getData("Pet/" + petId + ".img").getChildByPath("info/hungry"), 1); } return ret; } diff --git a/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java b/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java index 24ebfab784..c138702654 100644 --- a/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java +++ b/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java @@ -558,7 +558,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl for (int j = 0; j < bullets; j++) { int mesoid = lea.readInt(); lea.skip(1); - ret.allDamage.put(Integer.valueOf(mesoid), null); + ret.allDamage.put(mesoid, null); } return ret; } else { @@ -572,16 +572,16 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl List allDamageNumbers = new ArrayList<>(); for (int j = 0; j < bullets; j++) { int damage = lea.readInt(); - allDamageNumbers.add(Integer.valueOf(damage)); + allDamageNumbers.add(damage); } - ret.allDamage.put(Integer.valueOf(oid), allDamageNumbers); + ret.allDamage.put(oid, allDamageNumbers); lea.skip(4); } else { int bullets = lea.readByte(); for (int j = 0; j < bullets; j++) { int mesoid = lea.readInt(); lea.skip(1); - ret.allDamage.put(Integer.valueOf(mesoid), null); + ret.allDamage.put(mesoid, null); } } } @@ -859,7 +859,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl if (ret.skill != Corsair.RAPID_FIRE || ret.skill != Aran.HIDDEN_FULL_DOUBLE || ret.skill != Aran.HIDDEN_FULL_TRIPLE || ret.skill != Aran.HIDDEN_OVER_DOUBLE || ret.skill != Aran.HIDDEN_OVER_TRIPLE) { lea.skip(4); } - ret.allDamage.put(Integer.valueOf(oid), allDamageNumbers); + ret.allDamage.put(oid, allDamageNumbers); } if (ret.skill == NightWalker.POISON_BOMB) { // Poison Bomb lea.skip(4); diff --git a/src/main/java/net/server/channel/handlers/PlayerLoggedinHandler.java b/src/main/java/net/server/channel/handlers/PlayerLoggedinHandler.java index ea3c4337b1..0f83d0a9f3 100644 --- a/src/main/java/net/server/channel/handlers/PlayerLoggedinHandler.java +++ b/src/main/java/net/server/channel/handlers/PlayerLoggedinHandler.java @@ -360,7 +360,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { if(diseases != null) { for(Entry> e : diseases.entrySet()) { - final List> debuff = Collections.singletonList(new Pair<>(e.getKey(), Integer.valueOf(e.getValue().getRight().getX()))); + final List> debuff = Collections.singletonList(new Pair<>(e.getKey(), e.getValue().getRight().getX())); c.announce(MaplePacketCreator.giveDebuff(debuff, e.getValue().getRight())); } } diff --git a/src/main/java/provider/wz/WZIMGFile.java b/src/main/java/provider/wz/WZIMGFile.java index bec06c78bd..e24154322c 100644 --- a/src/main/java/provider/wz/WZIMGFile.java +++ b/src/main/java/provider/wz/WZIMGFile.java @@ -21,16 +21,13 @@ */ package provider.wz; -import java.awt.Point; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.io.RandomAccessFile; import tools.data.input.GenericSeekableLittleEndianAccessor; import tools.data.input.RandomAccessByteStream; import tools.data.input.SeekableLittleEndianAccessor; +import java.awt.*; +import java.io.*; + public class WZIMGFile { private WZFileEntry file; private WZIMGEntry root; @@ -91,19 +88,19 @@ public class WZIMGFile { case 2: case 11: //??? no idea, since 0.49 entry.setType(MapleDataType.SHORT); - entry.setData(Short.valueOf(slea.readShort())); + entry.setData(slea.readShort()); break; case 3: entry.setType(MapleDataType.INT); - entry.setData(Integer.valueOf(WZTool.readValue(slea))); + entry.setData(WZTool.readValue(slea)); break; case 4: entry.setType(MapleDataType.FLOAT); - entry.setData(Float.valueOf(WZTool.readFloatValue(slea))); + entry.setData(WZTool.readFloatValue(slea)); break; case 5: entry.setType(MapleDataType.DOUBLE); - entry.setData(Double.valueOf(slea.readDouble())); + entry.setData(slea.readDouble()); break; case 8: entry.setType(MapleDataType.STRING); diff --git a/src/main/java/server/MapleStatEffect.java b/src/main/java/server/MapleStatEffect.java index 1c747f7165..f9cd2878d0 100644 --- a/src/main/java/server/MapleStatEffect.java +++ b/src/main/java/server/MapleStatEffect.java @@ -249,7 +249,7 @@ public class MapleStatEffect { addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AURA, ret.barrier); ret.mapProtection = mapProtection(sourceid); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, Integer.valueOf(ret.mapProtection)); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_PROTECTION, (int) ret.mapProtection); if (ret.overTime && ret.getSummonMovementType() == null) { if (!skill) { @@ -257,8 +257,8 @@ public class MapleStatEffect { ret.berserk = MapleDataTool.getInt("berserk", source, 0); ret.booster = MapleDataTool.getInt("booster", source, 0); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, Integer.valueOf(ret.berserk)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, Integer.valueOf(ret.booster)); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BERSERK, ret.berserk); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.BOOSTER, ret.booster); } else if (isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) { ret.mhpR = (byte) MapleDataTool.getInt("mhpR", source, 0); @@ -266,8 +266,8 @@ public class MapleStatEffect { ret.mmpR = (byte) MapleDataTool.getInt("mmpR", source, 0); ret.mmpRRate = (short) (MapleDataTool.getInt("mmpRRate", source, 0) * 100); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.HPREC, Integer.valueOf(ret.mhpR)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MPREC, Integer.valueOf(ret.mmpR)); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.HPREC, (int) ret.mhpR); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MPREC, (int) ret.mmpR); } else if (isRateCoupon(sourceid)) { switch (MapleDataTool.getInt("expR", source, 0)) { @@ -383,14 +383,14 @@ public class MapleStatEffect { } } - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WATK, Integer.valueOf(ret.watk)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WDEF, Integer.valueOf(ret.wdef)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MATK, Integer.valueOf(ret.matk)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MDEF, Integer.valueOf(ret.mdef)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ACC, Integer.valueOf(ret.acc)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AVOID, Integer.valueOf(ret.avoid)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, Integer.valueOf(ret.speed)); - addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, Integer.valueOf(ret.jump)); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WATK, (int) ret.watk); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.WDEF, (int) ret.wdef); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MATK, (int) ret.matk); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MDEF, (int) ret.mdef); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.ACC, (int) ret.acc); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.AVOID, (int) ret.avoid); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.SPEED, (int) ret.speed); + addBuffStatPairToListIfNotZero(statups, MapleBuffStat.JUMP, (int) ret.jump); } MapleData ltd = source.getChildByPath("lt"); @@ -429,13 +429,13 @@ public class MapleStatEffect { case Noblesse.RECOVERY: case Legend.RECOVERY: case Evan.RECOVERY: - statups.add(new Pair<>(MapleBuffStat.RECOVERY, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.RECOVERY, x)); break; case Beginner.ECHO_OF_HERO: case Noblesse.ECHO_OF_HERO: case Legend.ECHO_OF_HERO: case Evan.ECHO_OF_HERO: - statups.add(new Pair<>(MapleBuffStat.ECHO_OF_HERO, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.ECHO_OF_HERO, ret.x)); break; case Beginner.MONSTER_RIDER: case Noblesse.MONSTER_RIDER: @@ -455,27 +455,27 @@ public class MapleStatEffect { case Beginner.BALROG_MOUNT: case Noblesse.BALROG_MOUNT: case Legend.BALROG_MOUNT: - statups.add(new Pair<>(MapleBuffStat.MONSTER_RIDING, Integer.valueOf(sourceid))); + statups.add(new Pair<>(MapleBuffStat.MONSTER_RIDING, sourceid)); break; case Beginner.INVINCIBLE_BARRIER: case Noblesse.INVINCIBLE_BARRIER: case Legend.INVICIBLE_BARRIER: case Evan.INVINCIBLE_BARRIER: - statups.add(new Pair<>(MapleBuffStat.DIVINE_BODY, Integer.valueOf(1))); + statups.add(new Pair<>(MapleBuffStat.DIVINE_BODY, 1)); break; case Fighter.POWER_GUARD: case Page.POWER_GUARD: - statups.add(new Pair<>(MapleBuffStat.POWERGUARD, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.POWERGUARD, x)); break; case Spearman.HYPER_BODY: case GM.HYPER_BODY: case SuperGM.HYPER_BODY: - statups.add(new Pair<>(MapleBuffStat.HYPERBODYHP, Integer.valueOf(x))); - statups.add(new Pair<>(MapleBuffStat.HYPERBODYMP, Integer.valueOf(ret.y))); + statups.add(new Pair<>(MapleBuffStat.HYPERBODYHP, x)); + statups.add(new Pair<>(MapleBuffStat.HYPERBODYMP, ret.y)); break; case Crusader.COMBO: case DawnWarrior.COMBO: - statups.add(new Pair<>(MapleBuffStat.COMBO, Integer.valueOf(1))); + statups.add(new Pair<>(MapleBuffStat.COMBO, 1)); break; case WhiteKnight.BW_FIRE_CHARGE: case WhiteKnight.BW_ICE_CHARGE: @@ -487,130 +487,130 @@ public class MapleStatEffect { case Paladin.SWORD_HOLY_CHARGE: case DawnWarrior.SOUL_CHARGE: case ThunderBreaker.LIGHTNING_CHARGE: - statups.add(new Pair<>(MapleBuffStat.WK_CHARGE, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.WK_CHARGE, x)); break; case DragonKnight.DRAGON_BLOOD: - statups.add(new Pair<>(MapleBuffStat.DRAGONBLOOD, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.DRAGONBLOOD, ret.x)); break; case Hero.STANCE: case Paladin.STANCE: case DarkKnight.STANCE: case Aran.FREEZE_STANDING: - statups.add(new Pair<>(MapleBuffStat.STANCE, Integer.valueOf(iprop))); + statups.add(new Pair<>(MapleBuffStat.STANCE, iprop)); break; case DawnWarrior.FINAL_ATTACK: case WindArcher.FINAL_ATTACK: - statups.add(new Pair<>(MapleBuffStat.FINALATTACK, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.FINALATTACK, x)); break; // MAGICIAN case Magician.MAGIC_GUARD: case BlazeWizard.MAGIC_GUARD: case Evan.MAGIC_GUARD: - statups.add(new Pair<>(MapleBuffStat.MAGIC_GUARD, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.MAGIC_GUARD, x)); break; case Cleric.INVINCIBLE: - statups.add(new Pair<>(MapleBuffStat.INVINCIBLE, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.INVINCIBLE, x)); break; case Priest.HOLY_SYMBOL: case SuperGM.HOLY_SYMBOL: - statups.add(new Pair<>(MapleBuffStat.HOLY_SYMBOL, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.HOLY_SYMBOL, x)); break; case FPArchMage.INFINITY: case ILArchMage.INFINITY: case Bishop.INFINITY: - statups.add(new Pair<>(MapleBuffStat.INFINITY, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.INFINITY, x)); break; case FPArchMage.MANA_REFLECTION: case ILArchMage.MANA_REFLECTION: case Bishop.MANA_REFLECTION: - statups.add(new Pair<>(MapleBuffStat.MANA_REFLECTION, Integer.valueOf(1))); + statups.add(new Pair<>(MapleBuffStat.MANA_REFLECTION, 1)); break; case Bishop.HOLY_SHIELD: - statups.add(new Pair<>(MapleBuffStat.HOLY_SHIELD, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.HOLY_SHIELD, x)); break; case BlazeWizard.ELEMENTAL_RESET: case Evan.ELEMENTAL_RESET: - statups.add(new Pair<>(MapleBuffStat.ELEMENTAL_RESET, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.ELEMENTAL_RESET, x)); break; case Evan.MAGIC_SHIELD: - statups.add(new Pair<>(MapleBuffStat.MAGIC_SHIELD, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.MAGIC_SHIELD, x)); break; case Evan.MAGIC_RESISTANCE: - statups.add(new Pair<>(MapleBuffStat.MAGIC_RESISTANCE, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.MAGIC_RESISTANCE, x)); break; case Evan.SLOW: - statups.add(new Pair<>(MapleBuffStat.SLOW, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.SLOW, x)); // BOWMAN case Priest.MYSTIC_DOOR: case Hunter.SOUL_ARROW: case Crossbowman.SOUL_ARROW: case WindArcher.SOUL_ARROW: - statups.add(new Pair<>(MapleBuffStat.SOULARROW, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.SOULARROW, x)); break; case Ranger.PUPPET: case Sniper.PUPPET: case WindArcher.PUPPET: case Outlaw.OCTOPUS: case Corsair.WRATH_OF_THE_OCTOPI: - statups.add(new Pair<>(MapleBuffStat.PUPPET, Integer.valueOf(1))); + statups.add(new Pair<>(MapleBuffStat.PUPPET, 1)); break; case Bowmaster.CONCENTRATE: statups.add(new Pair<>(MapleBuffStat.CONCENTRATE, x)); break; case Bowmaster.HAMSTRING: - statups.add(new Pair<>(MapleBuffStat.HAMSTRING, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.HAMSTRING, x)); monsterStatus.put(MonsterStatus.SPEED, x); break; case Marksman.BLIND: - statups.add(new Pair<>(MapleBuffStat.BLIND, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.BLIND, x)); monsterStatus.put(MonsterStatus.ACC, x); break; case Bowmaster.SHARP_EYES: case Marksman.SHARP_EYES: - statups.add(new Pair<>(MapleBuffStat.SHARP_EYES, Integer.valueOf(ret.x << 8 | ret.y))); + statups.add(new Pair<>(MapleBuffStat.SHARP_EYES, ret.x << 8 | ret.y)); break; case WindArcher.WIND_WALK: - statups.add(new Pair<>(MapleBuffStat.WIND_WALK, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.WIND_WALK, x)); //break; thanks Vcoc for noticing WW not showing for other players when changing maps case Rogue.DARK_SIGHT: case NightWalker.DARK_SIGHT: - statups.add(new Pair<>(MapleBuffStat.DARKSIGHT, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.DARKSIGHT, x)); break; case Hermit.MESO_UP: - statups.add(new Pair<>(MapleBuffStat.MESOUP, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.MESOUP, x)); break; case Hermit.SHADOW_PARTNER: case NightWalker.SHADOW_PARTNER: - statups.add(new Pair<>(MapleBuffStat.SHADOWPARTNER, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.SHADOWPARTNER, x)); break; case ChiefBandit.MESO_GUARD: - statups.add(new Pair<>(MapleBuffStat.MESOGUARD, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.MESOGUARD, x)); break; case ChiefBandit.PICKPOCKET: - statups.add(new Pair<>(MapleBuffStat.PICKPOCKET, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.PICKPOCKET, x)); break; case NightLord.SHADOW_STARS: - statups.add(new Pair<>(MapleBuffStat.SHADOW_CLAW, Integer.valueOf(0))); + statups.add(new Pair<>(MapleBuffStat.SHADOW_CLAW, 0)); break; // PIRATE case Pirate.DASH: case ThunderBreaker.DASH: case Beginner.SPACE_DASH: case Noblesse.SPACE_DASH: - statups.add(new Pair<>(MapleBuffStat.DASH2, Integer.valueOf(ret.x))); - statups.add(new Pair<>(MapleBuffStat.DASH, Integer.valueOf(ret.y))); + statups.add(new Pair<>(MapleBuffStat.DASH2, ret.x)); + statups.add(new Pair<>(MapleBuffStat.DASH, ret.y)); break; case Corsair.SPEED_INFUSION: case Buccaneer.SPEED_INFUSION: case ThunderBreaker.SPEED_INFUSION: - statups.add(new Pair<>(MapleBuffStat.SPEED_INFUSION, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.SPEED_INFUSION, x)); break; case Outlaw.HOMING_BEACON: case Corsair.BULLSEYE: - statups.add(new Pair<>(MapleBuffStat.HOMING_BEACON, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.HOMING_BEACON, x)); break; case ThunderBreaker.SPARK: - statups.add(new Pair<>(MapleBuffStat.SPARK, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.SPARK, x)); break; // MULTIPLE case Aran.POLEARM_BOOSTER: @@ -637,7 +637,7 @@ public class MapleStatEffect { case Beginner.POWER_EXPLOSION: case Noblesse.POWER_EXPLOSION: case Legend.POWER_EXPLOSION: - statups.add(new Pair<>(MapleBuffStat.BOOSTER, Integer.valueOf(x))); + statups.add(new Pair<>(MapleBuffStat.BOOSTER, x)); break; case Hero.MAPLE_WARRIOR: case Paladin.MAPLE_WARRIOR: @@ -653,18 +653,18 @@ public class MapleStatEffect { case Buccaneer.MAPLE_WARRIOR: case Aran.MAPLE_WARRIOR: case Evan.MAPLE_WARRIOR: - statups.add(new Pair<>(MapleBuffStat.MAPLE_WARRIOR, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.MAPLE_WARRIOR, ret.x)); break; // SUMMON case Ranger.SILVER_HAWK: case Sniper.GOLDEN_EAGLE: - statups.add(new Pair<>(MapleBuffStat.SUMMON, Integer.valueOf(1))); - monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1)); + statups.add(new Pair<>(MapleBuffStat.SUMMON, 1)); + monsterStatus.put(MonsterStatus.STUN, 1); break; case FPArchMage.ELQUINES: case Marksman.FROST_PREY: - statups.add(new Pair<>(MapleBuffStat.SUMMON, Integer.valueOf(1))); - monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1)); + statups.add(new Pair<>(MapleBuffStat.SUMMON, 1)); + monsterStatus.put(MonsterStatus.FREEZE, 1); break; case Priest.SUMMON_DRAGON: case Bowmaster.PHOENIX: @@ -678,32 +678,32 @@ public class MapleStatEffect { case NightWalker.DARKNESS: case ThunderBreaker.LIGHTNING: case BlazeWizard.IFRIT: - statups.add(new Pair<>(MapleBuffStat.SUMMON, Integer.valueOf(1))); + statups.add(new Pair<>(MapleBuffStat.SUMMON, 1)); break; // ----------------------------- MONSTER STATUS ---------------------------------- // case Crusader.ARMOR_CRASH: case DragonKnight.POWER_CRASH: case WhiteKnight.MAGIC_CRASH: - monsterStatus.put(MonsterStatus.SEAL_SKILL, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.SEAL_SKILL, 1); break; case Rogue.DISORDER: - monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x)); - monsterStatus.put(MonsterStatus.WDEF, Integer.valueOf(ret.y)); + monsterStatus.put(MonsterStatus.WATK, ret.x); + monsterStatus.put(MonsterStatus.WDEF, ret.y); break; case Corsair.HYPNOTIZE: monsterStatus.put(MonsterStatus.INERTMOB, 1); break; case NightLord.NINJA_AMBUSH: case Shadower.NINJA_AMBUSH: - monsterStatus.put(MonsterStatus.NINJA_AMBUSH, Integer.valueOf(ret.damage)); + monsterStatus.put(MonsterStatus.NINJA_AMBUSH, ret.damage); break; case Page.THREATEN: - monsterStatus.put(MonsterStatus.WATK, Integer.valueOf(ret.x)); - monsterStatus.put(MonsterStatus.WDEF, Integer.valueOf(ret.y)); + monsterStatus.put(MonsterStatus.WATK, ret.x); + monsterStatus.put(MonsterStatus.WDEF, ret.y); break; case DragonKnight.DRAGON_ROAR: ret.hpR = -x / 100.0; - monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.STUN, 1); break; case Crusader.AXE_COMA: case Crusader.SWORD_COMA: @@ -723,7 +723,7 @@ public class MapleStatEffect { case Aran.ROLLING_SPIN: case Evan.FIRE_BREATH: case Evan.BLAZE: - monsterStatus.put(MonsterStatus.STUN, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.STUN, 1); break; case NightLord.TAUNT: case Shadower.TAUNT: @@ -740,65 +740,65 @@ public class MapleStatEffect { case FPArchMage.PARALYZE: case Aran.COMBO_TEMPEST: case Evan.ICE_BREATH: - monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.FREEZE, 1); ret.duration *= 2; // freezing skills are a little strange break; case FPWizard.SLOW: case ILWizard.SLOW: case BlazeWizard.SLOW: - monsterStatus.put(MonsterStatus.SPEED, Integer.valueOf(ret.x)); + monsterStatus.put(MonsterStatus.SPEED, ret.x); break; case FPWizard.POISON_BREATH: case FPMage.ELEMENT_COMPOSITION: - monsterStatus.put(MonsterStatus.POISON, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.POISON, 1); break; case Priest.DOOM: - monsterStatus.put(MonsterStatus.DOOM, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.DOOM, 1); break; case ILMage.SEAL: case FPMage.SEAL: case BlazeWizard.SEAL: - monsterStatus.put(MonsterStatus.SEAL, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.SEAL, 1); break; case Hermit.SHADOW_WEB: // shadow web case NightWalker.SHADOW_WEB: - monsterStatus.put(MonsterStatus.SHADOW_WEB, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.SHADOW_WEB, 1); break; case FPArchMage.FIRE_DEMON: case ILArchMage.ICE_DEMON: - monsterStatus.put(MonsterStatus.POISON, Integer.valueOf(1)); - monsterStatus.put(MonsterStatus.FREEZE, Integer.valueOf(1)); + monsterStatus.put(MonsterStatus.POISON, 1); + monsterStatus.put(MonsterStatus.FREEZE, 1); break; case Evan.PHANTOM_IMPRINT: - monsterStatus.put(MonsterStatus.PHANTOM_IMPRINT, Integer.valueOf(x)); + monsterStatus.put(MonsterStatus.PHANTOM_IMPRINT, x); //ARAN case Aran.COMBO_ABILITY: - statups.add(new Pair<>(MapleBuffStat.ARAN_COMBO, Integer.valueOf(100))); + statups.add(new Pair<>(MapleBuffStat.ARAN_COMBO, 100)); break; case Aran.COMBO_BARRIER: - statups.add(new Pair<>(MapleBuffStat.COMBO_BARRIER, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.COMBO_BARRIER, ret.x)); break; case Aran.COMBO_DRAIN: - statups.add(new Pair<>(MapleBuffStat.COMBO_DRAIN, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.COMBO_DRAIN, ret.x)); break; case Aran.SMART_KNOCKBACK: - statups.add(new Pair<>(MapleBuffStat.SMART_KNOCKBACK, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.SMART_KNOCKBACK, ret.x)); break; case Aran.BODY_PRESSURE: - statups.add(new Pair<>(MapleBuffStat.BODY_PRESSURE, Integer.valueOf(ret.x))); + statups.add(new Pair<>(MapleBuffStat.BODY_PRESSURE, ret.x)); break; case Aran.SNOW_CHARGE: - statups.add(new Pair<>(MapleBuffStat.WK_CHARGE, Integer.valueOf(ret.duration))); + statups.add(new Pair<>(MapleBuffStat.WK_CHARGE, ret.duration)); break; default: break; } } if (ret.isMorph()) { - statups.add(new Pair<>(MapleBuffStat.MORPH, Integer.valueOf(ret.getMorph()))); + statups.add(new Pair<>(MapleBuffStat.MORPH, ret.getMorph())); } if (ret.ghost > 0 && !skill) { - statups.add(new Pair<>(MapleBuffStat.GHOST_MORPH, Integer.valueOf(ret.ghost))); + statups.add(new Pair<>(MapleBuffStat.GHOST_MORPH, ret.ghost)); } ret.monsterStatus = monsterStatus; statups.trimToSize(); @@ -1309,7 +1309,7 @@ public class MapleStatEffect { } else if (isEnrage()) { applyto.handleOrbconsume(); } else if (isMorph()) { - List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.MORPH, Integer.valueOf(getMorph(applyto)))); + List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.MORPH, getMorph(applyto))); mbuff = MaplePacketCreator.giveForeignBuff(applyto.getId(), stat); } else if (isAriantShield()) { List> stat = Collections.singletonList(new Pair<>(MapleBuffStat.AURA, 1)); diff --git a/src/main/java/server/life/MapleLifeFactory.java b/src/main/java/server/life/MapleLifeFactory.java index b185748d2a..25691acbeb 100644 --- a/src/main/java/server/life/MapleLifeFactory.java +++ b/src/main/java/server/life/MapleLifeFactory.java @@ -240,13 +240,13 @@ public class MapleLifeFactory { public static MapleMonster getMonster(int mid) { try { - MapleMonsterStats stats = monsterStats.get(Integer.valueOf(mid)); + MapleMonsterStats stats = monsterStats.get(mid); if (stats == null) { Pair> mobStats = getMonsterStats(mid); stats = mobStats.getLeft(); setMonsterAttackInfo(mid, mobStats.getRight()); - monsterStats.put(Integer.valueOf(mid), stats); + monsterStats.put(mid, stats); } MapleMonster ret = new MapleMonster(mid, stats); return ret; @@ -260,7 +260,7 @@ public class MapleLifeFactory { public static int getMonsterLevel(int mid) { try { - MapleMonsterStats stats = monsterStats.get(Integer.valueOf(mid)); + MapleMonsterStats stats = monsterStats.get(mid); if (stats == null) { MapleData monsterData = data.getData(StringUtil.getLeftPaddedStr(mid + ".img", '0', 11)); if (monsterData == null) { diff --git a/src/main/java/server/life/MapleMonster.java b/src/main/java/server/life/MapleMonster.java index c77e5ffd81..76f9140b07 100644 --- a/src/main/java/server/life/MapleMonster.java +++ b/src/main/java/server/life/MapleMonster.java @@ -1195,7 +1195,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { if (poison) { int poisonLevel = from.getSkillLevel(status.getSkill()); int poisonDamage = Math.min(Short.MAX_VALUE, (int) (getMaxHp() / (70.0 - poisonLevel) + 0.999)); - status.setValue(MonsterStatus.POISON, Integer.valueOf(poisonDamage)); + status.setValue(MonsterStatus.POISON, poisonDamage); animationTime = broadcastStatusEffect(status); overtimeAction = new DamageTask(poisonDamage, from, status, 0); @@ -1221,8 +1221,8 @@ public class MapleMonster extends AbstractLoadedMapleLife { poisonDamage += (Randomizer.nextInt(gap) + minDmg); } poisonDamage = Math.min(Short.MAX_VALUE, poisonDamage); - status.setValue(MonsterStatus.VENOMOUS_WEAPON, Integer.valueOf(poisonDamage)); - status.setValue(MonsterStatus.POISON, Integer.valueOf(poisonDamage)); + status.setValue(MonsterStatus.VENOMOUS_WEAPON, poisonDamage); + status.setValue(MonsterStatus.POISON, poisonDamage); animationTime = broadcastStatusEffect(status); overtimeAction = new DamageTask(poisonDamage, from, status, 0); @@ -1244,7 +1244,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { final byte level = from.getSkillLevel(skill); final int damage = (int) ((from.getStr() + from.getLuk()) * ((3.7 * skill.getEffect(level).getDamage()) / 100)); - status.setValue(MonsterStatus.NINJA_AMBUSH, Integer.valueOf(damage)); + status.setValue(MonsterStatus.NINJA_AMBUSH, damage); animationTime = broadcastStatusEffect(status); overtimeAction = new DamageTask(damage, from, status, 2); diff --git a/src/main/java/server/life/MobSkill.java b/src/main/java/server/life/MobSkill.java index dd584d50fe..95f07656b1 100644 --- a/src/main/java/server/life/MobSkill.java +++ b/src/main/java/server/life/MobSkill.java @@ -123,22 +123,22 @@ public class MobSkill { case 100: case 110: case 150: - stats.put(MonsterStatus.WEAPON_ATTACK_UP, Integer.valueOf(x)); + stats.put(MonsterStatus.WEAPON_ATTACK_UP, x); break; case 101: case 111: case 151: - stats.put(MonsterStatus.MAGIC_ATTACK_UP, Integer.valueOf(x)); + stats.put(MonsterStatus.MAGIC_ATTACK_UP, x); break; case 102: case 112: case 152: - stats.put(MonsterStatus.WEAPON_DEFENSE_UP, Integer.valueOf(x)); + stats.put(MonsterStatus.WEAPON_DEFENSE_UP, x); break; case 103: case 113: case 153: - stats.put(MonsterStatus.MAGIC_DEFENSE_UP, Integer.valueOf(x)); + stats.put(MonsterStatus.MAGIC_DEFENSE_UP, x); break; case 114: if (lt != null && rb != null && skill) { @@ -204,12 +204,12 @@ public class MobSkill { break; case 140: if (makeChanceResult() && !monster.isBuffed(MonsterStatus.MAGIC_IMMUNITY)) { - stats.put(MonsterStatus.WEAPON_IMMUNITY, Integer.valueOf(x)); + stats.put(MonsterStatus.WEAPON_IMMUNITY, x); } break; case 141: if (makeChanceResult() && !monster.isBuffed(MonsterStatus.WEAPON_IMMUNITY)) { - stats.put(MonsterStatus.MAGIC_IMMUNITY, Integer.valueOf(x)); + stats.put(MonsterStatus.MAGIC_IMMUNITY, x); } break; case 143: // Weapon Reflect @@ -230,13 +230,13 @@ public class MobSkill { reflection.add(x); break; case 154: - stats.put(MonsterStatus.ACC, Integer.valueOf(x)); + stats.put(MonsterStatus.ACC, x); break; case 155: - stats.put(MonsterStatus.AVOID, Integer.valueOf(x)); + stats.put(MonsterStatus.AVOID, x); break; case 156: - stats.put(MonsterStatus.SPEED, Integer.valueOf(x)); + stats.put(MonsterStatus.SPEED, x); break; case 200: // summon int skillLimit = this.getLimit(); diff --git a/src/main/java/server/life/MobSkillFactory.java b/src/main/java/server/life/MobSkillFactory.java index 584b73d760..8b9d6091a5 100644 --- a/src/main/java/server/life/MobSkillFactory.java +++ b/src/main/java/server/life/MobSkillFactory.java @@ -21,12 +21,6 @@ along with this program. If not, see . */ package server.life; -import java.awt.Point; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredReadLock; import net.server.audit.locks.MonitoredReentrantReadWriteLock; @@ -38,6 +32,13 @@ import provider.MapleDataProvider; import provider.MapleDataProviderFactory; import provider.MapleDataTool; +import java.awt.*; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * * @author Danny (Leifde) @@ -75,7 +76,7 @@ public class MobSkillFactory { if (skillData.getChildByPath(String.valueOf(i)) == null) { break; } - toSummon.add(Integer.valueOf(MapleDataTool.getInt(skillData.getChildByPath(String.valueOf(i)), 0))); + toSummon.add(MapleDataTool.getInt(skillData.getChildByPath(String.valueOf(i)), 0)); } int effect = MapleDataTool.getInt("summonEffect", skillData, 0); int hp = MapleDataTool.getInt("hp", skillData, 100); diff --git a/src/main/java/server/maps/MapleMap.java b/src/main/java/server/maps/MapleMap.java index e2da406a39..f67378695c 100644 --- a/src/main/java/server/maps/MapleMap.java +++ b/src/main/java/server/maps/MapleMap.java @@ -465,7 +465,7 @@ public class MapleMap { public void removeMapObject(int num) { objectWLock.lock(); try { - this.mapobjects.remove(Integer.valueOf(num)); + this.mapobjects.remove(num); } finally { objectWLock.unlock(); } @@ -611,7 +611,7 @@ public class MapleMap { } distn = Math.sqrt(distn); - return new Pair<>(getRoundedCoordinate(angle), Integer.valueOf((int)distn)); + return new Pair<>(getRoundedCoordinate(angle), (int) distn); } private static void sortDropEntries(List from, List item, List visibleQuest, List otherQuest, MapleCharacter chr) { @@ -1730,7 +1730,7 @@ public class MapleMap { broadcastMessage(MaplePacketCreator.removeNPCController(obj.getObjectId())); broadcastMessage(MaplePacketCreator.removeNPC(obj.getObjectId())); - this.mapobjects.remove(Integer.valueOf(obj.getObjectId())); + this.mapobjects.remove(obj.getObjectId()); } } } finally { @@ -2520,7 +2520,7 @@ public class MapleMap { } objectWLock.lock(); try { - this.mapobjects.put(Integer.valueOf(chr.getObjectId()), chr); + this.mapobjects.put(chr.getObjectId(), chr); } finally { objectWLock.unlock(); } diff --git a/src/main/java/server/maps/MapleReactorFactory.java b/src/main/java/server/maps/MapleReactorFactory.java index 787f32dafe..d5579d3b43 100644 --- a/src/main/java/server/maps/MapleReactorFactory.java +++ b/src/main/java/server/maps/MapleReactorFactory.java @@ -41,14 +41,14 @@ public class MapleReactorFactory { public static final MapleReactorStats getReactorS(int rid) { - MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid)); + MapleReactorStats stats = reactorStats.get(rid); if (stats == null) { int infoId = rid; MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(infoId + ".img", '0', 11)); MapleData link = reactorData.getChildByPath("info/link"); if (link != null) { infoId = MapleDataTool.getIntConvert("info/link", reactorData); - stats = reactorStats.get(Integer.valueOf(infoId)); + stats = reactorStats.get(infoId); } if (stats == null) { stats = new MapleReactorStats(); @@ -83,26 +83,26 @@ public class MapleReactorFactory { stats.addState(i, 999, null, (byte) (foundState ? -1 : (i + 1)), 0, (byte) 0); } } - reactorStats.put(Integer.valueOf(infoId), stats); + reactorStats.put(infoId, stats); if (rid != infoId) { - reactorStats.put(Integer.valueOf(rid), stats); + reactorStats.put(rid, stats); } } else { // stats exist at infoId but not rid; add to map - reactorStats.put(Integer.valueOf(rid), stats); + reactorStats.put(rid, stats); } } return stats; } public static MapleReactorStats getReactor(int rid) { - MapleReactorStats stats = reactorStats.get(Integer.valueOf(rid)); + MapleReactorStats stats = reactorStats.get(rid); if (stats == null) { int infoId = rid; MapleData reactorData = data.getData(StringUtil.getLeftPaddedStr(infoId + ".img", '0', 11)); MapleData link = reactorData.getChildByPath("info/link"); if (link != null) { infoId = MapleDataTool.getIntConvert("info/link", reactorData); - stats = reactorStats.get(Integer.valueOf(infoId)); + stats = reactorStats.get(infoId); } MapleData activateOnTouch = reactorData.getChildByPath("info/activateByTouch"); boolean loadArea = false; @@ -159,13 +159,13 @@ public class MapleReactorFactory { statedatas.add(new StateData(999, null, null, (byte) 0)); stats.addState((byte) 0, statedatas, -1); } - reactorStats.put(Integer.valueOf(infoId), stats); + reactorStats.put(infoId, stats); if (rid != infoId) { - reactorStats.put(Integer.valueOf(rid), stats); + reactorStats.put(rid, stats); } } else // stats exist at infoId but not rid; add to map { - reactorStats.put(Integer.valueOf(rid), stats); + reactorStats.put(rid, stats); } } return stats; diff --git a/src/main/java/tools/MaplePacketCreator.java b/src/main/java/tools/MaplePacketCreator.java index ba2f577b76..29f969fda8 100644 --- a/src/main/java/tools/MaplePacketCreator.java +++ b/src/main/java/tools/MaplePacketCreator.java @@ -3639,7 +3639,7 @@ public class MaplePacketCreator { mplew.writeShort(SendOpcode.KEYMAP.getValue()); mplew.write(0); for (int x = 0; x < 90; x++) { - MapleKeyBinding binding = keybindings.get(Integer.valueOf(x)); + MapleKeyBinding binding = keybindings.get(x); if (binding != null) { mplew.write(binding.getType()); mplew.writeInt(binding.getAction());