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

@@ -44,7 +44,7 @@ public final class L2Armor extends L2Item
super(set);
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE);
int _bodyPart = getBodyPart();
final int _bodyPart = getBodyPart();
if ((_bodyPart == L2Item.SLOT_NECK) || ((_bodyPart & L2Item.SLOT_L_EAR) != 0) || ((_bodyPart & L2Item.SLOT_L_FINGER) != 0) || ((_bodyPart & L2Item.SLOT_R_BRACELET) != 0) || ((_bodyPart & L2Item.SLOT_L_BRACELET) != 0))
{
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
@@ -60,10 +60,10 @@ public final class L2Armor extends L2Item
_type2 = L2Item.TYPE2_SHIELD_ARMOR;
}
String skill = set.getString("enchant4_skill", null);
final String skill = set.getString("enchant4_skill", null);
if (skill != null)
{
String[] info = skill.split("-");
final String[] info = skill.split("-");
if ((info != null) && (info.length == 2))
{

View File

@@ -78,10 +78,10 @@ public final class L2EtcItem extends L2Item
_isBlessed = set.getBoolean("blessed", false);
// Extractable
String capsuled_items = set.getString("capsuled_items", null);
final String capsuled_items = set.getString("capsuled_items", null);
if (capsuled_items != null)
{
String[] split = capsuled_items.split(";");
final String[] split = capsuled_items.split(";");
_extractableItems = new ArrayList<>(split.length);
for (String part : split)
{
@@ -89,21 +89,21 @@ public final class L2EtcItem extends L2Item
{
continue;
}
String[] data = part.split(",");
final String[] data = part.split(",");
if ((data.length != 4) && (data.length != 6))
{
_log.info(StringUtil.concat("> Couldnt parse ", part, " in capsuled_items! item ", toString()));
continue;
}
int itemId = Integer.parseInt(data[0]);
int min = Integer.parseInt(data[1]);
int max = Integer.parseInt(data[2]);
final int itemId = Integer.parseInt(data[0]);
final int min = Integer.parseInt(data[1]);
final int max = Integer.parseInt(data[2]);
if (max < min)
{
_log.info(StringUtil.concat("> Max amount < Min amount in ", part, ", item ", toString()));
continue;
}
double chance = Double.parseDouble(data[3]);
final double chance = Double.parseDouble(data[3]);
int minEnchant = 0;
int maxEnchant = 0;
if (data.length == 6)

View File

@@ -219,7 +219,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
String skills = set.getString("item_skill", null);
if (skills != null)
{
String[] skillsSplit = skills.split(";");
final String[] skillsSplit = skills.split(";");
_skillHolder = new SkillHolder[skillsSplit.length];
int used = 0;
@@ -227,9 +227,9 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
{
try
{
String[] skillSplit = element.split("-");
int id = Integer.parseInt(skillSplit[0]);
int level = Integer.parseInt(skillSplit[1]);
final String[] skillSplit = element.split("-");
final int id = Integer.parseInt(skillSplit[0]);
final int level = Integer.parseInt(skillSplit[1]);
if (id == 0)
{
@@ -255,7 +255,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
// this is only loading? just don't leave a null or use a collection?
if (used != _skillHolder.length)
{
SkillHolder[] skillHolder = new SkillHolder[used];
final SkillHolder[] skillHolder = new SkillHolder[used];
System.arraycopy(_skillHolder, 0, skillHolder, 0, used);
_skillHolder = skillHolder;
}
@@ -264,7 +264,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
skills = set.getString("unequip_skill", null);
if (skills != null)
{
String[] info = skills.split("-");
final String[] info = skills.split("-");
if ((info != null) && (info.length == 2))
{
int id = 0;
@@ -289,7 +289,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
skills = set.getString("equip_skill", null);
if (skills != null)
{
String[] info = skills.split("-");
final String[] info = skills.split("-");
if ((info != null) && (info.length == 2))
{
int id = 0;
@@ -562,7 +562,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
else
{
elm = element;
Elementals[] array = new Elementals[_elementals.length + 1];
final Elementals[] array = new Elementals[_elementals.length + 1];
System.arraycopy(_elementals, 0, array, 0, _elementals.length);
array[_elementals.length] = elm;
_elementals = array;
@@ -733,7 +733,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
final List<AbstractFunction> funcs = new ArrayList<>(_funcTemplates.size());
for (FuncTemplate t : _funcTemplates)
{
AbstractFunction f = t.getFunc(player, player, item, item);
final AbstractFunction f = t.getFunc(player, player, item, item);
if (f != null)
{
funcs.add(f);
@@ -869,15 +869,15 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
if (sendMessage)
{
String msg = preCondition.getMessage();
int msgId = preCondition.getMessageId();
final String msg = preCondition.getMessage();
final int msgId = preCondition.getMessageId();
if (msg != null)
{
activeChar.sendMessage(msg);
}
else if (msgId != 0)
{
SystemMessage sm = SystemMessage.getSystemMessage(msgId);
final SystemMessage sm = SystemMessage.getSystemMessage(msgId);
if (preCondition.isAddName())
{
sm.addItemName(_itemId);

View File

@@ -88,7 +88,7 @@ public final class L2Weapon extends L2Item
_rndDam = set.getInt("random_damage", 0);
_mpConsume = set.getInt("mp_consume", 0);
_baseAttackRange = set.getInt("attack_range", 40);
String[] damgeRange = set.getString("damage_range", "").split(";"); // 0?;0?;fan sector;base attack angle
final String[] damgeRange = set.getString("damage_range", "").split(";"); // 0?;0?;fan sector;base attack angle
if ((damgeRange.length > 1) && Util.isDigit(damgeRange[3]))
{
_baseAttackAngle = Integer.parseInt(damgeRange[3]);
@@ -98,18 +98,18 @@ public final class L2Weapon extends L2Item
_baseAttackAngle = 120;
}
String[] reduced_soulshots = set.getString("reduced_soulshot", "").split(",");
final String[] reduced_soulshots = set.getString("reduced_soulshot", "").split(",");
_reducedSoulshotChance = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[0]) : 0;
_reducedSoulshot = (reduced_soulshots.length == 2) ? Integer.parseInt(reduced_soulshots[1]) : 0;
String[] reduced_mpconsume = set.getString("reduced_mp_consume", "").split(",");
final String[] reduced_mpconsume = set.getString("reduced_mp_consume", "").split(",");
_reducedMpConsumeChance = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[0]) : 0;
_reducedMpConsume = (reduced_mpconsume.length == 2) ? Integer.parseInt(reduced_mpconsume[1]) : 0;
String skill = set.getString("enchant4_skill", null);
if (skill != null)
{
String[] info = skill.split("-");
final String[] info = skill.split("-");
if ((info != null) && (info.length == 2))
{
@@ -135,7 +135,7 @@ public final class L2Weapon extends L2Item
skill = set.getString("onmagic_skill", null);
if (skill != null)
{
String[] info = skill.split("-");
final String[] info = skill.split("-");
final int chance = set.getInt("onmagic_chance", 100);
if ((info != null) && (info.length == 2))
{
@@ -162,7 +162,7 @@ public final class L2Weapon extends L2Item
skill = set.getString("oncrit_skill", null);
if (skill != null)
{
String[] info = skill.split("-");
final String[] info = skill.split("-");
final int chance = set.getInt("oncrit_chance", 100);
if ((info != null) && (info.length == 2))
{
@@ -431,7 +431,7 @@ public final class L2Weapon extends L2Item
// notify quests of a skill use
if (caster instanceof L2PcInstance)
{
L2Character[] targets =
final L2Character[] targets =
{
target
};
@@ -449,7 +449,7 @@ public final class L2Weapon extends L2Item
}
if (caster.isPlayer())
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_ACTIVATED);
sm.addSkillName(onMagicSkill);
caster.sendPacket(sm);
}

View File

@@ -264,7 +264,7 @@ public final class L2ItemInstance extends L2Object
{
assert getWorldRegion() != null;
L2WorldRegion oldregion = getWorldRegion();
final L2WorldRegion oldregion = getWorldRegion();
// Create a server->client GetItem packet to pick up the L2ItemInstance
player.broadcastPacket(new GetItem(this, player.getObjectId()));
@@ -276,7 +276,7 @@ public final class L2ItemInstance extends L2Object
}
// if this item is a mercenary ticket, remove the spawns!
int itemId = getId();
final int itemId = getId();
if (MercTicketManager.getInstance().getTicketCastleId(itemId) > 0)
{
@@ -310,7 +310,7 @@ public final class L2ItemInstance extends L2Object
{
if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (getItem().isEquipable() || (getItem().getId() == ADENA_ID))))
{
LogRecord record = new LogRecord(Level.INFO, "SETOWNER:" + process);
final LogRecord record = new LogRecord(Level.INFO, "SETOWNER:" + process);
record.setLoggerName("item");
record.setParameters(new Object[]
{
@@ -335,7 +335,7 @@ public final class L2ItemInstance extends L2Object
{
referenceName = (String) reference;
}
String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
final String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(creator.getName() + " [" + creator.getObjectId() + "]", process + "(id: " + getId() + " name: " + getName() + ")", targetName, "L2Object referencing this action is: " + referenceName);
@@ -454,8 +454,8 @@ public final class L2ItemInstance extends L2Object
{
return;
}
long old = getCount();
long max = getId() == ADENA_ID ? MAX_ADENA : Integer.MAX_VALUE;
final long old = getCount();
final long max = getId() == ADENA_ID ? MAX_ADENA : Integer.MAX_VALUE;
if ((count > 0) && (getCount() > (max - count)))
{
@@ -477,7 +477,7 @@ public final class L2ItemInstance extends L2Object
{
if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (_item.isEquipable() || (_item.getId() == ADENA_ID))))
{
LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
final LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
record.setLoggerName("item");
record.setParameters(new Object[]
{
@@ -503,7 +503,7 @@ public final class L2ItemInstance extends L2Object
{
referenceName = (String) reference;
}
String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
final String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(creator.getName() + " [" + creator.getObjectId() + "]", process + "(id: " + getId() + " objId: " + getObjectId() + " name: " + getName() + " count: " + count + ")", targetName, "L2Object referencing this action is: " + referenceName);
@@ -976,7 +976,7 @@ public final class L2ItemInstance extends L2Object
{
if (rs.next())
{
int aug_attributes = rs.getInt(1);
final int aug_attributes = rs.getInt(1);
if (aug_attributes != -1)
{
_augmentation = new L2Augmentation(rs.getInt("augAttributes"));
@@ -989,8 +989,8 @@ public final class L2ItemInstance extends L2Object
{
while (rs.next())
{
byte elem_type = rs.getByte(1);
int elem_value = rs.getInt(2);
final byte elem_type = rs.getByte(1);
final int elem_value = rs.getInt(2);
if ((elem_type != -1) && (elem_value != -1))
{
applyAttribute(elem_type, elem_value);
@@ -1115,7 +1115,7 @@ public final class L2ItemInstance extends L2Object
}
else if (getItem().getElementals() != null)
{
Elementals elm = getItem().getElemental(element);
final Elementals elm = getItem().getElemental(element);
if (elm != null)
{
return elm.getValue();
@@ -1123,7 +1123,7 @@ public final class L2ItemInstance extends L2Object
}
else if (_elementals != null)
{
Elementals elm = getElemental(element);
final Elementals elm = getElemental(element);
if (elm != null)
{
return elm.getValue();
@@ -1149,7 +1149,7 @@ public final class L2ItemInstance extends L2Object
else
{
elm = new Elementals(element, value);
Elementals[] array = new Elementals[_elementals.length + 1];
final Elementals[] array = new Elementals[_elementals.length + 1];
System.arraycopy(_elementals, 0, array, 0, _elementals.length);
array[_elementals.length] = elm;
_elementals = array;
@@ -1166,7 +1166,7 @@ public final class L2ItemInstance extends L2Object
}
else
{
Elementals elm = getElemental(element);
final Elementals elm = getElemental(element);
if (elm != null)
{
elm.setValue(value);
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
}
_elementals = array;
String query = (element != -1) ? "DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?" : "DELETE FROM item_elementals WHERE itemId = ?";
final String query = (element != -1) ? "DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?" : "DELETE FROM item_elementals WHERE itemId = ?";
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
@@ -1370,8 +1370,8 @@ public final class L2ItemInstance extends L2Object
// unequip
if (isEquipped())
{
L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
InventoryUpdate iu = new InventoryUpdate();
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
final InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance item : unequiped)
{
item.unChargeAllShots();
@@ -1387,7 +1387,7 @@ public final class L2ItemInstance extends L2Object
player.getInventory().destroyItem("L2ItemInstance", this, player, null);
// send update
InventoryUpdate iu = new InventoryUpdate();
final InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(this);
player.sendPacket(iu);
@@ -1412,7 +1412,7 @@ public final class L2ItemInstance extends L2Object
}
if (getItemLocation() != ItemLocation.WAREHOUSE)
{
InventoryUpdate iu = new InventoryUpdate();
final InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(this);
player.sendPacket(iu);
}
@@ -1524,7 +1524,7 @@ public final class L2ItemInstance extends L2Object
_log.log(Level.SEVERE, "Could not restore an item owned by " + ownerId + " from DB:", e);
return null;
}
L2Item item = ItemTable.getInstance().getTemplate(item_id);
final L2Item item = ItemTable.getInstance().getTemplate(item_id);
if (item == null)
{
_log.severe("Item item_id=" + item_id + " not known, object_id=" + objectId);
@@ -1593,7 +1593,7 @@ public final class L2ItemInstance extends L2Object
if (_dropper != null)
{
Location dropDest = GeoData.getInstance().moveCheck(_dropper.getX(), _dropper.getY(), _dropper.getZ(), _x, _y, _z, _dropper.getInstanceId());
final Location dropDest = GeoData.getInstance().moveCheck(_dropper.getX(), _dropper.getY(), _dropper.getZ(), _x, _y, _z, _dropper.getInstanceId());
_x = dropDest.getX();
_y = dropDest.getY();
_z = dropDest.getZ();
@@ -1863,13 +1863,13 @@ public final class L2ItemInstance extends L2Object
public void endOfLife()
{
L2PcInstance player = getActingPlayer();
final L2PcInstance player = getActingPlayer();
if (player != null)
{
if (isEquipped())
{
L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
InventoryUpdate iu = new InventoryUpdate();
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
final InventoryUpdate iu = new InventoryUpdate();
for (L2ItemInstance item : unequiped)
{
item.unChargeAllShots();
@@ -1885,7 +1885,7 @@ public final class L2ItemInstance extends L2Object
player.getInventory().destroyItem("L2ItemInstance", this, player, null);
// send update
InventoryUpdate iu = new InventoryUpdate();
final InventoryUpdate iu = new InventoryUpdate();
iu.addRemovedItem(this);
player.sendPacket(iu);
@@ -2048,7 +2048,7 @@ public final class L2ItemInstance extends L2Object
public int getOlyEnchantLevel()
{
L2PcInstance player = getActingPlayer();
final L2PcInstance player = getActingPlayer();
int enchant = getEnchantLevel();
if (player == null)
@@ -2141,9 +2141,9 @@ public final class L2ItemInstance extends L2Object
{
if (command.startsWith("Quest"))
{
String questName = command.substring(6);
final String questName = command.substring(6);
String event = null;
int idx = questName.indexOf(' ');
final int idx = questName.indexOf(' ');
if (idx > 0)
{
event = questName.substring(idx).trim();
@@ -2190,7 +2190,7 @@ public final class L2ItemInstance extends L2Object
*/
public int[] getEnchantOptions()
{
EnchantOptions op = EnchantItemOptionsData.getInstance().getOptions(this);
final EnchantOptions op = EnchantItemOptionsData.getInstance().getOptions(this);
if (op != null)
{
return op.getOptions();