cleanup: use primitive type instead of wrapper type

This commit is contained in:
P0nk
2021-04-08 17:45:50 +02:00
parent 202f2d8bc5
commit a5b42b8a43
10 changed files with 20 additions and 23 deletions

View File

@@ -41,7 +41,7 @@ public class CheckDmgCommand extends Command {
int maxBase = victim.calculateMaxBaseDamage(victim.getTotalWatk());
Integer watkBuff = victim.getBuffedValue(MapleBuffStat.WATK);
Integer matkBuff = victim.getBuffedValue(MapleBuffStat.MATK);
Integer blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12);
int blessing = victim.getSkillLevel(10000000 * player.getJobType() + 12);
if (watkBuff == null) watkBuff = 0;
if (matkBuff == null) matkBuff = 0;

View File

@@ -25,15 +25,16 @@ import client.MapleClient;
import config.YamlConfig;
import constants.game.ExpTable;
import constants.inventory.ItemConstants;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import server.MapleItemInformationProvider;
import tools.MaplePacketCreator;
import tools.Pair;
import tools.Randomizer;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class Equip extends Item {
public static enum ScrollResult {
@@ -383,7 +384,7 @@ public class Equip extends Item {
public Pair<String, Pair<Boolean, Boolean>> gainStats(List<Pair<StatUpgrade, Integer>> stats) {
boolean gotSlot = false, gotVicious = false;
String lvupStr = "";
Integer statUp, maxStat = YamlConfig.config.server.MAX_EQUIPMNT_STAT;
int statUp, maxStat = YamlConfig.config.server.MAX_EQUIPMNT_STAT;
for (Pair<StatUpgrade, Integer> stat : stats) {
switch (stat.getLeft()) {
case incDEX:

View File

@@ -873,7 +873,7 @@ public class Server {
}
try {
Integer worldCount = Math.min(GameConstants.WORLD_NAMES.length, YamlConfig.config.server.WORLDS);
int worldCount = Math.min(GameConstants.WORLD_NAMES.length, YamlConfig.config.server.WORLDS);
for (int i = 0; i < worldCount; i++) {
initWorld();

View File

@@ -258,7 +258,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
eachd += Integer.MAX_VALUE;
if (pickpocket.getEffect(picklv).makeChanceResult()) {
final Integer eachdf;
final int eachdf;
if(eachd < 0)
eachdf = eachd + Integer.MAX_VALUE;
else
@@ -280,7 +280,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl
MapleMonsterInformationProvider mi = MapleMonsterInformationProvider.getInstance();
List<Integer> dropPool = mi.retrieveDropPool(monster.getId());
if(!dropPool.isEmpty()) {
Integer rndPool = (int) Math.floor(Math.random() * dropPool.get(dropPool.size() - 1));
int rndPool = (int) Math.floor(Math.random() * dropPool.get(dropPool.size() - 1));
int i = 0;
while(rndPool >= dropPool.get(i)) i++;

View File

@@ -1445,7 +1445,7 @@ public class World {
MapleCharacter chr = this.getPlayerStorage().getCharacterById(dp.getKey() / 4);
if(chr == null || !chr.isLoggedinWorld()) continue;
Integer dpVal = dp.getValue() + 1;
int dpVal = dp.getValue() + 1;
if(dpVal == YamlConfig.config.server.PET_EXHAUST_COUNT) {
chr.runFullnessSchedule(dp.getKey() % 4);
dpVal = 0;

View File

@@ -447,7 +447,7 @@ public class MapleMap {
private int getUsableOID() {
objectRLock.lock();
try {
Integer curOid;
int curOid;
// clashes with playernpc on curOid >= 2147000000, developernpc uses >= 2147483000
do {

View File

@@ -220,7 +220,7 @@ public class AriantColiseum {
}
public void distributeAriantPoints() {
Integer firstTop = -1, secondTop = -1;
int firstTop = -1, secondTop = -1;
MapleCharacter winner = null;
List<Integer> runnerups = new ArrayList<>();

View File

@@ -221,8 +221,8 @@ public class MapleCouponInstaller {
if(d.contains("rate")) {
String r = getNodeValue(token);
Double db = Double.parseDouble(r);
itemMultiplier = db.intValue();
double db = Double.parseDouble(r);
itemMultiplier = (int) db;
}
}
}

View File

@@ -238,9 +238,9 @@ public class MapleGachaponItemidRetriever {
ResultSet rs = ps.executeQuery();
while(rs.next()) {
Integer id = rs.getInt("id");
int id = rs.getInt("id");
str += id.toString();
str += Integer.toString(id);
str += " ";
}

View File

@@ -20,11 +20,7 @@
package mapleidretriever;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
import java.util.ArrayList;
/**
@@ -175,9 +171,9 @@ public class MapleIdRetriever {
String str = "";
while(rs.next()) {
Integer id = rs.getInt("id");
int id = rs.getInt("id");
str += id.toString();
str += Integer.toString(id);
str += " ";
}