cleanup: remove redundant cast

This commit is contained in:
P0nk
2021-04-08 17:39:55 +02:00
parent ebb3aa7ba3
commit 3434c7334b
48 changed files with 243 additions and 359 deletions
@@ -21,10 +21,6 @@ package client;
import config.YamlConfig;
import constants.game.GameConstants;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import net.server.audit.locks.MonitoredLockType;
import net.server.audit.locks.MonitoredReadLock;
import net.server.audit.locks.MonitoredReentrantReadWriteLock;
@@ -35,6 +31,11 @@ import net.server.audit.locks.factory.MonitoredWriteLockFactory;
import server.maps.AbstractAnimatedMapleMapObject;
import server.maps.MapleMap;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.Lock;
/**
*
* @author RonanLana
@@ -315,7 +316,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
short newHp = (short) (hpMpPool >> 48);
short newMp = (short) (hpMpPool >> 32);
short newMaxHp = (short) (hpMpPool >> 16);
short newMaxMp = (short) (hpMpPool.shortValue());
short newMaxMp = hpMpPool.shortValue();
if (newMaxHp != Short.MIN_VALUE) {
if (newMaxHp < 50) {
@@ -354,7 +355,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
short newStr = (short) (strDexIntLuk >> 48);
short newDex = (short) (strDexIntLuk >> 32);
short newInt = (short) (strDexIntLuk >> 16);
short newLuk = (short) (strDexIntLuk.shortValue());
short newLuk = strDexIntLuk.shortValue();
if (newStr >= 4) {
setStr(newStr);
@@ -386,7 +387,7 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple
if (newSp != null) {
short sp = (short) (newSp >> 16);
short skillbook = (short) (newSp.shortValue());
short skillbook = newSp.shortValue();
setRemainingSp(sp, skillbook);
statUpdates.put(MapleStat.AVAILABLESP, remainingSp[skillbook]);
+1 -1
View File
@@ -602,7 +602,7 @@ public class MapleClient {
long ipAddress = 0;
for (int i = 0; i < 4; i++) {
int quad = Integer.parseInt(quads[i]);
ipAddress += (long) (quad % 256) * (long) Math.pow(256, (double) (4 - i));
ipAddress += (long) (quad % 256) * (long) Math.pow(256, 4 - i);
}
return ipAddress;
}
@@ -23,6 +23,7 @@
*/
package client.command;
import client.MapleClient;
import client.command.commands.gm0.*;
import client.command.commands.gm1.*;
import client.command.commands.gm2.*;
@@ -30,18 +31,11 @@ import client.command.commands.gm3.*;
import client.command.commands.gm4.*;
import client.command.commands.gm5.*;
import client.command.commands.gm6.*;
import client.MapleClient;
import tools.FilePrinter;
import tools.Pair;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.*;
public class CommandsExecutor {
@@ -181,7 +175,7 @@ public class CommandsExecutor {
}
private void registerLv0Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand(new String[]{"help", "commands"}, HelpCommand.class);
addCommand("droplimit", DropLimitCommand.class);
@@ -217,7 +211,7 @@ public class CommandsExecutor {
private void registerLv1Commands() {
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("whatdropsfrom", 1, WhatDropsFromCommand.class);
addCommand("whodrops", 1, WhoDropsCommand.class);
@@ -229,7 +223,7 @@ public class CommandsExecutor {
private void registerLv2Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("recharge", 2, RechargeCommand.class);
addCommand("whereami", 2, WhereaMiCommand.class);
@@ -272,7 +266,7 @@ public class CommandsExecutor {
}
private void registerLv3Commands() {
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("debuff", 3, DebuffCommand.class);
addCommand("fly", 3, FlyCommand.class);
@@ -338,7 +332,7 @@ public class CommandsExecutor {
}
private void registerLv4Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("servermessage", 4, ServerMessageCommand.class);
addCommand("proitem", 4, ProItemCommand.class);
@@ -369,7 +363,7 @@ public class CommandsExecutor {
}
private void registerLv5Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("debug", 5, DebugCommand.class);
addCommand("set", 5, SetCommand.class);
@@ -382,7 +376,7 @@ public class CommandsExecutor {
}
private void registerLv6Commands(){
levelCommandsCursor = new Pair<>((List<String>) new ArrayList<String>(), (List<String>) new ArrayList<String>());
levelCommandsCursor = new Pair<>(new ArrayList<String>(), new ArrayList<String>());
addCommand("setgmlevel", 6, SetGmLevelCommand.class);
addCommand("warpworld", 6, WarpWorldCommand.class);
@@ -51,10 +51,10 @@ public class ShutdownCommand extends Command {
}
if (time > 1) {
int seconds = (int) (time / 1000) % 60;
int minutes = (int) ((time / (1000 * 60)) % 60);
int hours = (int) ((time / (1000 * 60 * 60)) % 24);
int days = (int) ((time / (1000 * 60 * 60 * 24)));
int seconds = (time / 1000) % 60;
int minutes = (time / (1000 * 60)) % 60;
int hours = (time / (1000 * 60 * 60)) % 24;
int days = (time / (1000 * 60 * 60 * 24));
String strTime = "";
if (days > 0) strTime += days + " days, ";
@@ -104,7 +104,7 @@ public enum ItemFactory {
equip.setWatk((short) rs.getInt("watk"));
equip.setWdef((short) rs.getInt("wdef"));
equip.setUpgradeSlots((byte) rs.getInt("upgradeslots"));
equip.setLevel((byte) rs.getByte("level"));
equip.setLevel(rs.getByte("level"));
equip.setItemExp(rs.getInt("itemexp"));
equip.setItemLevel(rs.getByte("itemlevel"));
equip.setExpiration(rs.getLong("expiration"));
@@ -232,8 +232,8 @@ public class MapleInventory implements Iterable<Item> {
public void move(short sSlot, short dSlot, short slotMax) {
lock.lock();
try {
Item source = (Item) inventory.get(sSlot);
Item target = (Item) inventory.get(dSlot);
Item source = inventory.get(sSlot);
Item target = inventory.get(dSlot);
if (source == null) {
return;
}
+1 -1
View File
@@ -306,7 +306,7 @@ public class MaplePet extends Item {
for (LifeMovementFragment move : movement) {
if (move instanceof LifeMovement) {
if (move instanceof AbsoluteLifeMovement) {
this.setPos(((LifeMovement) move).getPosition());
this.setPos(move.getPosition());
}
this.setStance(((LifeMovement) move).getNewstate());
}
@@ -24,26 +24,20 @@ package client.inventory.manipulator;
import client.MapleBuffStat;
import client.MapleCharacter;
import client.MapleClient;
import client.inventory.Equip;
import client.inventory.Item;
import client.inventory.MapleInventory;
import client.inventory.MapleInventoryType;
import client.inventory.MaplePet;
import client.inventory.ModifyInventory;
import client.inventory.*;
import client.newyear.NewYearCardRecord;
import config.YamlConfig;
import constants.inventory.ItemConstants;
import server.MapleItemInformationProvider;
import server.maps.MapleMap;
import tools.FilePrinter;
import tools.MaplePacketCreator;
import java.awt.Point;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import server.MapleItemInformationProvider;
import server.maps.MapleMap;
import tools.FilePrinter;
import tools.MaplePacketCreator;
/**
*
@@ -91,7 +85,7 @@ public class MapleInventoryManipulator {
Iterator<Item> i = existing.iterator();
while (quantity > 0) {
if (i.hasNext()) {
Item eItem = (Item) i.next();
Item eItem = i.next();
short oldQ = eItem.getQuantity();
if (oldQ < slotMax && ((eItem.getOwner().equals(owner) || owner == null) && eItem.getFlag() == flag)) {
short newQ = (short) Math.min(oldQ + quantity, slotMax);
@@ -202,7 +196,7 @@ public class MapleInventoryManipulator {
Iterator<Item> i = existing.iterator();
while (quantity > 0) {
if (i.hasNext()) {
Item eItem = (Item) i.next();
Item eItem = i.next();
short oldQ = eItem.getQuantity();
if (oldQ < slotMax && item.getFlag() == eItem.getFlag() && item.getOwner().equals(eItem.getOwner())) {
short newQ = (short) Math.min(oldQ + quantity, slotMax);
@@ -30,7 +30,6 @@ import client.SkillFactory;
import client.autoban.AutobanFactory;
import constants.game.GameConstants;
import constants.skills.Aran;
import server.ThreadManager;
import tools.FilePrinter;
import tools.MaplePacketCreator;
@@ -87,12 +86,12 @@ public class AssignSPProcessor {
}
if (skill.getId() == Aran.FULL_SWING) {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_DOUBLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_TRIPLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_DOUBLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_FULL_TRIPLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
} else if (skill.getId() == Aran.OVER_SWING) {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_DOUBLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_TRIPLE), (byte) player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_DOUBLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
player.changeSkillLevel(SkillFactory.getSkill(Aran.HIDDEN_OVER_TRIPLE), player.getSkillLevel(skill), player.getMasterLevel(skill), player.getSkillExpiration(skill));
} else {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));
}