cleanup: remove unnecessary unboxing

This commit is contained in:
P0nk
2021-04-07 23:52:58 +02:00
parent 6253169e35
commit ed5a444753
12 changed files with 62 additions and 164 deletions

View File

@@ -403,7 +403,7 @@ public final class Channel {
int[] retArr = new int[ret.size()];
int pos = 0;
for (Integer i : ret) {
retArr[pos++] = i.intValue();
retArr[pos++] = i;
}
return retArr;
}

View File

@@ -150,7 +150,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
if (attack.skill == ChiefBandit.MESO_EXPLOSION) {
int delay = 0;
for (Integer oned : attack.allDamage.keySet()) {
MapleMapObject mapobject = map.getMapObject(oned.intValue());
MapleMapObject mapobject = map.getMapObject(oned);
if (mapobject != null && mapobject.getType() == MapleMapObjectType.ITEM) {
final MapleMapItem mapitem = (MapleMapItem) mapobject;
if (mapitem.getMeso() == 0) { //Maybe it is possible some how?
@@ -183,7 +183,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
}
}
for (Integer oned : attack.allDamage.keySet()) {
final MapleMonster monster = map.getMonsterByOid(oned.intValue());
final MapleMonster monster = map.getMonsterByOid(oned);
if (monster != null) {
double distance = player.getPosition().distanceSq(monster.getPosition());
double distanceToDetect = 200000.0;
@@ -253,7 +253,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
int picklv = (player.isGM()) ? pickpocket.getMaxLevel() : player.getSkillLevel(pickpocket);
if(picklv > 0) {
int delay = 0;
final int maxmeso = player.getBuffedValue(MapleBuffStat.PICKPOCKET).intValue();
final int maxmeso = player.getBuffedValue(MapleBuffStat.PICKPOCKET);
for (Integer eachd : onedList) {
eachd += Integer.MAX_VALUE;

View File

@@ -21,30 +21,19 @@
*/
package net.server.channel.handlers;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import client.*;
import config.YamlConfig;
import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleClient;
import client.MapleJob;
import client.Skill;
import client.SkillFactory;
import constants.game.GameConstants;
import constants.skills.Crusader;
import constants.skills.DawnWarrior;
import constants.skills.DragonKnight;
import constants.skills.Hero;
import constants.skills.NightWalker;
import constants.skills.Rogue;
import constants.skills.WindArcher;
import constants.skills.*;
import server.MapleStatEffect;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.data.input.SeekableLittleEndianAccessor;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
@Override
@@ -78,7 +67,7 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
Integer comboBuff = chr.getBuffedValue(MapleBuffStat.COMBO);
if (GameConstants.isFinisherSkill(attack.skill)) {
if (comboBuff != null) {
numFinisherOrbs = comboBuff.intValue() - 1;
numFinisherOrbs = comboBuff - 1;
}
chr.handleOrbconsume();
} else if (attack.numAttacked > 0) {
@@ -129,7 +118,7 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler {
int totDamageToOneMonster = 0; // sacrifice attacks only 1 mob with 1 attack
final Iterator<List<Integer>> dmgIt = attack.allDamage.values().iterator();
if (dmgIt.hasNext()) {
totDamageToOneMonster = dmgIt.next().get(0).intValue();
totDamageToOneMonster = dmgIt.next().get(0);
}
chr.safeAddHP(-1 * totDamageToOneMonster * attack.getAttackEffect(chr, null).getX() / 100);

View File

@@ -21,10 +21,11 @@
*/
package provider;
import java.awt.Point;
import java.awt.image.BufferedImage;
import provider.wz.MapleDataType;
import java.awt.*;
import java.awt.image.BufferedImage;
public class MapleDataTool {
public static String getString(MapleData data) {
return ((String) data.getData());
@@ -47,18 +48,18 @@ public class MapleDataTool {
}
public static double getDouble(MapleData data) {
return ((Double) data.getData()).doubleValue();
return (Double) data.getData();
}
public static float getFloat(MapleData data) {
return ((Float) data.getData()).floatValue();
return (Float) data.getData();
}
public static int getInt(MapleData data) {
if (data == null || data.getData() == null) {
return 0;// DEF?
}
return ((Integer) data.getData()).intValue();
return (Integer) data.getData();
}
public static int getInt(String path, MapleData data) {

View File

@@ -21,18 +21,15 @@
*/
package scripting;
import java.awt.Point;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import client.Skill;
import client.*;
import client.MapleCharacter.DelayedQuestUpdate;
import client.inventory.*;
import client.inventory.manipulator.MapleInventoryManipulator;
import config.YamlConfig;
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
import constants.net.ServerConstants;
import net.server.Server;
import net.server.channel.Channel;
import net.server.guild.MapleGuild;
import net.server.world.MapleParty;
import net.server.world.MaplePartyCharacter;
@@ -40,12 +37,11 @@ import scripting.event.EventInstanceManager;
import scripting.event.EventManager;
import scripting.npc.NPCScriptManager;
import server.MapleItemInformationProvider;
import server.MapleMarriage;
import server.expeditions.MapleExpedition;
import server.expeditions.MapleExpeditionBossLog;
import server.expeditions.MapleExpeditionType;
import server.life.MapleLifeFactory;
import server.life.MapleMonster;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import server.life.*;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
@@ -53,28 +49,12 @@ import server.partyquest.PartyQuest;
import server.partyquest.Pyramid;
import server.quest.MapleQuest;
import tools.MaplePacketCreator;
import client.MapleCharacter;
import client.MapleCharacter.DelayedQuestUpdate;
import client.MapleClient;
import client.MapleJob;
import client.MapleQuestStatus;
import client.SkillFactory;
import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryProof;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import client.inventory.ModifyInventory;
import client.inventory.manipulator.MapleInventoryManipulator;
import constants.game.GameConstants;
import constants.inventory.ItemConstants;
import constants.net.ServerConstants;
import server.MapleMarriage;
import server.expeditions.MapleExpeditionBossLog;
import server.life.MapleNPC;
import tools.Pair;
import java.awt.*;
import java.util.List;
import java.util.*;
public class AbstractPlayerInteraction {
public MapleClient c;
@@ -243,7 +223,7 @@ public class AbstractPlayerInteraction {
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
intList.add((Integer) d);
}
} else {
for (Object d: list) {

View File

@@ -892,7 +892,7 @@ public class EventInstanceManager {
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
intList.add((Integer) d);
}
} else {
for (Object d: list) {

View File

@@ -157,7 +157,7 @@ public class EventManager {
if (ServerConstants.JAVA_8) {
for (Object d: list) {
intList.add(((Integer) d).intValue());
intList.add((Integer) d);
}
} else {
for (Object d: list) {

View File

@@ -277,7 +277,7 @@ public class MapleShop {
}
}
for (Integer recharge : recharges) {
ret.addItem(new MapleShopItem((short) 1000, recharge.intValue(), 0, 0));
ret.addItem(new MapleShopItem((short) 1000, recharge, 0, 0));
}
}
}

View File

@@ -21,102 +21,34 @@
*/
package server;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import config.YamlConfig;
import net.server.Server;
import provider.MapleData;
import provider.MapleDataTool;
import server.life.MapleMonster;
import server.maps.FieldLimit;
import server.maps.MapleDoor;
import server.maps.MapleMap;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import server.maps.MapleMist;
import server.maps.MaplePortal;
import server.maps.MapleSummon;
import server.maps.SummonMovementType;
import tools.ArrayMap;
import tools.MaplePacketCreator;
import tools.Pair;
import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleDisease;
import client.MapleJob;
import client.MapleMount;
import client.Skill;
import client.SkillFactory;
import client.*;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.manipulator.MapleInventoryManipulator;
import client.status.MonsterStatus;
import client.status.MonsterStatusEffect;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import constants.skills.Aran;
import constants.skills.Assassin;
import constants.skills.Bandit;
import constants.skills.Beginner;
import constants.skills.Bishop;
import constants.skills.BlazeWizard;
import constants.skills.Bowmaster;
import constants.skills.Brawler;
import constants.skills.Buccaneer;
import constants.skills.ChiefBandit;
import constants.skills.Cleric;
import constants.skills.Corsair;
import constants.skills.Crossbowman;
import constants.skills.Crusader;
import constants.skills.DarkKnight;
import constants.skills.DawnWarrior;
import constants.skills.DragonKnight;
import constants.skills.Evan;
import constants.skills.FPArchMage;
import constants.skills.FPMage;
import constants.skills.FPWizard;
import constants.skills.Fighter;
import constants.skills.GM;
import constants.skills.Gunslinger;
import constants.skills.Hermit;
import constants.skills.Hero;
import constants.skills.Hunter;
import constants.skills.ILArchMage;
import constants.skills.ILMage;
import constants.skills.ILWizard;
import constants.skills.Legend;
import constants.skills.Magician;
import constants.skills.Marauder;
import constants.skills.Marksman;
import constants.skills.NightLord;
import constants.skills.NightWalker;
import constants.skills.Noblesse;
import constants.skills.Outlaw;
import constants.skills.Page;
import constants.skills.Paladin;
import constants.skills.Pirate;
import constants.skills.Priest;
import constants.skills.Ranger;
import constants.skills.Rogue;
import constants.skills.Shadower;
import constants.skills.Sniper;
import constants.skills.Spearman;
import constants.skills.SuperGM;
import constants.skills.ThunderBreaker;
import constants.skills.WhiteKnight;
import constants.skills.WindArcher;
import constants.skills.*;
import net.server.Server;
import net.server.world.MapleParty;
import net.server.world.MaplePartyCharacter;
import provider.MapleData;
import provider.MapleDataTool;
import server.life.MapleMonster;
import server.life.MobSkill;
import server.life.MobSkillFactory;
import server.maps.*;
import server.partyquest.MapleCarnivalFactory;
import server.partyquest.MapleCarnivalFactory.MCSkill;
import tools.ArrayMap;
import tools.MaplePacketCreator;
import tools.Pair;
import java.awt.*;
import java.util.List;
import java.util.*;
/**
* @author Matze
@@ -221,7 +153,7 @@ public class MapleStatEffect {
}
private static void addBuffStatPairToListIfNotZero(List<Pair<MapleBuffStat, Integer>> list, MapleBuffStat buffstat, Integer val) {
if (val.intValue() != 0) {
if (val != 0) {
list.add(new Pair<>(buffstat, val));
}
}

View File

@@ -21,18 +21,14 @@
*/
package server.life;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import server.life.MapleLifeFactory.BanishInfo;
import server.life.MapleLifeFactory.loseItem;
import server.life.MapleLifeFactory.selfDestruction;
import tools.Pair;
import java.lang.reflect.Field;
import java.util.*;
/**
* @author Frz
*/
@@ -134,7 +130,7 @@ public class MapleMonsterStats {
if (ret == null) {
return 500;
}
return ret.intValue();
return ret;
}
public boolean isMobile() {

View File

@@ -141,7 +141,7 @@ public class MapleMapFactory {
float monsterRate = 0;
MapleData mobRate = infoData.getChildByPath("mobRate");
if (mobRate != null) {
monsterRate = ((Float) mobRate.getData()).floatValue();
monsterRate = (Float) mobRate.getData();
}
map = new MapleMap(mapid, world, channel, MapleDataTool.getInt("returnMap", infoData), monsterRate);
map.setEventInstance(event);

View File

@@ -1014,7 +1014,7 @@ public class MaplePacketCreator {
} else if (statupdate.getLeft().getValue() == 0x20000) {
mplew.writeShort(statupdate.getRight().shortValue());
} else {
mplew.writeInt(statupdate.getRight().intValue());
mplew.writeInt(statupdate.getRight());
}
}
}
@@ -1885,7 +1885,7 @@ public class MaplePacketCreator {
}
if (chr.getBuffedValue(MapleBuffStat.COMBO) != null) {
buffmask |= MapleBuffStat.COMBO.getValue();
buffvalue = Integer.valueOf(chr.getBuffedValue(MapleBuffStat.COMBO).intValue());
buffvalue = Integer.valueOf(chr.getBuffedValue(MapleBuffStat.COMBO));
}
if (chr.getBuffedValue(MapleBuffStat.SHADOWPARTNER) != null) {
buffmask |= MapleBuffStat.SHADOWPARTNER.getValue();
@@ -1894,7 +1894,7 @@ public class MaplePacketCreator {
buffmask |= MapleBuffStat.SOULARROW.getValue();
}
if (chr.getBuffedValue(MapleBuffStat.MORPH) != null) {
buffvalue = Integer.valueOf(chr.getBuffedValue(MapleBuffStat.MORPH).intValue());
buffvalue = Integer.valueOf(chr.getBuffedValue(MapleBuffStat.MORPH));
}
mplew.writeInt((int) ((buffmask >> 32) & 0xffffffffL));
if (buffvalue != null) {
@@ -2418,13 +2418,13 @@ public class MaplePacketCreator {
for (Integer oned : damage.keySet()) {
List<Integer> onedList = damage.get(oned);
if (onedList != null) {
lew.writeInt(oned.intValue());
lew.writeInt(oned);
lew.write(0x0);
if (skill == 4211006) {
lew.write(onedList.size());
}
for (Integer eachd : onedList) {
lew.writeInt(eachd.intValue());
lew.writeInt(eachd);
}
}
}