Added missing final modifiers.

This commit is contained in:
MobiusDev
2015-12-26 12:03:36 +00:00
parent cc92e5d062
commit e0d681a17e
974 changed files with 5919 additions and 5917 deletions

View File

@@ -52,7 +52,7 @@ public final class Broadcast
*/
public static void toPlayersTargettingMyself(L2Character character, L2GameServerPacket mov)
{
Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
final Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
for (L2PcInstance player : plrs)
{
if (player.getTarget() != character)
@@ -88,8 +88,8 @@ public final class Broadcast
player.sendPacket(mov);
if ((mov instanceof CharInfo) && (character.isPlayer()))
{
int relation = ((L2PcInstance) character).getRelation(player);
Integer oldrelation = character.getKnownList().getKnownRelations().get(player.getObjectId());
final int relation = ((L2PcInstance) character).getRelation(player);
final Integer oldrelation = character.getKnownList().getKnownRelations().get(player.getObjectId());
if ((oldrelation != null) && (oldrelation != relation))
{
final RelationChanged rc = new RelationChanged();
@@ -136,7 +136,7 @@ public final class Broadcast
radius = 1500;
}
Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
final Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
for (L2PcInstance player : plrs)
{
if (character.isInsideRadius(player, radius, false, false))
@@ -177,7 +177,7 @@ public final class Broadcast
character.sendPacket(mov);
}
Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
final Collection<L2PcInstance> plrs = character.getKnownList().getKnownPlayers().values();
for (L2PcInstance player : plrs)
{
if ((player != null) && Util.checkIfInRange(radius, character, player, false))

View File

@@ -73,40 +73,40 @@ public final class Evolve
L2ItemInstance item = null;
long petexp = currentPet.getStat().getExp();
String oldname = currentPet.getName();
int oldX = currentPet.getX();
int oldY = currentPet.getY();
int oldZ = currentPet.getZ();
final String oldname = currentPet.getName();
final int oldX = currentPet.getX();
final int oldY = currentPet.getY();
final int oldZ = currentPet.getZ();
L2PetData oldData = PetDataTable.getInstance().getPetDataByItemId(itemIdtake);
final L2PetData oldData = PetDataTable.getInstance().getPetDataByItemId(itemIdtake);
if (oldData == null)
{
return false;
}
int oldnpcID = oldData.getNpcId();
final int oldnpcID = oldData.getNpcId();
if ((currentPet.getStat().getLevel() < petminlvl) || (currentPet.getId() != oldnpcID))
{
return false;
}
L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(itemIdgive);
final L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(itemIdgive);
if (petData == null)
{
return false;
}
int npcID = petData.getNpcId();
final int npcID = petData.getNpcId();
if (npcID == 0)
{
return false;
}
L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcID);
final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcID);
currentPet.unSummon(player);
@@ -116,7 +116,7 @@ public final class Evolve
item = player.getInventory().addItem("Evolve", itemIdgive, 1, player, npc);
// Summoning new pet
L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, player, item);
final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, player, item);
if (petSummon == null)
{
@@ -124,7 +124,7 @@ public final class Evolve
}
// Fix for non-linear baby pet exp
long _minimumexp = petSummon.getStat().getExpForLevel(petminlvl);
final long _minimumexp = petSummon.getStat().getExpForLevel(petminlvl);
if (petexp < _minimumexp)
{
petexp = _minimumexp;
@@ -169,7 +169,7 @@ public final class Evolve
return false;
}
L2ItemInstance item = player.getInventory().getItemByItemId(itemIdtake);
final L2ItemInstance item = player.getInventory().getItemByItemId(itemIdtake);
if (item == null)
{
return false;
@@ -181,43 +181,43 @@ public final class Evolve
oldpetlvl = petminlvl;
}
L2PetData oldData = PetDataTable.getInstance().getPetDataByItemId(itemIdtake);
final L2PetData oldData = PetDataTable.getInstance().getPetDataByItemId(itemIdtake);
if (oldData == null)
{
return false;
}
L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(itemIdgive);
final L2PetData petData = PetDataTable.getInstance().getPetDataByItemId(itemIdgive);
if (petData == null)
{
return false;
}
int npcId = petData.getNpcId();
final int npcId = petData.getNpcId();
if (npcId == 0)
{
return false;
}
L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcId);
final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcId);
// deleting old pet item
L2ItemInstance removedItem = player.getInventory().destroyItem("PetRestore", item, player, npc);
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
final L2ItemInstance removedItem = player.getInventory().destroyItem("PetRestore", item, player, npc);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(removedItem);
player.sendPacket(sm);
// Give new pet item
L2ItemInstance addedItem = player.getInventory().addItem("PetRestore", itemIdgive, 1, player, npc);
final L2ItemInstance addedItem = player.getInventory().addItem("PetRestore", itemIdgive, 1, player, npc);
// Summoning new pet
L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, player, addedItem);
final L2PetInstance petSummon = L2PetInstance.spawnPet(npcTemplate, player, addedItem);
if (petSummon == null)
{
return false;
}
long _maxexp = petSummon.getStat().getExpForLevel(oldpetlvl);
final long _maxexp = petSummon.getStat().getExpForLevel(oldpetlvl);
petSummon.getStat().addExp(_maxexp);
petSummon.setCurrentHp(petSummon.getMaxHp());
@@ -237,7 +237,7 @@ public final class Evolve
addedItem.setEnchantLevel(petSummon.getLevel());
// Inventory update
InventoryUpdate iu = new InventoryUpdate();
final InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(removedItem);
player.sendPacket(iu);
@@ -246,7 +246,7 @@ public final class Evolve
player.broadcastUserInfo();
L2World world = L2World.getInstance();
final L2World world = L2World.getInstance();
world.removeObject(removedItem);
ThreadPoolManager.getInstance().scheduleGeneral(new EvolveFinalizer(player, petSummon), 900);

View File

@@ -177,7 +177,7 @@ public final class FloodProtectorAction
{
if (_client.getActiveChar() != null)
{
int charId = _client.getActiveChar().getObjectId();
final int charId = _client.getActiveChar().getObjectId();
if (charId > 0)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));

View File

@@ -32,21 +32,21 @@ public final class GeoUtils
{
public static void debug2DLine(L2PcInstance player, int x, int y, int tx, int ty, int z)
{
int gx = GeoData.getInstance().getGeoX(x);
int gy = GeoData.getInstance().getGeoY(y);
final int gx = GeoData.getInstance().getGeoX(x);
final int gy = GeoData.getInstance().getGeoY(y);
int tgx = GeoData.getInstance().getGeoX(tx);
int tgy = GeoData.getInstance().getGeoY(ty);
final int tgx = GeoData.getInstance().getGeoX(tx);
final int tgy = GeoData.getInstance().getGeoY(ty);
ExServerPrimitive prim = new ExServerPrimitive("Debug2DLine", x, y, z);
final ExServerPrimitive prim = new ExServerPrimitive("Debug2DLine", x, y, z);
prim.addLine(Color.BLUE, GeoData.getInstance().getWorldX(gx), GeoData.getInstance().getWorldY(gy), z, GeoData.getInstance().getWorldX(tgx), GeoData.getInstance().getWorldY(tgy), z);
LinePointIterator iter = new LinePointIterator(gx, gy, tgx, tgy);
final LinePointIterator iter = new LinePointIterator(gx, gy, tgx, tgy);
while (iter.next())
{
int wx = GeoData.getInstance().getWorldX(iter.x());
int wy = GeoData.getInstance().getWorldY(iter.y());
final int wx = GeoData.getInstance().getWorldX(iter.x());
final int wy = GeoData.getInstance().getWorldY(iter.y());
prim.addPoint(Color.RED, wx, wy, z);
}
@@ -55,16 +55,16 @@ public final class GeoUtils
public static void debug3DLine(L2PcInstance player, int x, int y, int z, int tx, int ty, int tz)
{
int gx = GeoData.getInstance().getGeoX(x);
int gy = GeoData.getInstance().getGeoY(y);
final int gx = GeoData.getInstance().getGeoX(x);
final int gy = GeoData.getInstance().getGeoY(y);
int tgx = GeoData.getInstance().getGeoX(tx);
int tgy = GeoData.getInstance().getGeoY(ty);
final int tgx = GeoData.getInstance().getGeoX(tx);
final int tgy = GeoData.getInstance().getGeoY(ty);
ExServerPrimitive prim = new ExServerPrimitive("Debug3DLine", x, y, z);
final ExServerPrimitive prim = new ExServerPrimitive("Debug3DLine", x, y, z);
prim.addLine(Color.BLUE, GeoData.getInstance().getWorldX(gx), GeoData.getInstance().getWorldY(gy), z, GeoData.getInstance().getWorldX(tgx), GeoData.getInstance().getWorldY(tgy), tz);
LinePointIterator3D iter = new LinePointIterator3D(gx, gy, z, tgx, tgy, tz);
final LinePointIterator3D iter = new LinePointIterator3D(gx, gy, z, tgx, tgy, tz);
iter.next();
int prevX = iter.x();
int prevY = iter.y();
@@ -75,8 +75,8 @@ public final class GeoUtils
while (iter.next())
{
int curX = iter.x();
int curY = iter.y();
final int curX = iter.x();
final int curY = iter.y();
if ((curX != prevX) || (curY != prevY))
{
@@ -104,20 +104,15 @@ public final class GeoUtils
public static void debugGrid(L2PcInstance player)
{
int geoRadius = 10;
int blocksPerPacket = 49;
if (geoRadius < 0)
{
throw new IllegalArgumentException("geoRadius < 0");
}
final int geoRadius = 10;
final int blocksPerPacket = 49;
int iBlock = blocksPerPacket;
int iPacket = 0;
ExServerPrimitive exsp = null;
GeoData gd = GeoData.getInstance();
int playerGx = gd.getGeoX(player.getX());
int playerGy = gd.getGeoY(player.getY());
final GeoData gd = GeoData.getInstance();
final int playerGx = gd.getGeoX(player.getX());
final int playerGy = gd.getGeoY(player.getY());
for (int dx = -geoRadius; dx <= geoRadius; ++dx)
{
for (int dy = -geoRadius; dy <= geoRadius; ++dy)
@@ -138,12 +133,12 @@ public final class GeoUtils
throw new IllegalStateException();
}
int gx = playerGx + dx;
int gy = playerGy + dy;
final int gx = playerGx + dx;
final int gy = playerGy + dy;
int x = gd.getWorldX(gx);
int y = gd.getWorldY(gy);
int z = gd.getNearestZ(gx, gy, player.getZ());
final int x = gd.getWorldX(gx);
final int y = gd.getWorldY(gy);
final int z = gd.getNearestZ(gx, gy, player.getZ());
// north arrow
Color col = getDirectionColor(gx, gy, z, Cell.NSWE_NORTH);

View File

@@ -334,7 +334,7 @@ public class MinionList
public static final L2MonsterInstance spawnMinion(L2MonsterInstance master, int minionId)
{
// Get the template of the Minion to spawn
L2NpcTemplate minionTemplate = NpcData.getInstance().getTemplate(minionId);
final L2NpcTemplate minionTemplate = NpcData.getInstance().getTemplate(minionId);
if (minionTemplate == null)
{
return null;

View File

@@ -94,7 +94,7 @@ public final class Util
public static final double convertHeadingToDegree(int clientHeading)
{
double degree = clientHeading / 182.044444444;
final double degree = clientHeading / 182.044444444;
return degree;
}
@@ -197,8 +197,8 @@ public final class Util
return str;
}
char[] charArray = str.toCharArray();
StringBuilder result = new StringBuilder();
final char[] charArray = str.toCharArray();
final StringBuilder result = new StringBuilder();
// Capitalize the first letter in the given string!
charArray[0] = Character.toUpperCase(charArray[0]);
@@ -248,13 +248,13 @@ public final class Util
rad += ((L2Character) obj2).getTemplate().getCollisionRadius();
}
double dx = obj1.getX() - obj2.getX();
double dy = obj1.getY() - obj2.getY();
final double dx = obj1.getX() - obj2.getX();
final double dy = obj1.getY() - obj2.getY();
double d = (dx * dx) + (dy * dy);
if (includeZAxis)
{
double dz = obj1.getZ() - obj2.getZ();
final double dz = obj1.getZ() - obj2.getZ();
d += (dz * dz);
}
return d <= ((range * range) + (2 * range * rad) + (rad * rad));
@@ -279,12 +279,12 @@ public final class Util
return true; // not limited
}
int dx = obj1.getX() - obj2.getX();
int dy = obj1.getY() - obj2.getY();
final int dx = obj1.getX() - obj2.getX();
final int dy = obj1.getY() - obj2.getY();
if (includeZAxis)
{
int dz = obj1.getZ() - obj2.getZ();
final int dz = obj1.getZ() - obj2.getZ();
return ((dx * dx) + (dy * dy) + (dz * dz)) <= (radius * radius);
}
return ((dx * dx) + (dy * dy)) <= (radius * radius);
@@ -346,7 +346,7 @@ public final class Util
return Math.round(number);
}
float exponent = (float) Math.pow(10, numPlaces);
final float exponent = (float) Math.pow(10, numPlaces);
return Math.round(number * exponent) / exponent;
}
@@ -468,7 +468,7 @@ public final class Util
public static File[] getDatapackFiles(String dirname, String extention)
{
File dir = new File(Config.DATAPACK_ROOT, "/" + dirname);
final File dir = new File(Config.DATAPACK_ROOT, "/" + dirname);
if (!dir.exists())
{
return null;
@@ -478,13 +478,13 @@ public final class Util
public static String getDateString(Date date)
{
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
return dateFormat.format(date.getTime());
}
private static final void buildHtmlBypassCache(L2PcInstance player, HtmlActionScope scope, String html)
{
String htmlLower = html.toLowerCase(Locale.ENGLISH);
final String htmlLower = html.toLowerCase(Locale.ENGLISH);
int bypassEnd = 0;
int bypassStart = htmlLower.indexOf("=\"bypass ", bypassEnd);
int bypassStartEnd;
@@ -497,7 +497,7 @@ public final class Util
break;
}
int hParamPos = htmlLower.indexOf("-h ", bypassStartEnd);
final int hParamPos = htmlLower.indexOf("-h ", bypassStartEnd);
String bypass;
if ((hParamPos != -1) && (hParamPos < bypassEnd))
{
@@ -508,7 +508,7 @@ public final class Util
bypass = html.substring(bypassStartEnd, bypassEnd).trim();
}
int firstParameterStart = bypass.indexOf(AbstractHtmlPacket.VAR_PARAM_START_CHAR);
final int firstParameterStart = bypass.indexOf(AbstractHtmlPacket.VAR_PARAM_START_CHAR);
if (firstParameterStart != -1)
{
bypass = bypass.substring(0, firstParameterStart + 1);
@@ -525,7 +525,7 @@ public final class Util
private static final void buildHtmlLinkCache(L2PcInstance player, HtmlActionScope scope, String html)
{
String htmlLower = html.toLowerCase(Locale.ENGLISH);
final String htmlLower = html.toLowerCase(Locale.ENGLISH);
int linkEnd = 0;
int linkStart = htmlLower.indexOf("=\"link ", linkEnd);
int linkStartEnd;
@@ -538,7 +538,7 @@ public final class Util
break;
}
String htmlLink = html.substring(linkStartEnd, linkEnd).trim();
final String htmlLink = html.substring(linkStartEnd, linkEnd).trim();
if (htmlLink.isEmpty())
{
LOGGER.warning("Html link path is empty!");
@@ -745,7 +745,7 @@ public final class Util
public static boolean isInsideRangeOfObjectId(L2Object obj, int targetObjId, int radius)
{
L2Object target = obj.getKnownList().getKnownObjects().get(targetObjId);
final L2Object target = obj.getKnownList().getKnownObjects().get(targetObjId);
if (target == null)
{
return false;
@@ -1009,7 +1009,7 @@ public final class Util
{
try
{
String value = st.nextToken().trim();
final String value = st.nextToken().trim();
return Integer.parseInt(value);
}
catch (Exception e)