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

@@ -170,7 +170,7 @@ public final class GameServer
public GameServer() throws Exception
{
long serverLoadStart = System.currentTimeMillis();
final long serverLoadStart = System.currentTimeMillis();
if (!IdFactory.getInstance().isInitialized())
{
@@ -470,7 +470,7 @@ public final class GameServer
/*** Main ***/
// Create log folder
File logFolder = new File(".", LOG_FOLDER);
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory

View File

@@ -156,7 +156,7 @@ public final class GameTimeController extends Thread
{
moveObjects();
}
catch (final Throwable e)
catch (Throwable e)
{
_log.log(Level.WARNING, "", e);
}
@@ -168,7 +168,7 @@ public final class GameTimeController extends Thread
{
Thread.sleep(sleepTime);
}
catch (final InterruptedException e)
catch (InterruptedException e)
{
}

View File

@@ -200,7 +200,7 @@ public class GeoData
return z;
}
int nextLowerZ = getNextLowerZ(geoX, geoY, z + 20);
final int nextLowerZ = getNextLowerZ(geoX, geoY, z + 20);
return Math.abs(nextLowerZ - z) <= SPAWN_Z_DELTA_LIMIT ? nextLowerZ : z;
}
@@ -353,31 +353,31 @@ public class GeoData
geoY = tmp;
}
LinePointIterator3D pointIter = new LinePointIterator3D(geoX, geoY, z, tGeoX, tGeoY, tz);
final LinePointIterator3D pointIter = new LinePointIterator3D(geoX, geoY, z, tGeoX, tGeoY, tz);
// first point is guaranteed to be available, skip it, we can always see our own position
pointIter.next();
int prevX = pointIter.x();
int prevY = pointIter.y();
int prevZ = pointIter.z();
final int prevZ = pointIter.z();
int prevGeoZ = prevZ;
int ptIndex = 0;
while (pointIter.next())
{
int curX = pointIter.x();
int curY = pointIter.y();
final int curX = pointIter.x();
final int curY = pointIter.y();
if ((curX == prevX) && (curY == prevY))
{
continue;
}
int beeCurZ = pointIter.z();
final int beeCurZ = pointIter.z();
int curGeoZ = prevGeoZ;
// check if the position has geodata
if (hasGeoPos(curX, curY))
{
int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
final int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
curGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, curX, curY, nswe);
int maxHeight;
if (ptIndex < ELEVATED_SEE_OVER_DISTANCE)
@@ -394,26 +394,26 @@ public class GeoData
{
if ((nswe & Cell.NSWE_NORTH_EAST) == Cell.NSWE_NORTH_EAST)
{
int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_EAST);
int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_NORTH);
final int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_EAST);
final int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_NORTH);
canSeeThrough = (northGeoZ <= maxHeight) && (eastGeoZ <= maxHeight) && (northGeoZ <= getNearestZ(prevX, prevY - 1, beeCurZ)) && (eastGeoZ <= getNearestZ(prevX + 1, prevY, beeCurZ));
}
else if ((nswe & Cell.NSWE_NORTH_WEST) == Cell.NSWE_NORTH_WEST)
{
int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_WEST);
int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_NORTH);
final int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_WEST);
final int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_NORTH);
canSeeThrough = (northGeoZ <= maxHeight) && (westGeoZ <= maxHeight) && (northGeoZ <= getNearestZ(prevX, prevY - 1, beeCurZ)) && (westGeoZ <= getNearestZ(prevX - 1, prevY, beeCurZ));
}
else if ((nswe & Cell.NSWE_SOUTH_EAST) == Cell.NSWE_SOUTH_EAST)
{
int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_EAST);
int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_SOUTH);
final int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_EAST);
final int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_SOUTH);
canSeeThrough = (southGeoZ <= maxHeight) && (eastGeoZ <= maxHeight) && (southGeoZ <= getNearestZ(prevX, prevY + 1, beeCurZ)) && (eastGeoZ <= getNearestZ(prevX + 1, prevY, beeCurZ));
}
else if ((nswe & Cell.NSWE_SOUTH_WEST) == Cell.NSWE_SOUTH_WEST)
{
int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_WEST);
int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_SOUTH);
final int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_WEST);
final int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_SOUTH);
canSeeThrough = (southGeoZ <= maxHeight) && (westGeoZ <= maxHeight) && (southGeoZ <= getNearestZ(prevX, prevY + 1, beeCurZ)) && (westGeoZ <= getNearestZ(prevX - 1, prevY, beeCurZ));
}
else
@@ -461,11 +461,11 @@ public class GeoData
*/
public Location moveCheck(int x, int y, int z, int tx, int ty, int tz, int instanceId)
{
int geoX = getGeoX(x);
int geoY = getGeoY(y);
final int geoX = getGeoX(x);
final int geoY = getGeoY(y);
z = getNearestZ(geoX, geoY, z);
int tGeoX = getGeoX(tx);
int tGeoY = getGeoY(ty);
final int tGeoX = getGeoX(tx);
final int tGeoY = getGeoY(ty);
tz = getNearestZ(tGeoX, tGeoY, tz);
if (DoorData.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, false))
@@ -473,7 +473,7 @@ public class GeoData
return new Location(x, y, getHeight(x, y, z));
}
LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
final LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
// first point is guaranteed to be available
pointIter.next();
int prevX = pointIter.x();
@@ -482,13 +482,13 @@ public class GeoData
while (pointIter.next())
{
int curX = pointIter.x();
int curY = pointIter.y();
int curZ = getNearestZ(curX, curY, prevZ);
final int curX = pointIter.x();
final int curY = pointIter.y();
final int curZ = getNearestZ(curX, curY, prevZ);
if (hasGeoPos(prevX, prevY))
{
int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
final int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe))
{
// can't move, return previous location
@@ -523,11 +523,11 @@ public class GeoData
*/
public boolean canMove(int fromX, int fromY, int fromZ, int toX, int toY, int toZ, int instanceId)
{
int geoX = getGeoX(fromX);
int geoY = getGeoY(fromY);
final int geoX = getGeoX(fromX);
final int geoY = getGeoY(fromY);
fromZ = getNearestZ(geoX, geoY, fromZ);
int tGeoX = getGeoX(toX);
int tGeoY = getGeoY(toY);
final int tGeoX = getGeoX(toX);
final int tGeoY = getGeoY(toY);
toZ = getNearestZ(tGeoX, tGeoY, toZ);
if (DoorData.getInstance().checkIfDoorsBetween(fromX, fromY, fromZ, toX, toY, toZ, instanceId, false))
@@ -535,7 +535,7 @@ public class GeoData
return false;
}
LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
final LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
// first point is guaranteed to be available
pointIter.next();
int prevX = pointIter.x();
@@ -544,13 +544,13 @@ public class GeoData
while (pointIter.next())
{
int curX = pointIter.x();
int curY = pointIter.y();
int curZ = getNearestZ(curX, curY, prevZ);
final int curX = pointIter.x();
final int curY = pointIter.y();
final int curZ = getNearestZ(curX, curY, prevZ);
if (hasGeoPos(prevX, prevY))
{
int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
final int nswe = GeoUtils.computeNswe(prevX, prevY, curX, curY);
if (!checkNearestNsweAntiCornerCut(prevX, prevY, prevZ, nswe))
{
return false;
@@ -573,22 +573,22 @@ public class GeoData
public int traceTerrainZ(int x, int y, int z, int tx, int ty)
{
int geoX = getGeoX(x);
int geoY = getGeoY(y);
final int geoX = getGeoX(x);
final int geoY = getGeoY(y);
z = getNearestZ(geoX, geoY, z);
int tGeoX = getGeoX(tx);
int tGeoY = getGeoY(ty);
final int tGeoX = getGeoX(tx);
final int tGeoY = getGeoY(ty);
LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
final LinePointIterator pointIter = new LinePointIterator(geoX, geoY, tGeoX, tGeoY);
// first point is guaranteed to be available
pointIter.next();
int prevZ = z;
while (pointIter.next())
{
int curX = pointIter.x();
int curY = pointIter.y();
int curZ = getNearestZ(curX, curY, prevZ);
final int curX = pointIter.x();
final int curY = pointIter.y();
final int curZ = getNearestZ(curX, curY, prevZ);
prevZ = curZ;
}

View File

@@ -154,11 +154,11 @@ public class LoginServerThread extends Thread
// Connection
_log.info("Connecting to login on " + _hostname + ":" + _port);
_loginSocket = new Socket(_hostname, _port);
InputStream in = _loginSocket.getInputStream();
final InputStream in = _loginSocket.getInputStream();
_out = new BufferedOutputStream(_loginSocket.getOutputStream());
// init Blowfish
byte[] blowfishKey = Util.generateHex(40);
final byte[] blowfishKey = Util.generateHex(40);
// Protect the new blowfish key what cannot begin with zero
if (blowfishKey[0] == 0)
{
@@ -177,7 +177,7 @@ public class LoginServerThread extends Thread
break;
}
byte[] incoming = new byte[length - 2];
final byte[] incoming = new byte[length - 2];
int receivedBytes = 0;
int newBytes = 0;
@@ -205,11 +205,11 @@ public class LoginServerThread extends Thread
break;
}
int packetType = incoming[0] & 0xff;
final int packetType = incoming[0] & 0xff;
switch (packetType)
{
case 0x00:
InitLS init = new InitLS(incoming);
final InitLS init = new InitLS(incoming);
if (init.getRevision() != REVISION)
{
// TODO: revision mismatch
@@ -221,9 +221,9 @@ public class LoginServerThread extends Thread
try
{
KeyFactory kfac = KeyFactory.getInstance("RSA");
BigInteger modulus = new BigInteger(init.getRSAKey());
RSAPublicKeySpec kspec1 = new RSAPublicKeySpec(modulus, RSAKeyGenParameterSpec.F4);
final KeyFactory kfac = KeyFactory.getInstance("RSA");
final BigInteger modulus = new BigInteger(init.getRSAKey());
final RSAPublicKeySpec kspec1 = new RSAPublicKeySpec(modulus, RSAKeyGenParameterSpec.F4);
publicKey = (RSAPublicKey) kfac.generatePublic(kspec1);
}
catch (GeneralSecurityException e)
@@ -238,17 +238,17 @@ public class LoginServerThread extends Thread
sendPacket(new AuthRequest(_requestID, _acceptAlternate, _hexID, _gamePort, _reserveHost, _maxPlayer, _subnets, _hosts));
break;
case 0x01:
LoginServerFail lsf = new LoginServerFail(incoming);
final LoginServerFail lsf = new LoginServerFail(incoming);
_log.info("Damn! Registeration Failed: " + lsf.getReasonString());
// login will close the connection here
break;
case 0x02:
AuthResponse aresp = new AuthResponse(incoming);
int serverID = aresp.getServerId();
final AuthResponse aresp = new AuthResponse(incoming);
final int serverID = aresp.getServerId();
_serverName = aresp.getServerName();
Config.saveHexid(serverID, hexToString(_hexID));
_log.info("Registered on login as Server " + serverID + " : " + _serverName);
ServerStatus st = new ServerStatus();
final ServerStatus st = new ServerStatus();
if (Config.SERVER_LIST_BRACKET)
{
st.addAttribute(ServerStatus.SERVER_LIST_SQUARE_BRACKET, ServerStatus.ON);
@@ -290,8 +290,8 @@ public class LoginServerThread extends Thread
}
break;
case 0x03:
PlayerAuthResponse par = new PlayerAuthResponse(incoming);
String account = par.getAccount();
final PlayerAuthResponse par = new PlayerAuthResponse(incoming);
final String account = par.getAccount();
WaitingClient wcToRemove = null;
synchronized (_waitingClients)
{
@@ -307,11 +307,11 @@ public class LoginServerThread extends Thread
{
if (par.isAuthed())
{
PlayerInGame pig = new PlayerInGame(par.getAccount());
final PlayerInGame pig = new PlayerInGame(par.getAccount());
sendPacket(pig);
wcToRemove.gameClient.setState(GameClientState.AUTHED);
wcToRemove.gameClient.setSessionId(wcToRemove.session);
CharSelectionInfo cl = new CharSelectionInfo(wcToRemove.account, wcToRemove.gameClient.getSessionId().playOkID1);
final CharSelectionInfo cl = new CharSelectionInfo(wcToRemove.account, wcToRemove.gameClient.getSessionId().playOkID1);
wcToRemove.gameClient.getConnection().sendPacket(cl);
wcToRemove.gameClient.setCharSelection(cl.getCharInfo());
}
@@ -326,11 +326,11 @@ public class LoginServerThread extends Thread
}
break;
case 0x04:
KickPlayer kp = new KickPlayer(incoming);
final KickPlayer kp = new KickPlayer(incoming);
doKickPlayer(kp.getAccount());
break;
case 0x05:
RequestCharacters rc = new RequestCharacters(incoming);
final RequestCharacters rc = new RequestCharacters(incoming);
getCharsOnServer(rc.getAccount());
break;
case 0x06:
@@ -385,12 +385,12 @@ public class LoginServerThread extends Thread
*/
public void addWaitingClientAndSendRequest(String acc, L2GameClient client, SessionKey key)
{
WaitingClient wc = new WaitingClient(acc, client, key);
final WaitingClient wc = new WaitingClient(acc, client, key);
synchronized (_waitingClients)
{
_waitingClients.add(wc);
}
PlayerAuthRequest par = new PlayerAuthRequest(acc, key);
final PlayerAuthRequest par = new PlayerAuthRequest(acc, key);
try
{
sendPacket(par);
@@ -434,7 +434,7 @@ public class LoginServerThread extends Thread
{
return;
}
PlayerLogout pl = new PlayerLogout(account);
final PlayerLogout pl = new PlayerLogout(account);
try
{
sendPacket(pl);
@@ -467,7 +467,7 @@ public class LoginServerThread extends Thread
*/
public void sendAccessLevel(String account, int level)
{
ChangeAccessLevel cal = new ChangeAccessLevel(account, level);
final ChangeAccessLevel cal = new ChangeAccessLevel(account, level);
try
{
sendPacket(cal);
@@ -484,7 +484,7 @@ public class LoginServerThread extends Thread
*/
public void sendClientTracert(String account, String[] address)
{
PlayerTracert ptc = new PlayerTracert(account, address[0], address[1], address[2], address[3], address[4]);
final PlayerTracert ptc = new PlayerTracert(account, address[0], address[1], address[2], address[3], address[4]);
try
{
sendPacket(ptc);
@@ -502,7 +502,7 @@ public class LoginServerThread extends Thread
*/
public void sendMail(String account, String mailId, String... args)
{
SendMail sem = new SendMail(account, mailId, args);
final SendMail sem = new SendMail(account, mailId, args);
try
{
sendPacket(sem);
@@ -520,7 +520,7 @@ public class LoginServerThread extends Thread
*/
public void sendTempBan(String account, String ip, long time)
{
TempBan tbn = new TempBan(account, ip, time);
final TempBan tbn = new TempBan(account, ip, time);
try
{
sendPacket(tbn);
@@ -546,10 +546,10 @@ public class LoginServerThread extends Thread
*/
public void doKickPlayer(String account)
{
L2GameClient client = _accountsInGameServer.get(account);
final L2GameClient client = _accountsInGameServer.get(account);
if (client != null)
{
LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
final LogRecord record = new LogRecord(Level.WARNING, "Kicked by login");
record.setParameters(new Object[]
{
client
@@ -568,7 +568,7 @@ public class LoginServerThread extends Thread
{
int chars = 0;
List<Long> charToDel = new ArrayList<>();
final List<Long> charToDel = new ArrayList<>();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
@@ -578,7 +578,7 @@ public class LoginServerThread extends Thread
while (rs.next())
{
chars++;
long delTime = rs.getLong("deletetime");
final long delTime = rs.getLong("deletetime");
if (delTime != 0)
{
charToDel.add(delTime);
@@ -591,7 +591,7 @@ public class LoginServerThread extends Thread
_log.log(Level.WARNING, "Exception: getCharsOnServer: " + e.getMessage(), e);
}
ReplyCharacters rec = new ReplyCharacters(account, chars, charToDel);
final ReplyCharacters rec = new ReplyCharacters(account, chars, charToDel);
try
{
sendPacket(rec);
@@ -608,11 +608,11 @@ public class LoginServerThread extends Thread
*/
private void sendPacket(BaseSendablePacket sl) throws IOException
{
byte[] data = sl.getContent();
final byte[] data = sl.getContent();
NewCrypt.appendChecksum(data);
_blowfish.crypt(data, 0, data.length);
int len = data.length + 2;
final int len = data.length + 2;
synchronized (_out) // avoids tow threads writing in the mean time
{
_out.write(len & 0xff);
@@ -648,7 +648,7 @@ public class LoginServerThread extends Thread
*/
public void sendServerStatus(int id, int value)
{
ServerStatus ss = new ServerStatus();
final ServerStatus ss = new ServerStatus();
ss.addAttribute(id, value);
try
{
@@ -664,7 +664,7 @@ public class LoginServerThread extends Thread
*/
public void sendServerType()
{
ServerStatus ss = new ServerStatus();
final ServerStatus ss = new ServerStatus();
ss.addAttribute(ServerStatus.SERVER_TYPE, Config.SERVER_LIST_TYPE);
try
{
@@ -684,7 +684,7 @@ public class LoginServerThread extends Thread
*/
public void sendChangePassword(String accountName, String charName, String oldpass, String newpass)
{
ChangePassword cp = new ChangePassword(accountName, charName, oldpass, newpass);
final ChangePassword cp = new ChangePassword(accountName, charName, oldpass, newpass);
try
{
sendPacket(cp);

View File

@@ -54,7 +54,7 @@ public class MonsterRace
for (int i = 0; i < 8; i++)
{
int id = 31003;
final int id = 31003;
random = Rnd.get(24);
while (true)
{
@@ -70,8 +70,8 @@ public class MonsterRace
}
try
{
L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
Constructor<?> constructor = Class.forName("com.l2jserver.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
final L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
final Constructor<?> constructor = Class.forName("com.l2jserver.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
_monsters[i] = (L2Npc) constructor.newInstance(template);
}
catch (Exception e)

View File

@@ -69,7 +69,7 @@ public class RecipeController
// Check if player is trying to alter recipe book while engaged in manufacturing.
if (!_activeMakers.containsKey(player.getObjectId()))
{
RecipeBookItemList response = new RecipeBookItemList(isDwarvenCraft, player.getMaxMp());
final RecipeBookItemList response = new RecipeBookItemList(isDwarvenCraft, player.getMaxMp());
response.addRecipes(isDwarvenCraft ? player.getDwarvenRecipeBook() : player.getCommonRecipeBook());
player.sendPacket(response);
return;
@@ -90,8 +90,8 @@ public class RecipeController
return;
}
List<L2RecipeList> dwarfRecipes = Arrays.asList(manufacturer.getDwarvenRecipeBook());
List<L2RecipeList> commonRecipes = Arrays.asList(manufacturer.getCommonRecipeBook());
final List<L2RecipeList> dwarfRecipes = Arrays.asList(manufacturer.getDwarvenRecipeBook());
final List<L2RecipeList> commonRecipes = Arrays.asList(manufacturer.getCommonRecipeBook());
if (!dwarfRecipes.contains(recipeList) && !commonRecipes.contains(recipeList))
{
@@ -136,8 +136,8 @@ public class RecipeController
return;
}
List<L2RecipeList> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
List<L2RecipeList> commonRecipes = Arrays.asList(player.getCommonRecipeBook());
final List<L2RecipeList> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
final List<L2RecipeList> commonRecipes = Arrays.asList(player.getCommonRecipeBook());
if (!dwarfRecipes.contains(recipeList) && !commonRecipes.contains(recipeList))
{
@@ -148,7 +148,7 @@ public class RecipeController
// Check if player is busy (possible if alt game creation is enabled)
if (Config.ALT_GAME_CREATION && _activeMakers.containsKey(player.getObjectId()))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_S1);
sm.addItemName(recipeList.getItemId());
sm.addString("You are busy creating.");
player.sendPacket(sm);
@@ -353,7 +353,7 @@ public class RecipeController
_delay = (int) (Config.ALT_GAME_CREATION_SPEED * _player.getMReuseRate(_skill) * GameTimeController.TICKS_PER_SECOND * GameTimeController.MILLIS_IN_TICK);
// FIXME: please fix this packet to show crafting animation (somebody)
MagicSkillUse msk = new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0);
final MagicSkillUse msk = new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0);
_player.broadcastPacket(msk);
_player.sendPacket(new SetupGauge(0, _delay));
@@ -394,7 +394,7 @@ public class RecipeController
if ((_target != _player) && (_price > 0)) // customer must pay for services
{
// attempt to pay for item
L2ItemInstance adenatransfer = _target.transferItem("PayManufacture", _target.getInventory().getAdenaInstance().getObjectId(), _price, _player.getInventory(), _player);
final L2ItemInstance adenatransfer = _target.transferItem("PayManufacture", _target.getInventory().getAdenaInstance().getObjectId(), _price, _player.getInventory(), _player);
if (adenatransfer == null)
{
@@ -464,7 +464,7 @@ public class RecipeController
private void updateCurMp()
{
StatusUpdate su = new StatusUpdate(_target);
final StatusUpdate su = new StatusUpdate(_target);
su.addAttribute(StatusUpdate.CUR_MP, (int) _target.getCurrentMp());
_target.sendPacket(su);
}
@@ -474,7 +474,7 @@ public class RecipeController
int grabItems = _itemGrab;
while ((grabItems > 0) && !_items.isEmpty())
{
TempItem item = _items.get(0);
final TempItem item = _items.get(0);
int count = item.getQuantity();
if (count >= grabItems)
@@ -496,7 +496,7 @@ public class RecipeController
if (_target == _player)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPPED_S1_S2); // you equipped ...
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.EQUIPPED_S1_S2); // you equipped ...
sm.addLong(count);
sm.addItemName(item.getItemId());
_player.sendPacket(sm);
@@ -542,7 +542,7 @@ public class RecipeController
boolean ret = true;
for (L2RecipeStatInstance statUse : _recipeList.getStatUse())
{
double modifiedValue = statUse.getValue() / _creationPasses;
final double modifiedValue = statUse.getValue() / _creationPasses;
if (statUse.getType() == StatType.HP)
{
// we do not want to kill the player, so its CurrentHP must be greater than the reduce value
@@ -601,17 +601,17 @@ public class RecipeController
private List<TempItem> listItems(boolean remove)
{
L2RecipeInstance[] recipes = _recipeList.getRecipes();
Inventory inv = _target.getInventory();
List<TempItem> materials = new ArrayList<>();
final L2RecipeInstance[] recipes = _recipeList.getRecipes();
final Inventory inv = _target.getInventory();
final List<TempItem> materials = new ArrayList<>();
SystemMessage sm;
for (L2RecipeInstance recipe : recipes)
{
if (recipe.getQuantity() > 0)
{
L2ItemInstance item = inv.getItemByItemId(recipe.getItemId());
long itemQuantityAmount = item == null ? 0 : item.getCount();
final L2ItemInstance item = inv.getItemByItemId(recipe.getItemId());
final long itemQuantityAmount = item == null ? 0 : item.getCount();
// check materials
if (itemQuantityAmount < recipe.getQuantity())
@@ -663,10 +663,10 @@ public class RecipeController
private void rewardPlayer()
{
int rareProdId = _recipeList.getRareItemId();
final int rareProdId = _recipeList.getRareItemId();
int itemId = _recipeList.getItemId();
int itemCount = _recipeList.getCount();
L2Item template = ItemTable.getInstance().getTemplate(itemId);
final L2Item template = ItemTable.getInstance().getTemplate(itemId);
// check that the current recipe has a rare production or not
if ((rareProdId != -1) && ((rareProdId == itemId) || Config.CRAFT_MASTERWORK))
@@ -739,7 +739,7 @@ public class RecipeController
if (Config.ALT_GAME_CREATION)
{
int recipeLevel = _recipeList.getLevel();
final int recipeLevel = _recipeList.getLevel();
if (_exp < 0)
{
_exp = template.getReferencePrice() * itemCount;

View File

@@ -77,7 +77,7 @@ public class Shutdown extends Thread
*/
private void SendServerQuit(int seconds)
{
SystemMessage sysm = SystemMessage.getSystemMessage(SystemMessageId.THE_SERVER_WILL_BE_COMING_DOWN_IN_S1_SECOND_S_PLEASE_FIND_A_SAFE_PLACE_TO_LOG_OUT);
final SystemMessage sysm = SystemMessage.getSystemMessage(SystemMessageId.THE_SERVER_WILL_BE_COMING_DOWN_IN_S1_SECOND_S_PLEASE_FIND_A_SAFE_PLACE_TO_LOG_OUT);
sysm.addInt(seconds);
Broadcast.toAllOnlinePlayers(sysm);
}
@@ -185,8 +185,8 @@ public class Shutdown extends Thread
{
if (this == getInstance())
{
TimeCounter tc = new TimeCounter();
TimeCounter tc1 = new TimeCounter();
final TimeCounter tc = new TimeCounter();
final TimeCounter tc1 = new TimeCounter();
try
{
@@ -456,7 +456,7 @@ public class Shutdown extends Thread
_secondsShut--;
int delay = 1000; // milliseconds
final int delay = 1000; // milliseconds
Thread.sleep(delay);
if (_shutdownMode == ABORT)
@@ -490,7 +490,7 @@ public class Shutdown extends Thread
}
TimeCounter tc = new TimeCounter();
final TimeCounter tc = new TimeCounter();
// Save all raidboss and GrandBoss status ^_^
RaidBossSpawnManager.getInstance().cleanUp();
@@ -571,7 +571,7 @@ public class Shutdown extends Thread
// Logout Character
try
{
L2GameClient client = player.getClient();
final L2GameClient client = player.getClient();
if ((client != null) && !client.isDetached())
{
client.close(ServerClose.STATIC_PACKET);

View File

@@ -88,7 +88,7 @@ public class ThreadPoolManager
{
_r.run();
}
catch (final Throwable e)
catch (Throwable e)
{
final Thread t = Thread.currentThread();
final UncaughtExceptionHandler h = t.getUncaughtExceptionHandler();
@@ -633,7 +633,7 @@ public class ThreadPoolManager
@Override
public Thread newThread(Runnable r)
{
Thread t = new Thread(_group, r, _name + "-" + _threadNumber.getAndIncrement());
final Thread t = new Thread(_group, r, _name + "-" + _threadNumber.getAndIncrement());
t.setPriority(_prio);
return t;
}
@@ -690,12 +690,12 @@ public class ThreadPoolManager
public String getPacketStats()
{
final StringBuilder sb = new StringBuilder(1000);
ThreadFactory tf = _generalPacketsThreadPool.getThreadFactory();
final ThreadFactory tf = _generalPacketsThreadPool.getThreadFactory();
if (tf instanceof PriorityThreadFactory)
{
PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
int count = ptf.getGroup().activeCount();
Thread[] threads = new Thread[count + 2];
final PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
final int count = ptf.getGroup().activeCount();
final Thread[] threads = new Thread[count + 2];
ptf.getGroup().enumerate(threads);
StringUtil.append(sb, "General Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalPacketsThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
for (Thread t : threads)
@@ -721,13 +721,13 @@ public class ThreadPoolManager
public String getIOPacketStats()
{
final StringBuilder sb = new StringBuilder(1000);
ThreadFactory tf = _ioPacketsThreadPool.getThreadFactory();
final ThreadFactory tf = _ioPacketsThreadPool.getThreadFactory();
if (tf instanceof PriorityThreadFactory)
{
PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
int count = ptf.getGroup().activeCount();
Thread[] threads = new Thread[count + 2];
final PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
final int count = ptf.getGroup().activeCount();
final Thread[] threads = new Thread[count + 2];
ptf.getGroup().enumerate(threads);
StringUtil.append(sb, "I/O Packet Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_ioPacketsThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);
@@ -755,13 +755,13 @@ public class ThreadPoolManager
public String getGeneralStats()
{
final StringBuilder sb = new StringBuilder(1000);
ThreadFactory tf = _generalThreadPool.getThreadFactory();
final ThreadFactory tf = _generalThreadPool.getThreadFactory();
if (tf instanceof PriorityThreadFactory)
{
PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
int count = ptf.getGroup().activeCount();
Thread[] threads = new Thread[count + 2];
final PriorityThreadFactory ptf = (PriorityThreadFactory) tf;
final int count = ptf.getGroup().activeCount();
final Thread[] threads = new Thread[count + 2];
ptf.getGroup().enumerate(threads);
StringUtil.append(sb, "General Thread Pool:" + Config.EOL + "Tasks in the queue: ", String.valueOf(_generalThreadPool.getQueue().size()), Config.EOL + "Showing threads stack trace:" + Config.EOL + "There should be ", String.valueOf(count), " Threads" + Config.EOL);

View File

@@ -93,7 +93,7 @@ public abstract class AbstractAI implements Ctrl
return;
}
L2Character followTarget = _followTarget; // copy to prevent NPE
final L2Character followTarget = _followTarget; // copy to prevent NPE
if (followTarget == null)
{
if (_actor instanceof L2Summon)
@@ -660,7 +660,7 @@ public abstract class AbstractAI implements Ctrl
{
if (_actor instanceof L2Summon)
{
L2Summon summon = (L2Summon) _actor;
final L2Summon summon = (L2Summon) _actor;
if (summon.getOwner() != null)
{
summon.getOwner().getAI().setAutoAttacking(isAutoAttacking);
@@ -678,7 +678,7 @@ public abstract class AbstractAI implements Ctrl
{
if (_actor instanceof L2Summon)
{
L2Summon summon = (L2Summon) _actor;
final L2Summon summon = (L2Summon) _actor;
if (summon.getOwner() != null)
{
summon.getOwner().getAI().clientStartAutoAttack();
@@ -711,7 +711,7 @@ public abstract class AbstractAI implements Ctrl
{
if (_actor instanceof L2Summon)
{
L2Summon summon = (L2Summon) _actor;
final L2Summon summon = (L2Summon) _actor;
if (summon.getOwner() != null)
{
summon.getOwner().getAI().clientStopAutoAttack();
@@ -739,7 +739,7 @@ public abstract class AbstractAI implements Ctrl
protected void clientNotifyDead()
{
// Send a Server->Client packet Die to the actor and all L2PcInstance in its _knownPlayers
Die msg = new Die(_actor);
final Die msg = new Die(_actor);
_actor.broadcastPacket(msg);
// Init AI

View File

@@ -338,7 +338,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if ((intention == AI_INTENTION_IDLE) || (intention == AI_INTENTION_ACTIVE))
{
// Check if actor is not dead
L2Attackable npc = getActiveChar();
final L2Attackable npc = getActiveChar();
if (!npc.isAlikeDead())
{
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
@@ -466,7 +466,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
*/
protected void thinkActive()
{
L2Attackable npc = getActiveChar();
final L2Attackable npc = getActiveChar();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
@@ -486,7 +486,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (_globalAggro >= 0)
{
// Get all visible objects inside its Aggro Range
Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
{
@@ -494,7 +494,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
continue;
}
L2Character target = (L2Character) obj;
final L2Character target = (L2Character) obj;
// For each L2Character check if the target is autoattackable
if (autoAttackCondition(target)) // check aggression
@@ -509,7 +509,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int hating = npc.getHating(target);
final int hating = npc.getHating(target);
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
if (hating == 0)
@@ -534,7 +534,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if ((hated != null) && !npc.isCoreAIDisabled())
{
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int aggro = npc.getHating(hated);
final int aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0)
{
@@ -681,12 +681,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Calculate the distance between the current position of the L2Character and the target (x,y)
double distance2 = npc.calculateDistance(x1, y1, 0, false, true);
final double distance2 = npc.calculateDistance(x1, y1, 0, false, true);
if (distance2 > ((range + range) * (range + range)))
{
npc.setisReturningToSpawnPoint(true);
float delay = (float) Math.sqrt(distance2) / range;
final float delay = (float) Math.sqrt(distance2) / range;
x1 = npc.getX() + (int) ((x1 - npc.getX()) / delay);
y1 = npc.getY() + (int) ((y1 - npc.getY()) / delay);
}
@@ -709,7 +709,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
else
{
int deltaX = Rnd.nextInt(range * 2); // x
final int deltaX = Rnd.nextInt(range * 2); // x
int deltaY = Rnd.get(deltaX, range * 2); // distance
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
x1 = (deltaX + x1) - range;
@@ -741,7 +741,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
return;
}
L2Character originalAttackTarget = getAttackTarget();
final L2Character originalAttackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead())
{
@@ -774,7 +774,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
// Handle all L2Object of its Faction inside the Faction Range
Set<Integer> clans = getActiveChar().getTemplate().getClans();
final Set<Integer> clans = getActiveChar().getTemplate().getClans();
if ((clans != null) && !clans.isEmpty())
{
final int factionRange = npc.getTemplate().getClanHelpRange() + collision;
@@ -785,7 +785,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
if (obj instanceof L2Npc)
{
L2Npc called = (L2Npc) obj;
final L2Npc called = (L2Npc) obj;
if (!getActiveChar().getTemplate().isClan(called.getTemplate().getClans()))
{
@@ -826,7 +826,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// Initialize data
L2Character mostHate = npc.getMostHated();
final L2Character mostHate = npc.getMostHated();
if (mostHate == null)
{
setIntention(AI_INTENTION_ACTIVE);
@@ -884,7 +884,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (!npc.isInsideRadius(newX, newY, 0, collision, false, false))
{
int newZ = npc.getZ() + 30;
final int newZ = npc.getZ() + 30;
if (GeoData.getInstance().canMove(npc.getX(), npc.getY(), npc.getZ(), newX, newY, newZ, npc.getInstanceId()))
{
moveTo(newX, newY, newZ);
@@ -900,12 +900,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (Rnd.get(100) <= npc.getDodge())
{
// Micht: kepping this one otherwise we should do 2 sqrt
double distance2 = npc.calculateDistance(mostHate, false, true);
final double distance2 = npc.calculateDistance(mostHate, false, true);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
{
int posX = npc.getX();
int posY = npc.getY();
int posZ = npc.getZ() + 30;
final int posZ = npc.getZ() + 30;
if (originalAttackTarget.getX() < posX)
{
@@ -970,7 +970,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
if (_chaosTime > Config.GRAND_CHAOS_TIME)
{
double chaosRate = 100 - ((npc.getCurrentHp() * 300) / npc.getMaxHp());
final double chaosRate = 100 - ((npc.getCurrentHp() * 300) / npc.getMaxHp());
if (((chaosRate <= 10) && (Rnd.get(100) <= 10)) || ((chaosRate > 10) && (Rnd.get(100) <= chaosRate)))
{
aggroReconsider();
@@ -1004,7 +1004,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
double percentage = (npc.getCurrentHp() / npc.getMaxHp()) * 100;
if (npc.isMinion())
{
L2Character leader = npc.getLeader();
final L2Character leader = npc.getLeader();
if ((leader != null) && !leader.isDead() && (Rnd.get(100) > ((leader.getCurrentHp() / leader.getMaxHp()) * 100)))
{
for (Skill healSkill : aiHealSkills)
@@ -1113,7 +1113,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
if (npc.isMinion())
{
L2Character leader = npc.getLeader();
final L2Character leader = npc.getLeader();
if ((leader != null) && leader.isDead())
{
for (Skill sk : aiResSkills)
@@ -1163,7 +1163,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
continue;
}
L2Attackable targets = ((L2Attackable) obj);
final L2Attackable targets = ((L2Attackable) obj);
if (!npc.isInMyClan(targets))
{
continue;
@@ -1198,8 +1198,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
}
double dist = npc.calculateDistance(mostHate, false, false);
int dist2 = (int) dist - collision;
final double dist = npc.calculateDistance(mostHate, false, false);
final int dist2 = (int) dist - collision;
int range = npc.getPhysicalAttackRange() + combinedCollision;
if (mostHate.isMoving())
{
@@ -1300,10 +1300,10 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
return false;
}
double dist = caster.calculateDistance(attackTarget, false, false);
final double dist = caster.calculateDistance(attackTarget, false, false);
double dist2 = dist - attackTarget.getTemplate().getCollisionRadius();
double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
final double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
if (attackTarget.isMoving())
{
dist2 = dist2 - 30;
@@ -1329,7 +1329,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
if (sk.getTargetType() == L2TargetType.ONE)
{
L2Character target = effectTargetReconsider(sk, true);
final L2Character target = effectTargetReconsider(sk, true);
if (target != null)
{
clientStopMoving(null);
@@ -1376,7 +1376,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
else if (sk.getTargetType() == L2TargetType.ONE)
{
L2Character target = effectTargetReconsider(sk, false);
final L2Character target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1397,7 +1397,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
caster.doCast(sk);
return true;
}
L2Character target = effectTargetReconsider(sk, false);
final L2Character target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1430,7 +1430,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
double percentage = (caster.getCurrentHp() / caster.getMaxHp()) * 100;
if (caster.isMinion() && (sk.getTargetType() != L2TargetType.SELF))
{
L2Character leader = caster.getLeader();
final L2Character leader = caster.getLeader();
if ((leader != null) && !leader.isDead() && (Rnd.get(100) > ((leader.getCurrentHp() / leader.getMaxHp()) * 100)))
{
if (!Util.checkIfInRange((sk.getCastRange() + caster.getTemplate().getCollisionRadius() + leader.getTemplate().getCollisionRadius()), caster, leader, false) && !isParty(sk) && !caster.isMovementDisabled())
@@ -1466,7 +1466,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
continue;
}
L2Attackable targets = ((L2Attackable) obj);
final L2Attackable targets = ((L2Attackable) obj);
if (!caster.isInMyClan(targets))
{
continue;
@@ -1495,7 +1495,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
continue;
}
L2Npc targets = ((L2Npc) obj);
final L2Npc targets = ((L2Npc) obj);
if (targets.isInMyClan(caster))
{
if ((obj.getCurrentHp() < obj.getMaxHp()) && (Rnd.get(100) <= 20))
@@ -1522,7 +1522,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
return true;
}
L2Character target = skillTargetReconsider(sk);
final L2Character target = skillTargetReconsider(sk);
if (target != null)
{
clientStopMoving(null);
@@ -1557,7 +1557,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
}
L2Character target = effectTargetReconsider(sk, false);
final L2Character target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1610,7 +1610,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
else if (sk.getTargetType() == L2TargetType.ONE)
{
L2Character target = effectTargetReconsider(sk, false);
final L2Character target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1648,7 +1648,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
else if (sk.getTargetType() == L2TargetType.ONE)
{
L2Character target = effectTargetReconsider(sk, false);
final L2Character target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1664,7 +1664,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
if (caster.isMinion() && (sk.getTargetType() != L2TargetType.SELF))
{
L2Character leader = caster.getLeader();
final L2Character leader = caster.getLeader();
if (leader != null)
{
if (leader.isDead())
@@ -1692,7 +1692,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
continue;
}
L2Attackable targets = ((L2Attackable) obj);
final L2Attackable targets = ((L2Attackable) obj);
if (!caster.isInMyClan(targets))
{
continue;
@@ -1719,7 +1719,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
continue;
}
L2Npc targets = ((L2Npc) obj);
final L2Npc targets = ((L2Npc) obj);
if (caster.isInMyClan(targets))
{
if ((obj.getCurrentHp() < obj.getMaxHp()) && (Rnd.get(100) <= 20))
@@ -1745,7 +1745,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
return true;
}
L2Character target = skillTargetReconsider(sk);
final L2Character target = skillTargetReconsider(sk);
if (target != null)
{
clientStopMoving(null);
@@ -1797,7 +1797,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
// -------------------------------------------------------------
// Try to stop the target or disable the target as priority
int random = Rnd.get(100);
final int random = Rnd.get(100);
if (!getAttackTarget().isImmobilized() && (random < 2))
{
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.IMMOBILIZE))
@@ -2020,7 +2020,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
{
return null;
}
L2Attackable actor = getActiveChar();
final L2Attackable actor = getActiveChar();
if (!sk.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
{
if (!positive)
@@ -2107,7 +2107,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
continue;
}
L2Attackable targets = ((L2Attackable) obj);
final L2Attackable targets = ((L2Attackable) obj);
if (targets.isInMyClan(actor))
{
continue;
@@ -2187,7 +2187,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
double dist = 0;
double dist2 = 0;
int range = 0;
L2Attackable actor = getActiveChar();
final L2Attackable actor = getActiveChar();
if (actor.getHateList() != null)
{
for (L2Character obj : actor.getHateList())
@@ -2218,7 +2218,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (!(actor instanceof L2GuardInstance))
{
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
for (L2Object target : objs)
{
try
@@ -2274,8 +2274,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
double dist = 0;
double dist2 = 0;
int range = 0;
L2Attackable actor = getActiveChar();
L2Character MostHate = actor.getMostHated();
final L2Attackable actor = getActiveChar();
final L2Character MostHate = actor.getMostHated();
if (actor.getHateList() != null)
{
for (L2Character obj : actor.getHateList())
@@ -2317,7 +2317,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
if (!(actor instanceof L2GuardInstance))
{
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
for (L2Object target : objs)
{
L2Character obj = null;
@@ -2384,12 +2384,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
private void aggroReconsider()
{
L2Attackable actor = getActiveChar();
L2Character MostHate = actor.getMostHated();
final L2Attackable actor = getActiveChar();
final L2Character MostHate = actor.getMostHated();
if (actor.getHateList() != null)
{
int rand = Rnd.get(actor.getHateList().size());
final int rand = Rnd.get(actor.getHateList().size());
int count = 0;
for (L2Character obj : actor.getHateList())
{
@@ -2428,7 +2428,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
if (!(actor instanceof L2GuardInstance))
{
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
for (L2Object target : objs)
{
L2Character obj = null;
@@ -2551,7 +2551,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
@Override
protected void onEvtAttacked(L2Character attacker)
{
L2Attackable me = getActiveChar();
final L2Attackable me = getActiveChar();
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();

View File

@@ -746,7 +746,7 @@ public class L2CharacterAI extends AbstractAI
if (_actor instanceof L2Npc)
{
L2Npc npc = (L2Npc) _actor;
final L2Npc npc = (L2Npc) _actor;
WalkingManager.getInstance().onArrived(npc); // Walking Manager support
// Notify to scripts
@@ -962,11 +962,11 @@ public class L2CharacterAI extends AbstractAI
@Override
protected void onEvtAfraid(L2Character effector, boolean start)
{
double radians = Math.toRadians(start ? Util.calculateAngleFrom(effector, _actor) : Util.convertHeadingToDegree(_actor.getHeading()));
final double radians = Math.toRadians(start ? Util.calculateAngleFrom(effector, _actor) : Util.convertHeadingToDegree(_actor.getHeading()));
int posX = (int) (_actor.getX() + (FEAR_RANGE * Math.cos(radians)));
int posY = (int) (_actor.getY() + (FEAR_RANGE * Math.sin(radians)));
int posZ = _actor.getZ();
final int posX = (int) (_actor.getX() + (FEAR_RANGE * Math.cos(radians)));
final int posY = (int) (_actor.getY() + (FEAR_RANGE * Math.sin(radians)));
final int posZ = _actor.getZ();
if (!_actor.isPet())
{
@@ -1016,13 +1016,13 @@ public class L2CharacterAI extends AbstractAI
int x = _actor.getX();
int y = _actor.getY();
double dx = worldPosition.getX() - x;
double dy = worldPosition.getY() - y;
final double dx = worldPosition.getX() - x;
final double dy = worldPosition.getY() - y;
double dist = Math.sqrt((dx * dx) + (dy * dy));
double sin = dy / dist;
double cos = dx / dist;
final double sin = dy / dist;
final double cos = dx / dist;
dist -= offset - 5;
@@ -1080,7 +1080,7 @@ public class L2CharacterAI extends AbstractAI
if (target.isDoor())
{
L2DoorInstance dor = (L2DoorInstance) target;
final L2DoorInstance dor = (L2DoorInstance) target;
int xPoint = 0;
int yPoint = 0;
for (int i : dor.getTemplate().getNodeX())
@@ -1229,7 +1229,7 @@ public class L2CharacterAI extends AbstractAI
// check if player is fakedeath
if (target instanceof L2PcInstance)
{
L2PcInstance target2 = (L2PcInstance) target; // convert object to chara
final L2PcInstance target2 = (L2PcInstance) target; // convert object to chara
if (target2.isFakeDeath())
{
@@ -1326,7 +1326,7 @@ public class L2CharacterAI extends AbstractAI
{
continue;
}
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
boolean hasLongRangeDamageSkill = false;
if (sk.isContinuous())
@@ -1475,7 +1475,7 @@ public class L2CharacterAI extends AbstractAI
}
else
{
L2Weapon weapon = target.getActiveWeaponItem();
final L2Weapon weapon = target.getActiveWeaponItem();
if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW)))
{
isArcher = true;
@@ -1538,7 +1538,7 @@ public class L2CharacterAI extends AbstractAI
}
if (target instanceof L2Attackable)
{
L2Npc actors = ((L2Npc) _actor);
final L2Npc actors = ((L2Npc) _actor);
if (!actors.isChaos())
{
@@ -1567,7 +1567,7 @@ public class L2CharacterAI extends AbstractAI
}
if (target instanceof L2Attackable)
{
L2Npc actors = ((L2Npc) _actor);
final L2Npc actors = ((L2Npc) _actor);
if (!actors.isChaos())
{
@@ -1599,7 +1599,7 @@ public class L2CharacterAI extends AbstractAI
}
if (target instanceof L2Attackable)
{
L2Npc actors = ((L2Npc) _actor);
final L2Npc actors = ((L2Npc) _actor);
if (!actors.isChaos())
{
@@ -1629,7 +1629,7 @@ public class L2CharacterAI extends AbstractAI
if (target instanceof L2Attackable)
{
L2Npc actors = ((L2Npc) _actor);
final L2Npc actors = ((L2Npc) _actor);
if (!actors.isChaos())
{
continue;
@@ -1662,8 +1662,8 @@ public class L2CharacterAI extends AbstractAI
{
continue;
}
L2Npc targets = ((L2Npc) target);
L2Npc actors = ((L2Npc) _actor);
final L2Npc targets = ((L2Npc) target);
final L2Npc actors = ((L2Npc) _actor);
if (targets.isInMyClan(actors))
{
count++;

View File

@@ -69,14 +69,14 @@ public final class L2ControllableMobAI extends L2AttackableAI
protected void thinkFollow()
{
L2Attackable me = (L2Attackable) _actor;
final L2Attackable me = (L2Attackable) _actor;
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
@@ -135,7 +135,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
@Override
protected void thinkCast()
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
if ((getAttackTarget() == null) || getAttackTarget().isAlikeDead())
{
setAttackTarget(findNextRndTarget());
@@ -176,7 +176,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
protected void thinkAttackGroup()
{
L2Character target = getForcedTarget();
final L2Character target = getForcedTarget();
if ((target == null) || target.isAlikeDead())
{
// try to get next group target
@@ -191,12 +191,12 @@ public final class L2ControllableMobAI extends L2AttackableAI
_actor.setTarget(target);
// as a response, we put the target in a forced attack mode
L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
final L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
final L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
ctrlAi.forceAttack(_actor);
double dist2 = _actor.calculateDistance(target, false, true);
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
final double dist2 = _actor.calculateDistance(target, false, true);
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
int max_range = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
@@ -204,7 +204,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
// check distant skills
for (Skill sk : _actor.getAllSkills())
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
@@ -235,8 +235,8 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
_actor.setTarget(getForcedTarget());
double dist2 = _actor.calculateDistance(getForcedTarget(), false, true);
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
final double dist2 = _actor.calculateDistance(getForcedTarget(), false, true);
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
int max_range = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
@@ -244,7 +244,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
// check distant skills
for (Skill sk : _actor.getAllSkills())
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
@@ -274,7 +274,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
if (getAttackTarget() != null)
{
// stop hating
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
npc.stopHating(getAttackTarget());
}
@@ -285,7 +285,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
// notify aggression
if (((L2Npc) _actor).getTemplate().getClans() != null)
{
Collection<L2Object> objs = _actor.getKnownList().getKnownObjects().values();
final Collection<L2Object> objs = _actor.getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
{
if (!(obj instanceof L2Npc))
@@ -293,7 +293,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
continue;
}
L2Npc npc = (L2Npc) obj;
final L2Npc npc = (L2Npc) obj;
if (!npc.isInMyClan((L2Npc) _actor))
{
@@ -308,8 +308,8 @@ public final class L2ControllableMobAI extends L2AttackableAI
}
_actor.setTarget(getAttackTarget());
double dist2 = _actor.calculateDistance(getAttackTarget(), false, true);
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
final double dist2 = _actor.calculateDistance(getAttackTarget(), false, true);
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
int max_range = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
@@ -317,7 +317,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
// check distant skills
for (Skill sk : _actor.getAllSkills())
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
@@ -359,7 +359,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
{
for (Skill sk : _actor.getAllSkills())
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() < _actor.getStat().getMpConsume(sk)))
{

View File

@@ -160,7 +160,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
// Get the owner if the target is a summon
if (target instanceof L2Summon)
{
L2PcInstance owner = ((L2Summon) target).getOwner();
final L2PcInstance owner = ((L2Summon) target).getOwner();
if (_actor.isInsideRadius(owner, 1000, true, false))
{
target = owner;
@@ -201,7 +201,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
// Check if actor is not dead
if (!_actor.isAlikeDead())
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (!npc.getKnownList().getKnownPlayers().isEmpty())
@@ -269,7 +269,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
*/
private void thinkActive()
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
@@ -297,7 +297,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
if (autoAttackCondition(target)) // check aggression
{
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int hating = npc.getHating(target);
final int hating = npc.getHating(target);
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
if (hating == 0)
@@ -323,7 +323,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
if (hated != null)
{
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int aggro = npc.getHating(hated);
final int aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0)
{
@@ -386,14 +386,14 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
}
}
L2Character attackTarget = getAttackTarget();
final L2Character attackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
{
// Stop hating this target after the attack timeout or if target is dead
if (attackTarget != null)
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
npc.stopHating(attackTarget);
}
@@ -414,7 +414,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
private final void factionNotifyAndSupport()
{
L2Character target = getAttackTarget();
final L2Character target = getAttackTarget();
// Call all L2Object of its Faction inside the Faction Range
if ((((L2Npc) _actor).getTemplate().getClans() == null) || (target == null))
{
@@ -457,7 +457,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
int chance = 5;
final int chance = 5;
if (chance >= Rnd.get(100))
{
continue;
@@ -467,7 +467,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
break;
}
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
_actor.setTarget(cha);
clientStopMoving(null);
_actor.doCast(sk);
@@ -479,7 +479,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
L2Npc npc = (L2Npc) cha;
final L2Npc npc = (L2Npc) cha;
if (!npc.isInMyClan((L2Npc) _actor))
{
@@ -516,7 +516,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
int chance = 4;
final int chance = 4;
if (chance >= Rnd.get(100))
{
continue;
@@ -526,7 +526,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
break;
}
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
_actor.setTarget(npc);
clientStopMoving(null);
_actor.doCast(sk);
@@ -600,12 +600,12 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
// check for long ranged skills and heal/buff skills
for (Skill sk : skills)
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
{
boolean useSkillSelf = true;
@@ -643,11 +643,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
}
else
{
double dx = _actor.getX() - attackTarget.getX();
double dy = _actor.getY() - attackTarget.getY();
double dz = _actor.getZ() - attackTarget.getZ();
double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
final double dx = _actor.getX() - attackTarget.getX();
final double dy = _actor.getY() - attackTarget.getY();
final double dz = _actor.getZ() - attackTarget.getZ();
final double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
final double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
// Check if the L2SiegeGuardInstance isn't too far from it's home location
if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
@@ -693,7 +693,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
{
// Temporary hack for preventing guards jumping off towers,
// before replacing this with effective geodata checks and AI modification
double dz = _actor.getZ() - attackTarget.getZ();
final double dz = _actor.getZ() - attackTarget.getZ();
if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
{
if (_selfAnalysis.isMage)
@@ -746,11 +746,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
{
for (Skill sk : skills)
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
{
boolean useSkillSelf = true;
@@ -876,7 +876,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
{
return;
}
L2Attackable me = (L2Attackable) _actor;
final L2Attackable me = (L2Attackable) _actor;
if (target != null)
{
@@ -915,8 +915,8 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
{
sGuard = (L2DefenderInstance) _actor;
}
double homeX = target.getX() - sGuard.getSpawn().getX();
double homeY = target.getY() - sGuard.getSpawn().getY();
final double homeX = target.getX() - sGuard.getSpawn().getX();
final double homeY = target.getY() - sGuard.getSpawn().getY();
// Check if the L2SiegeGuardInstance is not too far from its home location
if (((homeX * homeX) + (homeY * homeY)) < 3240000)
@@ -933,7 +933,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
return;
}
L2Character mostHated = me.getMostHated();
final L2Character mostHated = me.getMostHated();
if (mostHated == null)
{
_globalAggro = -25;

View File

@@ -134,7 +134,7 @@ public class L2PlayerAI extends L2PlayableAI
{
// run interrupted or next intention
IntentionCommand nextIntention = _nextIntention;
final IntentionCommand nextIntention = _nextIntention;
if (nextIntention != null)
{
if (nextIntention._crtlIntention != AI_INTENTION_CAST) // previous state shouldn't be casting
@@ -230,7 +230,7 @@ public class L2PlayerAI extends L2PlayableAI
private void thinkAttack()
{
L2Character target = getAttackTarget();
final L2Character target = getAttackTarget();
if (target == null)
{
return;
@@ -251,7 +251,7 @@ public class L2PlayerAI extends L2PlayableAI
private void thinkCast()
{
L2Character target = getCastTarget();
final L2Character target = getCastTarget();
if ((_skill.getTargetType() == L2TargetType.GROUND) && (_actor instanceof L2PcInstance))
{
if (maybeMoveToPosition(((L2PcInstance) _actor).getCurrentSkillWorldPosition(), _actor.getMagicalAttackRange(_skill)))
@@ -293,7 +293,7 @@ public class L2PlayerAI extends L2PlayableAI
{
return;
}
L2Object target = getTarget();
final L2Object target = getTarget();
if (checkTargetLost(target))
{
return;
@@ -312,7 +312,7 @@ public class L2PlayerAI extends L2PlayableAI
{
return;
}
L2Object target = getTarget();
final L2Object target = getTarget();
if (checkTargetLost(target))
{
return;

View File

@@ -149,7 +149,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
// Get the owner if the target is a summon
if (target instanceof L2Summon)
{
L2PcInstance owner = ((L2Summon) target).getOwner();
final L2PcInstance owner = ((L2Summon) target).getOwner();
if (_actor.isInsideRadius(owner, 1000, true, false))
{
target = owner;
@@ -190,7 +190,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
// Check if actor is not dead
if (!_actor.isAlikeDead())
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (!npc.getKnownList().getKnownPlayers().isEmpty())
@@ -258,7 +258,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
*/
private void thinkActive()
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
@@ -286,7 +286,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
if (autoAttackCondition(target)) // check aggression
{
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int hating = npc.getHating(target);
final int hating = npc.getHating(target);
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
if (hating == 0)
@@ -312,7 +312,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
if (hated != null)
{
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
int aggro = npc.getHating(hated);
final int aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0)
{
@@ -365,14 +365,14 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
}
L2Character attackTarget = getAttackTarget();
final L2Character attackTarget = getAttackTarget();
// Check if target is dead or if timeout is expired to stop this attack
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
{
// Stop hating this target after the attack timeout or if target is dead
if (attackTarget != null)
{
L2Attackable npc = (L2Attackable) _actor;
final L2Attackable npc = (L2Attackable) _actor;
npc.stopHating(attackTarget);
}
@@ -393,7 +393,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
private final void factionNotifyAndSupport()
{
L2Character target = getAttackTarget();
final L2Character target = getAttackTarget();
// Call all L2Object of its Faction inside the Faction Range
if ((((L2Npc) _actor).getTemplate().getClans() == null) || (target == null))
{
@@ -436,7 +436,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
int chance = 5;
final int chance = 5;
if (chance >= Rnd.get(100))
{
continue;
@@ -446,7 +446,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
break;
}
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
_actor.setTarget(cha);
clientStopMoving(null);
_actor.doCast(sk);
@@ -458,7 +458,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
L2Npc npc = (L2Npc) cha;
final L2Npc npc = (L2Npc) cha;
if (!npc.isInMyClan((L2Npc) _actor))
{
@@ -495,7 +495,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
continue;
}
int chance = 4;
final int chance = 4;
if (chance >= Rnd.get(100))
{
continue;
@@ -505,7 +505,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
break;
}
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
_actor.setTarget(npc);
clientStopMoving(null);
_actor.doCast(sk);
@@ -523,7 +523,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
Collection<Skill> skills = null;
double dist_2 = 0;
int range = 0;
L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
final L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
L2Character attackTarget = getAttackTarget();
try
@@ -573,12 +573,12 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
// check for long ranged skills and heal/buff skills
for (Skill sk : skills)
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
{
boolean useSkillSelf = true;
@@ -616,11 +616,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
}
else
{
double dx = _actor.getX() - attackTarget.getX();
double dy = _actor.getY() - attackTarget.getY();
double dz = _actor.getZ() - attackTarget.getZ();
double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
final double dx = _actor.getX() - attackTarget.getX();
final double dy = _actor.getY() - attackTarget.getY();
final double dz = _actor.getZ() - attackTarget.getZ();
final double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
final double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
// Check if the L2SiegeGuardInstance isn't too far from it's home location
if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
@@ -666,7 +666,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
{
// Temporary hack for preventing guards jumping off towers,
// before replacing this with effective geodata checks and AI modification
double dz = _actor.getZ() - attackTarget.getZ();
final double dz = _actor.getZ() - attackTarget.getZ();
if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
{
if (_selfAnalysis.isMage)
@@ -715,11 +715,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
{
for (Skill sk : skills)
{
int castRange = sk.getCastRange();
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
L2Object OldTarget = _actor.getTarget();
final L2Object OldTarget = _actor.getTarget();
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
{
boolean useSkillSelf = true;
@@ -848,7 +848,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
{
return;
}
L2Attackable me = (L2Attackable) _actor;
final L2Attackable me = (L2Attackable) _actor;
if (target != null)
{
@@ -878,9 +878,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
_actor.setRunning();
}
L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
double homeX = target.getX() - sGuard.getSpawn().getX();
double homeY = target.getY() - sGuard.getSpawn().getY();
final L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
final double homeX = target.getX() - sGuard.getSpawn().getX();
final double homeY = target.getY() - sGuard.getSpawn().getY();
// Check if the L2SiegeGuardInstance is not too far from its home location
if (((homeX * homeX) + (homeY * homeY)) < 3240000)
@@ -897,7 +897,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
return;
}
L2Character mostHated = me.getMostHated();
final L2Character mostHated = me.getMostHated();
if (mostHated == null)
{
_globalAggro = -25;

View File

@@ -72,7 +72,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
@Override
protected void onIntentionActive()
{
L2Summon summon = (L2Summon) _actor;
final L2Summon summon = (L2Summon) _actor;
if (_startFollow)
{
setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
@@ -116,13 +116,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
private void thinkCast()
{
L2Summon summon = (L2Summon) _actor;
final L2Summon summon = (L2Summon) _actor;
if (checkTargetLost(getCastTarget()))
{
setCastTarget(null);
return;
}
boolean val = _startFollow;
final boolean val = _startFollow;
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
{
return;

View File

@@ -120,13 +120,13 @@ public class HtmCache
BufferedInputStream bis = new BufferedInputStream(fis))
{
final int bytes = bis.available();
byte[] raw = new byte[bytes];
final byte[] raw = new byte[bytes];
bis.read(raw);
content = new String(raw, "UTF-8");
content = content.replaceAll("(?s)<!--.*?-->", ""); // Remove html comments
String oldContent = _cache.put(relpath, content);
final String oldContent = _cache.put(relpath, content);
if (oldContent == null)
{
_bytesBuffLen += bytes;

View File

@@ -53,7 +53,7 @@ public class WarehouseCacheManager
@Override
public void run()
{
long cTime = System.currentTimeMillis();
final long cTime = System.currentTimeMillis();
for (L2PcInstance pc : _cachedWh.keySet())
{
if ((cTime - _cachedWh.get(pc)) > _cacheTime)

View File

@@ -122,7 +122,7 @@ public final class Forum
{
while (rs.next())
{
Topic t = new Topic(Topic.ConstructorType.RESTORE, rs.getInt("topic_id"), rs.getInt("topic_forum_id"), rs.getString("topic_name"), rs.getLong("topic_date"), rs.getString("topic_ownername"), rs.getInt("topic_ownerid"), rs.getInt("topic_type"), rs.getInt("topic_reply"));
final Topic t = new Topic(Topic.ConstructorType.RESTORE, rs.getInt("topic_id"), rs.getInt("topic_forum_id"), rs.getString("topic_name"), rs.getLong("topic_date"), rs.getString("topic_ownername"), rs.getInt("topic_ownerid"), rs.getInt("topic_type"), rs.getInt("topic_reply"));
_topic.put(t.getID(), t);
if (t.getID() > TopicBBSManager.getInstance().getMaxID(this))
{

View File

@@ -155,7 +155,7 @@ public class Post
*/
public void updatetxt(int i)
{
CPost cp = getCPost(i);
final CPost cp = getCPost(i);
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{

View File

@@ -58,7 +58,7 @@ public abstract class BaseBBSManager
*/
protected void send1002(L2PcInstance activeChar, String string, String string2, String string3)
{
List<String> _arg = new ArrayList<>();
final List<String> _arg = new ArrayList<>();
_arg.add("0");
_arg.add("0");
_arg.add("0");

View File

@@ -47,8 +47,8 @@ public class ForumsBBSManager extends BaseBBSManager
{
while (rs.next())
{
int forumId = rs.getInt("forum_id");
Forum f = new Forum(forumId, null);
final int forumId = rs.getInt("forum_id");
final Forum f = new Forum(forumId, null);
addForum(f);
}
}
@@ -112,7 +112,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public Forum createNewForum(String name, Forum parent, int type, int perm, int oid)
{
Forum forum = new Forum(name, parent, type, perm, oid);
final Forum forum = new Forum(name, parent, type, perm, oid);
forum.insertIntoDb();
return forum;
}

View File

@@ -66,11 +66,11 @@ public class PostBBSManager extends BaseBBSManager
{
if (command.startsWith("_bbsposts;read;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int idf = Integer.parseInt(st.nextToken());
int idp = Integer.parseInt(st.nextToken());
final int idf = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
String index = null;
if (st.hasMoreTokens())
{
@@ -90,12 +90,12 @@ public class PostBBSManager extends BaseBBSManager
}
else if (command.startsWith("_bbsposts;edit;"))
{
StringTokenizer st = new StringTokenizer(command, ";");
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int idf = Integer.parseInt(st.nextToken());
int idt = Integer.parseInt(st.nextToken());
int idp = Integer.parseInt(st.nextToken());
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
showEditPost((TopicBBSManager.getInstance().getTopicByID(idt)), ForumsBBSManager.getInstance().getForumByID(idf), activeChar, idp);
}
else
@@ -149,9 +149,9 @@ public class PostBBSManager extends BaseBBSManager
private void showMemoPost(Topic topic, L2PcInstance activeChar, Forum forum)
{
Post p = getGPosttByTopic(topic);
Locale locale = Locale.getDefault();
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
final Post p = getGPosttByTopic(topic);
final Locale locale = Locale.getDefault();
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
String mes = p.getCPost(0).postTxt.replace(">", "&gt;");
mes = mes.replace("<", "&lt;");
@@ -163,19 +163,19 @@ public class PostBBSManager extends BaseBBSManager
@Override
public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
{
StringTokenizer st = new StringTokenizer(ar1, ";");
int idf = Integer.parseInt(st.nextToken());
int idt = Integer.parseInt(st.nextToken());
int idp = Integer.parseInt(st.nextToken());
final StringTokenizer st = new StringTokenizer(ar1, ";");
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
Forum f = ForumsBBSManager.getInstance().getForumByID(idf);
final Forum f = ForumsBBSManager.getInstance().getForumByID(idf);
if (f == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + idf + " does not exist !</center><br><br></body></html>", activeChar);
}
else
{
Topic t = f.getTopic(idt);
final Topic t = f.getTopic(idt);
if (t == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the topic: " + idt + " does not exist !</center><br><br></body></html>", activeChar);

View File

@@ -62,7 +62,7 @@ public class TopicBBSManager extends BaseBBSManager
public int getMaxID(Forum f)
{
Integer i = _maxId.get(f);
final Integer i = _maxId.get(f);
if (i == null)
{
return 0;
@@ -87,7 +87,7 @@ public class TopicBBSManager extends BaseBBSManager
{
if (ar1.equals("crea"))
{
Forum f = ForumsBBSManager.getInstance().getForumByID(Integer.parseInt(ar2));
final Forum f = ForumsBBSManager.getInstance().getForumByID(Integer.parseInt(ar2));
if (f == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + ar2 + " is not implemented yet</center><br><br></body></html>", activeChar);
@@ -95,10 +95,10 @@ public class TopicBBSManager extends BaseBBSManager
else
{
f.vload();
Topic t = new Topic(Topic.ConstructorType.CREATE, TopicBBSManager.getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), activeChar.getName(), activeChar.getObjectId(), Topic.MEMO, 0);
final Topic t = new Topic(Topic.ConstructorType.CREATE, TopicBBSManager.getInstance().getMaxID(f) + 1, Integer.parseInt(ar2), ar5, Calendar.getInstance().getTimeInMillis(), activeChar.getName(), activeChar.getObjectId(), Topic.MEMO, 0);
f.addTopic(t);
TopicBBSManager.getInstance().setMaxID(t.getID(), f);
Post p = new Post(activeChar.getName(), activeChar.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
final Post p = new Post(activeChar.getName(), activeChar.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
PostBBSManager.getInstance().addPostByTopic(p, t);
parsecmd("_bbsmemo", activeChar);
}
@@ -106,14 +106,14 @@ public class TopicBBSManager extends BaseBBSManager
}
else if (ar1.equals("del"))
{
Forum f = ForumsBBSManager.getInstance().getForumByID(Integer.parseInt(ar2));
final Forum f = ForumsBBSManager.getInstance().getForumByID(Integer.parseInt(ar2));
if (f == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + ar2 + " does not exist !</center><br><br></body></html>", activeChar);
}
else
{
Topic t = f.getTopic(Integer.parseInt(ar3));
final Topic t = f.getTopic(Integer.parseInt(ar3));
if (t == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the topic: " + ar3 + " does not exist !</center><br><br></body></html>", activeChar);
@@ -121,7 +121,7 @@ public class TopicBBSManager extends BaseBBSManager
else
{
// CPost cp = null;
Post p = PostBBSManager.getInstance().getGPosttByTopic(t);
final Post p = PostBBSManager.getInstance().getGPosttByTopic(t);
if (p != null)
{
p.deleteme(t);
@@ -146,10 +146,10 @@ public class TopicBBSManager extends BaseBBSManager
}
else if (command.startsWith("_bbstopics;read"))
{
StringTokenizer st = new StringTokenizer(command, ";");
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int idf = Integer.parseInt(st.nextToken());
final int idf = Integer.parseInt(st.nextToken());
String index = null;
if (st.hasMoreTokens())
{
@@ -168,27 +168,27 @@ public class TopicBBSManager extends BaseBBSManager
}
else if (command.startsWith("_bbstopics;crea"))
{
StringTokenizer st = new StringTokenizer(command, ";");
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int idf = Integer.parseInt(st.nextToken());
final int idf = Integer.parseInt(st.nextToken());
showNewTopic(ForumsBBSManager.getInstance().getForumByID(idf), activeChar, idf);
}
else if (command.startsWith("_bbstopics;del"))
{
StringTokenizer st = new StringTokenizer(command, ";");
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
st.nextToken();
int idf = Integer.parseInt(st.nextToken());
int idt = Integer.parseInt(st.nextToken());
Forum f = ForumsBBSManager.getInstance().getForumByID(idf);
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final Forum f = ForumsBBSManager.getInstance().getForumByID(idf);
if (f == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the forum: " + idf + " does not exist !</center><br><br></body></html>", activeChar);
}
else
{
Topic t = f.getTopic(idt);
final Topic t = f.getTopic(idt);
if (t == null)
{
CommunityBoardHandler.separateAndSend("<html><body><br><br><center>the topic: " + idt + " does not exist !</center><br><br></body></html>", activeChar);
@@ -196,7 +196,7 @@ public class TopicBBSManager extends BaseBBSManager
else
{
// CPost cp = null;
Post p = PostBBSManager.getInstance().getGPosttByTopic(t);
final Post p = PostBBSManager.getInstance().getGPosttByTopic(t);
if (p != null)
{
p.deleteme(t);
@@ -263,7 +263,7 @@ public class TopicBBSManager extends BaseBBSManager
{
break;
}
Topic t = forum.getTopic(j);
final Topic t = forum.getTopic(j);
if (t != null)
{
if (i++ >= (12 * (index - 1)))

View File

@@ -192,11 +192,11 @@ public class CharSummonTable
Skill skill;
while (rs.next())
{
int summonObjId = rs.getInt("summonId");
int skillId = rs.getInt("summonSkillId");
int curHp = rs.getInt("curHp");
int curMp = rs.getInt("curMp");
int time = rs.getInt("time");
final int summonObjId = rs.getInt("summonId");
final int skillId = rs.getInt("summonSkillId");
final int curHp = rs.getInt("curHp");
final int curMp = rs.getInt("curMp");
final int time = rs.getInt("time");
skill = SkillData.getInstance().getSkill(skillId, activeChar.getSkillLevel(skillId));
if ((skill == null) || !activeChar.hasServitor(summonObjId))

View File

@@ -88,7 +88,7 @@ public class ClanTable
{
while (rs.next())
{
int clanId = rs.getInt("clan_id");
final int clanId = rs.getInt("clan_id");
_clans.put(clanId, new L2Clan(clanId));
clan = getClan(clanId);
if (clan.getDissolvingExpiryTime() != 0)
@@ -186,14 +186,14 @@ public class ClanTable
if (null != getClanByName(clanName))
{
// clan name is already taken
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ALREADY_EXISTS);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ALREADY_EXISTS);
sm.addString(clanName);
player.sendPacket(sm);
return null;
}
L2Clan clan = new L2Clan(IdFactory.getInstance().getNextId(), clanName);
L2ClanMember leader = new L2ClanMember(clan, player);
final L2Clan clan = new L2Clan(IdFactory.getInstance().getNextId(), clanName);
final L2ClanMember leader = new L2ClanMember(clan, player);
clan.setLeader(leader);
leader.setPlayerInstance(player);
clan.store();
@@ -217,14 +217,14 @@ public class ClanTable
public synchronized void destroyClan(int clanId)
{
L2Clan clan = getClan(clanId);
final L2Clan clan = getClan(clanId);
if (clan == null)
{
return;
}
clan.broadcastToOnlineMembers(SystemMessage.getSystemMessage(SystemMessageId.CLAN_HAS_DISPERSED));
int castleId = clan.getCastleId();
final int castleId = clan.getCastleId();
if (castleId == 0)
{
for (Siege siege : SiegeManager.getInstance().getSieges())
@@ -233,7 +233,7 @@ public class ClanTable
}
}
int fortId = clan.getFortId();
final int fortId = clan.getFortId();
if (fortId == 0)
{
for (FortSiege siege : FortSiegeManager.getInstance().getSieges())
@@ -242,7 +242,7 @@ public class ClanTable
}
}
int hallId = clan.getHideoutId();
final int hallId = clan.getHideoutId();
if (hallId == 0)
{
for (SiegableHall hall : CHSiegeManager.getInstance().getConquerableHalls().values())
@@ -251,13 +251,13 @@ public class ClanTable
}
}
Auction auction = ClanHallAuctionManager.getInstance().getAuction(clan.getAuctionBiddedAt());
final Auction auction = ClanHallAuctionManager.getInstance().getAuction(clan.getAuctionBiddedAt());
if (auction != null)
{
auction.cancelBid(clan.getId());
}
L2ClanMember leaderMember = clan.getLeader();
final L2ClanMember leaderMember = clan.getLeader();
if (leaderMember == null)
{
clan.getWarehouse().destroyAllItems("ClanRemove", null, null);
@@ -325,10 +325,10 @@ public class ClanTable
if (fortId != 0)
{
Fort fort = FortManager.getInstance().getFortById(fortId);
final Fort fort = FortManager.getInstance().getFortById(fortId);
if (fort != null)
{
L2Clan owner = fort.getOwnerClan();
final L2Clan owner = fort.getOwnerClan();
if (clan == owner)
{
fort.removeOwner(true);
@@ -338,7 +338,7 @@ public class ClanTable
if (hallId != 0)
{
SiegableHall hall = CHSiegeManager.getInstance().getSiegableHall(hallId);
final SiegableHall hall = CHSiegeManager.getInstance().getSiegableHall(hallId);
if ((hall != null) && (hall.getOwnerId() == clanId))
{
hall.free();
@@ -424,8 +424,8 @@ public class ClanTable
public void deleteclanswars(int clanId1, int clanId2)
{
L2Clan clan1 = getClan(clanId1);
L2Clan clan2 = getClan(clanId2);
final L2Clan clan1 = getClan(clanId1);
final L2Clan clan2 = getClan(clanId2);
EventDispatcher.getInstance().notifyEventAsync(new OnClanWarFinish(clan1, clan2));
@@ -508,7 +508,7 @@ public class ClanTable
{
for (L2Clan clan : _clans.values())
{
int allyId = clan.getAllyId();
final int allyId = clan.getAllyId();
if ((allyId != 0) && (clan.getId() != allyId))
{
if (!_clans.containsKey(allyId))

View File

@@ -55,7 +55,7 @@ public final class CrestTable
public synchronized void load()
{
_crests.clear();
Set<Integer> crestsInUse = new HashSet<>();
final Set<Integer> crestsInUse = new HashSet<>();
for (L2Clan clan : ClanTable.getInstance().getClans())
{
if (clan.getCrestId() != 0)
@@ -80,7 +80,7 @@ public final class CrestTable
{
while (rs.next())
{
int id = rs.getInt("crest_id");
final int id = rs.getInt("crest_id");
if (_nextId.get() <= id)
{
@@ -95,8 +95,8 @@ public final class CrestTable
continue;
}
byte[] data = rs.getBytes("data");
CrestType crestType = CrestType.getById(rs.getInt("type"));
final byte[] data = rs.getBytes("data");
final CrestType crestType = CrestType.getById(rs.getInt("type"));
if (crestType != null)
{
_crests.put(id, new L2Crest(id, data, crestType));

View File

@@ -99,12 +99,12 @@ public class NpcBufferTable
while (rset.next())
{
int npcId = rset.getInt("npc_id");
int skillId = rset.getInt("skill_id");
int skillLevel = rset.getInt("skill_level");
int skillFeeId = rset.getInt("skill_fee_id");
int skillFeeAmount = rset.getInt("skill_fee_amount");
int buffGroup = rset.getInt("buff_group");
final int npcId = rset.getInt("npc_id");
final int skillId = rset.getInt("skill_id");
final int skillLevel = rset.getInt("skill_level");
final int skillFeeId = rset.getInt("skill_fee_id");
final int skillFeeAmount = rset.getInt("skill_fee_amount");
final int buffGroup = rset.getInt("buff_group");
if (npcId != lastNpcId)
{
@@ -145,12 +145,12 @@ public class NpcBufferTable
NpcBufferSkills skills = null;
while (rset.next())
{
int npcId = rset.getInt("npc_id");
int skillId = rset.getInt("skill_id");
int skillLevel = rset.getInt("skill_level");
int skillFeeId = rset.getInt("skill_fee_id");
int skillFeeAmount = rset.getInt("skill_fee_amount");
int buffGroup = rset.getInt("buff_group");
final int npcId = rset.getInt("npc_id");
final int skillId = rset.getInt("skill_id");
final int skillLevel = rset.getInt("skill_level");
final int skillFeeId = rset.getInt("skill_fee_id");
final int skillFeeAmount = rset.getInt("skill_fee_amount");
final int buffGroup = rset.getInt("buff_group");
if (npcId != lastNpcId)
{

View File

@@ -154,10 +154,10 @@ public class OfflineTradersTable
{
while (rs.next())
{
long time = rs.getLong("time");
final long time = rs.getLong("time");
if (Config.OFFLINE_MAX_DAYS > 0)
{
Calendar cal = Calendar.getInstance();
final Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
cal.add(Calendar.DAY_OF_YEAR, Config.OFFLINE_MAX_DAYS);
if (cal.getTimeInMillis() <= System.currentTimeMillis())
@@ -166,7 +166,7 @@ public class OfflineTradersTable
}
}
PrivateStoreType type = PrivateStoreType.findById(rs.getInt("type"));
final PrivateStoreType type = PrivateStoreType.findById(rs.getInt("type"));
if (type == null)
{
LOGGER.warning(getClass().getSimpleName() + ": PrivateStoreType with id " + rs.getInt("type") + " could not be found.");
@@ -182,7 +182,7 @@ public class OfflineTradersTable
try
{
L2GameClient client = new L2GameClient(null);
final L2GameClient client = new L2GameClient(null);
client.setDetached(true);
player = L2PcInstance.load(rs.getInt("charId"));
client.setActiveChar(player);

View File

@@ -48,7 +48,7 @@ public class PetNameTable
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
StringBuilder cond = new StringBuilder();
final StringBuilder cond = new StringBuilder();
if (!cond.toString().isEmpty())
{
cond.append(", ");
@@ -87,7 +87,7 @@ public class PetNameTable
LOGGER.warning(getClass().getSimpleName() + ": Pet name pattern of config is wrong!");
pattern = Pattern.compile(".*");
}
Matcher regexp = pattern.matcher(name);
final Matcher regexp = pattern.matcher(name);
if (!regexp.matches())
{
result = false;
@@ -98,7 +98,7 @@ public class PetNameTable
private boolean isAlphaNumeric(String text)
{
boolean result = true;
char[] chars = text.toCharArray();
final char[] chars = text.toCharArray();
for (int i = 0; i < chars.length; i++)
{
if (!Character.isLetterOrDigit(chars[i]))

View File

@@ -61,8 +61,8 @@ public class SummonSkillsTable
_skillTrees.put(npcId, skillTree);
}
int id = rs.getInt("skillId");
int lvl = rs.getInt("skillLvl");
final int id = rs.getInt("skillId");
final int lvl = rs.getInt("skillLvl");
skillTree.put(SkillData.getSkillHashCode(id, lvl + 1), new L2PetSkillLearn(id, lvl, rs.getInt("minLvl")));
count++;
}
@@ -82,7 +82,7 @@ public class SummonSkillsTable
LOGGER.warning(getClass().getSimpleName() + ": Pet id " + cha.getId() + " does not have any skills assigned.");
return lvl;
}
Collection<L2PetSkillLearn> skills = _skillTrees.get(cha.getId()).values();
final Collection<L2PetSkillLearn> skills = _skillTrees.get(cha.getId()).values();
for (L2PetSkillLearn temp : skills)
{
if (temp.getId() != skillId)
@@ -105,7 +105,7 @@ public class SummonSkillsTable
}
// formula usable for skill that have 10 or more skill levels
int maxLvl = SkillData.getInstance().getMaxLevel(temp.getId());
final int maxLvl = SkillData.getInstance().getMaxLevel(temp.getId());
if (lvl > maxLvl)
{
lvl = maxLvl;
@@ -125,13 +125,13 @@ public class SummonSkillsTable
public List<Integer> getAvailableSkills(L2Summon cha)
{
List<Integer> skillIds = new ArrayList<>();
final List<Integer> skillIds = new ArrayList<>();
if (!_skillTrees.containsKey(cha.getId()))
{
LOGGER.warning(getClass().getSimpleName() + ": Pet id " + cha.getId() + " does not have any skills assigned.");
return skillIds;
}
Collection<L2PetSkillLearn> skills = _skillTrees.get(cha.getId()).values();
final Collection<L2PetSkillLearn> skills = _skillTrees.get(cha.getId()).values();
for (L2PetSkillLearn temp : skills)
{
if (skillIds.contains(temp.getId()))

View File

@@ -80,7 +80,7 @@ public class TerritoryTable
{
while (rset.next())
{
int terrId = rset.getInt("loc_id");
final int terrId = rset.getInt("loc_id");
L2Territory terr = _territory.get(terrId);
if (terr == null)
{

View File

@@ -303,7 +303,7 @@ public final class AdminData implements IXmlReader
for (String name : getAllGmNames(player.isGM()))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.GM_C1);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.GM_C1);
sm.addString(name);
player.sendPacket(sm);
}

View File

@@ -114,8 +114,8 @@ public final class ArmorSetsData implements IXmlReader
}
case "shield_skill":
{
int skillId = parseInteger(attrs, "id");
int skillLevel = parseInteger(attrs, "level");
final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level");
set.addShieldSkill(new SkillHolder(skillId, skillLevel));
break;
}

View File

@@ -86,7 +86,7 @@ public final class BeautyShopData implements IXmlReader
sex = parseEnum(att, Sex.class);
}
BeautyData beautyData = new BeautyData();
final BeautyData beautyData = new BeautyData();
for (Node a = b.getFirstChild(); a != null; a = a.getNextSibling())
{
@@ -99,7 +99,7 @@ public final class BeautyShopData implements IXmlReader
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
BeautyItem hair = new BeautyItem(set);
final BeautyItem hair = new BeautyItem(set);
for (Node g = a.getFirstChild(); g != null; g = g.getNextSibling())
{
@@ -126,7 +126,7 @@ public final class BeautyShopData implements IXmlReader
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
BeautyItem face = new BeautyItem(set);
final BeautyItem face = new BeautyItem(set);
beautyData.addFace(face);
}
}

View File

@@ -72,10 +72,10 @@ public final class BuyListData implements IXmlReader
{
while (rs.next())
{
int buyListId = rs.getInt("buylist_id");
int itemId = rs.getInt("item_id");
long count = rs.getLong("count");
long nextRestockTime = rs.getLong("next_restock_time");
final int buyListId = rs.getInt("buylist_id");
final int itemId = rs.getInt("item_id");
final long count = rs.getLong("count");
final long nextRestockTime = rs.getLong("next_restock_time");
final L2BuyList buyList = getBuyList(buyListId);
if (buyList == null)
{
@@ -121,7 +121,7 @@ public final class BuyListData implements IXmlReader
long price = -1;
long restockDelay = -1;
long count = -1;
NamedNodeMap attrs = list_node.getAttributes();
final NamedNodeMap attrs = list_node.getAttributes();
Node attr = attrs.getNamedItem("id");
itemId = Integer.parseInt(attr.getNodeValue());
attr = attrs.getNamedItem("price");
@@ -155,7 +155,7 @@ public final class BuyListData implements IXmlReader
{
if ("npc".equalsIgnoreCase(npcs_node.getNodeName()))
{
int npcId = Integer.parseInt(npcs_node.getTextContent());
final int npcId = Integer.parseInt(npcs_node.getTextContent());
buyList.addAllowedNpc(npcId);
}
}

View File

@@ -77,7 +77,7 @@ public class DailyMissionData implements IXmlReader
{
if ("mission".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
Node att;
id = -1;
clientId = 0;
@@ -219,7 +219,7 @@ public class DailyMissionData implements IXmlReader
*/
public List<DailyMissionHolder> getDailyMissions(int classId)
{
List<DailyMissionHolder> missions = new ArrayList<>();
final List<DailyMissionHolder> missions = new ArrayList<>();
for (DailyMissionHolder mission : _dailyMissions)
{
if (mission.getAvailableClasses().contains(classId))
@@ -237,7 +237,7 @@ public class DailyMissionData implements IXmlReader
*/
public List<DailyMissionHolder> getDailyLevelUpMissions(int classId)
{
List<DailyMissionHolder> missions = new ArrayList<>();
final List<DailyMissionHolder> missions = new ArrayList<>();
for (DailyMissionHolder mission : _dailyLevelUpMissions)
{
if (mission.getAvailableClasses().contains(classId))

View File

@@ -119,8 +119,8 @@ public class DoorData implements IXmlReader
private void makeDoor(StatsSet set)
{
insertCollisionData(set);
L2DoorTemplate template = new L2DoorTemplate(set);
L2DoorInstance door = new L2DoorInstance(template);
final L2DoorTemplate template = new L2DoorTemplate(set);
final L2DoorInstance door = new L2DoorInstance(template);
door.setCurrentHp(door.getMaxHp());
door.spawnMe(template.getX(), template.getY(), template.getZ());
putDoor(door, MapRegionManager.getInstance().getMapRegionLocId(door));
@@ -218,20 +218,20 @@ public class DoorData implements IXmlReader
boolean intersectFace = false;
for (int i = 0; i < 4; i++)
{
int j = (i + 1) < 4 ? i + 1 : 0;
final int j = (i + 1) < 4 ? i + 1 : 0;
// lower part of the multiplier fraction, if it is 0 we avoid an error and also know that the lines are parallel
int denominator = ((ty - y) * (doorInst.getX(i) - doorInst.getX(j))) - ((tx - x) * (doorInst.getY(i) - doorInst.getY(j)));
final int denominator = ((ty - y) * (doorInst.getX(i) - doorInst.getX(j))) - ((tx - x) * (doorInst.getY(i) - doorInst.getY(j)));
if (denominator == 0)
{
continue;
}
// multipliers to the equations of the lines. If they are lower than 0 or bigger than 1, we know that segments don't intersect
float multiplier1 = (float) (((doorInst.getX(j) - doorInst.getX(i)) * (y - doorInst.getY(i))) - ((doorInst.getY(j) - doorInst.getY(i)) * (x - doorInst.getX(i)))) / denominator;
float multiplier2 = (float) (((tx - x) * (y - doorInst.getY(i))) - ((ty - y) * (x - doorInst.getX(i)))) / denominator;
final float multiplier1 = (float) (((doorInst.getX(j) - doorInst.getX(i)) * (y - doorInst.getY(i))) - ((doorInst.getY(j) - doorInst.getY(i)) * (x - doorInst.getX(i)))) / denominator;
final float multiplier2 = (float) (((tx - x) * (y - doorInst.getY(i))) - ((ty - y) * (x - doorInst.getX(i)))) / denominator;
if ((multiplier1 >= 0) && (multiplier1 <= 1) && (multiplier2 >= 0) && (multiplier2 <= 1))
{
int intersectZ = Math.round(z + (multiplier1 * (tz - z)));
final int intersectZ = Math.round(z + (multiplier1 * (tz - z)));
// now checking if the resulting point is between door's min and max z
if ((intersectZ > doorInst.getZMin()) && (intersectZ < doorInst.getZMax()))
{

View File

@@ -75,13 +75,13 @@ public final class EnchantItemGroupsData implements IXmlReader
{
if ("current".equalsIgnoreCase(cd.getNodeName()))
{
String range = parseString(cd.getAttributes(), "enchant");
double chance = parseDouble(cd.getAttributes(), "chance");
final String range = parseString(cd.getAttributes(), "enchant");
final double chance = parseDouble(cd.getAttributes(), "chance");
int min = -1;
int max = 0;
if (range.contains("-"))
{
String[] split = range.split("-");
final String[] split = range.split("-");
if ((split.length == 2) && Util.isDigit(split[0]) && Util.isDigit(split[1]))
{
min = Integer.parseInt(split[0]);
@@ -103,7 +103,7 @@ public final class EnchantItemGroupsData implements IXmlReader
}
else if ("enchantScrollGroup".equals(d.getNodeName()))
{
int id = parseInteger(d.getAttributes(), "id");
final int id = parseInteger(d.getAttributes(), "id");
final EnchantScrollGroup group = new EnchantScrollGroup(id);
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{

View File

@@ -94,7 +94,7 @@ public class EnchantItemHPBonusData implements IXmlReader
final Collection<Integer> armorIds = it.getAllArmorsId();
for (Integer itemId : armorIds)
{
L2Item item = it.getTemplate(itemId);
final L2Item item = it.getTemplate(itemId);
if ((item != null) && (item.getCrystalType() != CrystalType.NONE))
{
switch (item.getBodyPart())

View File

@@ -61,7 +61,7 @@ public class EnchantItemOptionsData implements IXmlReader
{
if ("item".equalsIgnoreCase(d.getNodeName()))
{
int itemId = parseInteger(d.getAttributes(), "id");
final int itemId = parseInteger(d.getAttributes(), "id");
if (!_data.containsKey(itemId))
{
_data.put(itemId, new HashMap<Integer, EnchantOptions>());

View File

@@ -112,11 +112,11 @@ public class EnchantSkillGroupsData implements IXmlReader
if ("enchant".equalsIgnoreCase(b.getNodeName()))
{
attrs = b.getAttributes();
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
group.addEnchantDetail(new EnchantSkillHolder(set));

View File

@@ -80,7 +80,7 @@ public final class ExperienceData implements IXmlReader
{
if ("experience".equals(n.getNodeName()))
{
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
maxLevel = parseInteger(attrs, "level");
if (maxLevel > Config.PLAYER_MAXIMUM_LEVEL)
{

View File

@@ -71,7 +71,7 @@ public final class HitConditionBonusData implements IXmlReader
{
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())
{
NamedNodeMap attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
switch (d.getNodeName())
{
case "front":

View File

@@ -95,7 +95,7 @@ public final class InitialEquipmentData implements IXmlReader
attrs = c.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node attr = attrs.item(i);
final Node attr = attrs.item(i);
set.set(attr.getNodeName(), attr.getNodeValue());
}
equipList.add(new PcItemTemplate(set));

View File

@@ -66,7 +66,7 @@ public final class ItemCrystalizationData implements IXmlReader
{
if ("item".equalsIgnoreCase(c.getNodeName()))
{
NamedNodeMap attrs = c.getAttributes();
final NamedNodeMap attrs = c.getAttributes();
final int itemId = parseInteger(attrs, "id");
final long itemCount = parseLong(attrs, "count");
final double itemChance = parseDouble(attrs, "chance");

View File

@@ -62,7 +62,7 @@ public class KarmaData implements IXmlReader
if ("increase".equalsIgnoreCase(d.getNodeName()))
{
final NamedNodeMap attrs = d.getAttributes();
int level = parseInteger(attrs, "lvl");
final int level = parseInteger(attrs, "lvl");
if (level >= Config.PLAYER_MAXIMUM_LEVEL)
{
break;

View File

@@ -64,8 +64,8 @@ public class LuckyGameData implements IXmlReader
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
NamedNodeMap at = n.getAttributes();
Node attribute = at.getNamedItem("enabled");
final NamedNodeMap at = n.getAttributes();
final Node attribute = at.getNamedItem("enabled");
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue())) // <list enabled="true"
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
@@ -76,7 +76,7 @@ public class LuckyGameData implements IXmlReader
{
if ("item".equalsIgnoreCase(b.getNodeName()))
{
NamedNodeMap attrs = b.getAttributes();
final NamedNodeMap attrs = b.getAttributes();
final int itemId = parseInteger(attrs, "id");
final int count = parseInteger(attrs, "count");
@@ -97,7 +97,7 @@ public class LuckyGameData implements IXmlReader
{
if ("item".equalsIgnoreCase(b.getNodeName()))
{
NamedNodeMap attrs = b.getAttributes();
final NamedNodeMap attrs = b.getAttributes();
final int itemId = parseInteger(attrs, "id");
final int count = parseInteger(attrs, "count");
@@ -118,7 +118,7 @@ public class LuckyGameData implements IXmlReader
{
if ("item".equalsIgnoreCase(b.getNodeName()))
{
NamedNodeMap attrs = b.getAttributes();
final NamedNodeMap attrs = b.getAttributes();
final int itemId = parseInteger(attrs, "id");
final int count = parseInteger(attrs, "count");

View File

@@ -84,7 +84,7 @@ public final class MultisellData implements IXmlReader
{
try
{
int id = Integer.parseInt(f.getName().replaceAll(".xml", ""));
final int id = Integer.parseInt(f.getName().replaceAll(".xml", ""));
int entryId = 1;
Node att;
final ListContainer list = new ListContainer(id);
@@ -132,7 +132,7 @@ public final class MultisellData implements IXmlReader
{
if ("item".equalsIgnoreCase(d.getNodeName()))
{
Entry e = parseEntry(d, entryId++, list);
final Entry e = parseEntry(d, entryId++, list);
list.getEntries().add(e);
}
else if ("npcs".equalsIgnoreCase(d.getNodeName()))
@@ -167,7 +167,7 @@ public final class MultisellData implements IXmlReader
private final Entry parseEntry(Node n, int entryId, ListContainer list)
{
Node first = n.getFirstChild();
final Node first = n.getFirstChild();
final Entry entry = new Entry(entryId);
NamedNodeMap attrs;
@@ -234,7 +234,7 @@ public final class MultisellData implements IXmlReader
*/
public final void separateAndSend(int listId, L2PcInstance player, L2Npc npc, boolean inventoryOnly, double productMultiplier, double ingredientMultiplier)
{
ListContainer template = _entries.get(listId);
final ListContainer template = _entries.get(listId);
if (template == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Cannot find list ID: " + listId + " requested by player: " + player.getName() + ", NPC ID:" + (npc != null ? npc.getId() : 0));
@@ -330,14 +330,14 @@ public final class MultisellData implements IXmlReader
case PC_BANG_POINTS: // PcBang points
final int cost = player.getPcBangPoints() - (int) (amount);
player.setPcBangPoints(cost);
SystemMessage smsgpc = SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_USING_S1_POINT);
final SystemMessage smsgpc = SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_USING_S1_POINT);
smsgpc.addLong((int) amount);
player.sendPacket(smsgpc);
player.sendPacket(new ExPCCafePointInfo(player.getPcBangPoints(), (int) amount, 1));
return true;
case CLAN_REPUTATION:
player.getClan().takeReputationScore((int) amount, true);
SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.S1_POINT_S_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION);
final SystemMessage smsg = SystemMessage.getSystemMessage(SystemMessageId.S1_POINT_S_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION);
smsg.addLong(amount);
player.sendPacket(smsg);
return true;

View File

@@ -236,7 +236,7 @@ public class NpcData implements IXmlReader
{
case "attack":
{
String attackAttributeType = parseString(attrs, "type");
final String attackAttributeType = parseString(attrs, "type");
switch (attackAttributeType.toUpperCase())
{
case "FIRE":
@@ -441,7 +441,7 @@ public class NpcData implements IXmlReader
dropLists = new EnumMap<>(DropListScope.class);
}
List<IDropItem> dropList = new ArrayList<>();
final List<IDropItem> dropList = new ArrayList<>();
parseDropList(f, dropListsNode, dropListScope, dropList);
dropLists.put(dropListScope, Collections.unmodifiableList(dropList));
}
@@ -629,19 +629,19 @@ public class NpcData implements IXmlReader
{
for (Node dropNode = dropListNode.getFirstChild(); dropNode != null; dropNode = dropNode.getNextSibling())
{
NamedNodeMap attrs = dropNode.getAttributes();
final NamedNodeMap attrs = dropNode.getAttributes();
switch (dropNode.getNodeName().toLowerCase())
{
case "group":
{
GroupedGeneralDropItem dropItem = dropListScope.newGroupedDropItem(parseDouble(attrs, "chance"));
List<IDropItem> groupedDropList = new ArrayList<>(2);
final GroupedGeneralDropItem dropItem = dropListScope.newGroupedDropItem(parseDouble(attrs, "chance"));
final List<IDropItem> groupedDropList = new ArrayList<>(2);
for (Node groupNode = dropNode.getFirstChild(); groupNode != null; groupNode = groupNode.getNextSibling())
{
parseDropListItem(groupNode, dropListScope, groupedDropList);
}
List<GeneralDropItem> items = new ArrayList<>(groupedDropList.size());
final List<GeneralDropItem> items = new ArrayList<>(groupedDropList.size());
for (IDropItem item : groupedDropList)
{
if (item instanceof GeneralDropItem)
@@ -669,7 +669,7 @@ public class NpcData implements IXmlReader
private void parseDropListItem(Node dropListItem, DropListScope dropListScope, List<IDropItem> drops)
{
NamedNodeMap attrs = dropListItem.getAttributes();
final NamedNodeMap attrs = dropListItem.getAttributes();
switch (dropListItem.getNodeName().toLowerCase())
{
case "item":
@@ -707,7 +707,7 @@ public class NpcData implements IXmlReader
*/
public int getClanId(String clanName)
{
Integer id = _clans.get(clanName.toUpperCase());
final Integer id = _clans.get(clanName.toUpperCase());
return id != null ? id : -1;
}
@@ -839,7 +839,7 @@ public class NpcData implements IXmlReader
{
final List<MinionHolder> minions = new ArrayList<>(1);
NamedNodeMap attrs = listNode.getAttributes();
int id = parseInteger(attrs, "id");
final int id = parseInteger(attrs, "id");
for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{
if ("minion".equals(npcNode.getNodeName()))

View File

@@ -131,8 +131,8 @@ public class OptionData implements IXmlReader
private void parseFuncs(NamedNodeMap attrs, String functionName, Options op)
{
Stats stat = Stats.valueOfXml(parseString(attrs, "stat"));
double val = parseDouble(attrs, "val");
final Stats stat = Stats.valueOfXml(parseString(attrs, "stat"));
final double val = parseDouble(attrs, "val");
int order = -1;
final Node orderNode = attrs.getNamedItem("order");
if (orderNode != null)

View File

@@ -60,21 +60,21 @@ public final class PetDataTable implements IXmlReader
public void parseDocument(Document doc)
{
NamedNodeMap attrs;
Node n = doc.getFirstChild();
final Node n = doc.getFirstChild();
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if (d.getNodeName().equals("pet"))
{
int npcId = parseInteger(d.getAttributes(), "id");
int itemId = parseInteger(d.getAttributes(), "itemId");
final int npcId = parseInteger(d.getAttributes(), "id");
final int itemId = parseInteger(d.getAttributes(), "itemId");
// index ignored for now
L2PetData data = new L2PetData(npcId, itemId);
final L2PetData data = new L2PetData(npcId, itemId);
for (Node p = d.getFirstChild(); p != null; p = p.getNextSibling())
{
if (p.getNodeName().equals("set"))
{
attrs = p.getAttributes();
String type = attrs.getNamedItem("name").getNodeValue();
final String type = attrs.getNamedItem("name").getNodeValue();
if ("food".equals(type))
{
for (String foodId : attrs.getNamedItem("val").getNodeValue().split(";"))

View File

@@ -79,9 +79,9 @@ public final class PlayerTemplateData implements IXmlReader
}
else if ("staticData".equalsIgnoreCase(d.getNodeName()))
{
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
set.set("classId", classId);
List<Location> creationPoints = new ArrayList<>();
final List<Location> creationPoints = new ArrayList<>();
for (Node nd = d.getFirstChild(); nd != null; nd = nd.getNextSibling())
{
@@ -152,10 +152,10 @@ public final class PlayerTemplateData implements IXmlReader
if ("level".equalsIgnoreCase(lvlNode.getNodeName()))
{
attrs = lvlNode.getAttributes();
int level = parseInteger(attrs, "val");
final int level = parseInteger(attrs, "val");
for (Node valNode = lvlNode.getFirstChild(); valNode != null; valNode = valNode.getNextSibling())
{
String nodeName = valNode.getNodeName();
final String nodeName = valNode.getNodeName();
if ((level < Config.PLAYER_MAXIMUM_LEVEL) && (nodeName.startsWith("hp") || nodeName.startsWith("mp") || nodeName.startsWith("cp")) && _playerTemplates.containsKey(ClassId.getClassId(classId)))
{

View File

@@ -58,8 +58,8 @@ public final class PlayerXpPercentLostData implements IXmlReader
{
if ("xpLost".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
Integer level = parseInteger(attrs, "level");
final NamedNodeMap attrs = d.getAttributes();
final Integer level = parseInteger(attrs, "level");
if (level > _maxlevel)
{
break;

View File

@@ -71,8 +71,8 @@ public class PrimeShopData implements IXmlReader
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
NamedNodeMap at = n.getAttributes();
Node attribute = at.getNamedItem("enabled");
final NamedNodeMap at = n.getAttributes();
final Node attribute = at.getNamedItem("enabled");
if ((attribute != null) && Boolean.parseBoolean(attribute.getNodeValue()))
{
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
@@ -81,14 +81,14 @@ public class PrimeShopData implements IXmlReader
{
NamedNodeMap attrs = d.getAttributes();
Node att;
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
List<PrimeShopItem> items = new ArrayList<>();
final List<PrimeShopItem> items = new ArrayList<>();
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
{
if ("item".equalsIgnoreCase(b.getNodeName()))

View File

@@ -76,11 +76,11 @@ public class RecipeData implements IXmlReader
recipePartList.clear();
recipeStatUseList.clear();
recipeAltStatChangeList.clear();
NamedNodeMap attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
Node att;
int id = -1;
boolean haveRare = false;
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
att = attrs.getNamedItem("id");
if (att == null)
@@ -135,8 +135,8 @@ public class RecipeData implements IXmlReader
{
if ("statUse".equalsIgnoreCase(c.getNodeName()))
{
String statName = c.getAttributes().getNamedItem("name").getNodeValue();
int value = Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());
final String statName = c.getAttributes().getNamedItem("name").getNodeValue();
final int value = Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());
try
{
recipeStatUseList.add(new L2RecipeStatInstance(statName, value));
@@ -149,8 +149,8 @@ public class RecipeData implements IXmlReader
}
else if ("altStatChange".equalsIgnoreCase(c.getNodeName()))
{
String statName = c.getAttributes().getNamedItem("name").getNodeValue();
int value = Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());
final String statName = c.getAttributes().getNamedItem("name").getNodeValue();
final int value = Integer.parseInt(c.getAttributes().getNamedItem("value").getNodeValue());
try
{
recipeAltStatChangeList.add(new L2RecipeStatInstance(statName, value));
@@ -163,8 +163,8 @@ public class RecipeData implements IXmlReader
}
else if ("ingredient".equalsIgnoreCase(c.getNodeName()))
{
int ingId = Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue());
int ingCount = Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue());
final int ingId = Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue());
final int ingCount = Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue());
recipePartList.add(new L2RecipeInstance(ingId, ingCount));
}
else if ("production".equalsIgnoreCase(c.getNodeName()))
@@ -181,7 +181,7 @@ public class RecipeData implements IXmlReader
}
}
L2RecipeList recipeList = new L2RecipeList(set, haveRare);
final L2RecipeList recipeList = new L2RecipeList(set, haveRare);
for (L2RecipeInstance recipePart : recipePartList)
{
recipeList.addRecipe(recipePart);
@@ -235,7 +235,7 @@ public class RecipeData implements IXmlReader
*/
public int[] getAllItemIds()
{
int[] idList = new int[_recipes.size()];
final int[] idList = new int[_recipes.size()];
int i = 0;
for (L2RecipeList rec : _recipes.values())
{
@@ -252,7 +252,7 @@ public class RecipeData implements IXmlReader
*/
public L2RecipeList getValidRecipeList(L2PcInstance player, int id)
{
L2RecipeList recipeList = _recipes.get(id);
final L2RecipeList recipeList = _recipes.get(id);
if ((recipeList == null) || (recipeList.getRecipes().length == 0))
{
player.sendMessage(getClass().getSimpleName() + ": No recipe for: " + id);

View File

@@ -110,7 +110,7 @@ public final class ShuttleData implements IXmlReader
if ("stop".equalsIgnoreCase(a.getNodeName()))
{
attrs = a.getAttributes();
L2ShuttleStop stop = new L2ShuttleStop(parseInteger(attrs, "id"));
final L2ShuttleStop stop = new L2ShuttleStop(parseInteger(attrs, "id"));
for (Node z = a.getFirstChild(); z != null; z = z.getNextSibling())
{
@@ -131,7 +131,7 @@ public final class ShuttleData implements IXmlReader
if ("route".equalsIgnoreCase(a.getNodeName()))
{
attrs = a.getAttributes();
List<Location> locs = new ArrayList<>();
final List<Location> locs = new ArrayList<>();
for (Node z = a.getFirstChild(); z != null; z = z.getNextSibling())
{
if ("loc".equalsIgnoreCase(z.getNodeName()))
@@ -141,7 +141,7 @@ public final class ShuttleData implements IXmlReader
}
}
VehiclePathPoint[] route = new VehiclePathPoint[locs.size()];
final VehiclePathPoint[] route = new VehiclePathPoint[locs.size()];
int i = 0;
for (Location loc : locs)
{

View File

@@ -75,8 +75,8 @@ public class SiegeScheduleData implements IXmlReader
final NamedNodeMap attrs = cd.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node node = attrs.item(i);
String key = node.getNodeName();
final Node node = attrs.item(i);
final String key = node.getNodeName();
String val = node.getNodeValue();
if ("day".equals(key))
{

View File

@@ -773,13 +773,13 @@ public final class SkillTreesData implements IXmlReader
public Collection<Skill> getAllAvailableSkills(L2PcInstance player, ClassId classId, boolean includeByFs, boolean includeAutoGet)
{
// Get available skills
PlayerSkillHolder holder = new PlayerSkillHolder(player);
final PlayerSkillHolder holder = new PlayerSkillHolder(player);
List<L2SkillLearn> learnable = getAvailableSkills(player, classId, includeByFs, includeAutoGet, holder);
while (learnable.size() > 0)
{
for (L2SkillLearn s : learnable)
{
Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());
final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());
holder.addSkill(sk);
}
@@ -894,7 +894,7 @@ public final class SkillTreesData implements IXmlReader
public List<L2SkillLearn> getAvailableRevelationSkills(L2PcInstance player, SubclassType type)
{
final List<L2SkillLearn> result = new ArrayList<>();
Map<Integer, L2SkillLearn> revelationSkills = _revelationSkillTree.get(type);
final Map<Integer, L2SkillLearn> revelationSkills = _revelationSkillTree.get(type);
for (L2SkillLearn skill : revelationSkills.values())
{

View File

@@ -86,7 +86,7 @@ public final class StaticObjectData implements IXmlReader
*/
private void addObject(StatsSet set)
{
L2StaticObjectInstance obj = new L2StaticObjectInstance(new L2CharTemplate(new StatsSet()), set.getInt("id"));
final L2StaticObjectInstance obj = new L2StaticObjectInstance(new L2CharTemplate(new StatsSet()), set.getInt("id"));
obj.setType(set.getInt("type", 0));
obj.setName(set.getString("name"));
obj.setMap(set.getString("texture", "none"), set.getInt("map_x", 0), set.getInt("map_y", 0));

View File

@@ -70,16 +70,16 @@ public final class TransformData implements IXmlReader
if ("transform".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
final Transform transform = new Transform(set);
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
boolean isMale = "Male".equalsIgnoreCase(cd.getNodeName());
final boolean isMale = "Male".equalsIgnoreCase(cd.getNodeName());
if ("Male".equalsIgnoreCase(cd.getNodeName()) || "Female".equalsIgnoreCase(cd.getNodeName()))
{
TransformTemplate templateData = null;
@@ -103,7 +103,7 @@ public final class TransformData implements IXmlReader
attrs = s.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
break;
@@ -126,8 +126,8 @@ public final class TransformData implements IXmlReader
if ("skill".equals(s.getNodeName()))
{
attrs = s.getAttributes();
int skillId = parseInteger(attrs, "id");
int skillLevel = parseInteger(attrs, "level");
final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level");
templateData.addSkill(new SkillHolder(skillId, skillLevel));
}
}
@@ -157,9 +157,9 @@ public final class TransformData implements IXmlReader
if ("skill".equals(s.getNodeName()))
{
attrs = s.getAttributes();
int skillId = parseInteger(attrs, "id");
int skillLevel = parseInteger(attrs, "level");
int minLevel = parseInteger(attrs, "minLevel");
final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level");
final int minLevel = parseInteger(attrs, "minLevel");
templateData.addAdditionalSkill(new AdditionalSkillHolder(skillId, skillLevel, minLevel));
}
}
@@ -177,8 +177,8 @@ public final class TransformData implements IXmlReader
if ("item".equals(s.getNodeName()))
{
attrs = s.getAttributes();
int itemId = parseInteger(attrs, "id");
boolean allowed = parseBoolean(attrs, "allowed");
final int itemId = parseInteger(attrs, "id");
final boolean allowed = parseBoolean(attrs, "allowed");
templateData.addAdditionalItem(new AdditionalItemHolder(itemId, allowed));
}
}
@@ -200,7 +200,7 @@ public final class TransformData implements IXmlReader
attrs = s.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
final Node att = attrs.item(i);
levelsSet.set(att.getNodeName(), att.getNodeValue());
}
}

View File

@@ -219,7 +219,7 @@ public class AugmentationData
private final void load()
{
// Load stats
DocumentBuilderFactory factory2 = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory2 = DocumentBuilderFactory.newInstance();
factory2.setValidating(false);
factory2.setIgnoringComments(true);
@@ -232,18 +232,18 @@ public class AugmentationData
try
{
int badAugmantData = 0;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT + "/stats/augmentation/augmentation_skillmap.xml");
final File file = new File(Config.DATAPACK_ROOT + "/stats/augmentation/augmentation_skillmap.xml");
if (!file.exists())
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": ERROR The augmentation skillmap file is missing.");
return;
}
Document doc = factory.newDocumentBuilder().parse(file);
final Document doc = factory.newDocumentBuilder().parse(file);
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
@@ -254,7 +254,8 @@ public class AugmentationData
if ("augmentation".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
int skillId = 0, augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
int skillId = 0;
final int augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
int skillLvL = 0;
String type = "blue";
@@ -286,7 +287,7 @@ public class AugmentationData
badAugmantData++;
continue;
}
int k = (augmentationId - BLUE_START) / SKILLS_BLOCKSIZE;
final int k = (augmentationId - BLUE_START) / SKILLS_BLOCKSIZE;
if (type.equalsIgnoreCase("blue"))
{
@@ -319,11 +320,11 @@ public class AugmentationData
}
else
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File aFile = new File(Config.DATAPACK_ROOT + "/stats/augmentation/retailchances.xml");
final File aFile = new File(Config.DATAPACK_ROOT + "/stats/augmentation/retailchances.xml");
if (aFile.exists())
{
Document aDoc = null;
@@ -413,11 +414,11 @@ public class AugmentationData
}
if (Config.RETAIL_LIKE_AUGMENTATION_ACCESSORY)
{
DocumentBuilderFactory factory3 = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory3 = DocumentBuilderFactory.newInstance();
factory3.setValidating(false);
factory3.setIgnoringComments(true);
File aFile3 = new File(Config.DATAPACK_ROOT + "/stats/augmentation/retailchances_accessory.xml");
final File aFile3 = new File(Config.DATAPACK_ROOT + "/stats/augmentation/retailchances_accessory.xml");
if (aFile3.exists())
{
Document aDoc = null;
@@ -536,8 +537,8 @@ public class AugmentationData
{
if (item.getItem().isMagicWeapon())
{
List<AugmentationChance> _selectedChances12 = new ArrayList<>();
List<AugmentationChance> _selectedChances34 = new ArrayList<>();
final List<AugmentationChance> _selectedChances12 = new ArrayList<>();
final List<AugmentationChance> _selectedChances34 = new ArrayList<>();
for (AugmentationChance ac : _augmentationChances)
{
if (ac.getWeaponType().equals("mage") && (ac.getStoneId() == lifeStoneId))
@@ -598,7 +599,7 @@ public class AugmentationData
{
c = 3;
}
List<AugmentationChance> _selectedChances34final = new ArrayList<>();
final List<AugmentationChance> _selectedChances34final = new ArrayList<>();
for (AugmentationChance ac : _selectedChances34)
{
if (ac.getCategoryChance() == c)
@@ -621,8 +622,8 @@ public class AugmentationData
}
else
{
List<AugmentationChance> _selectedChances12 = new ArrayList<>();
List<AugmentationChance> _selectedChances34 = new ArrayList<>();
final List<AugmentationChance> _selectedChances12 = new ArrayList<>();
final List<AugmentationChance> _selectedChances34 = new ArrayList<>();
for (AugmentationChance ac : _augmentationChances)
{
if (ac.getWeaponType().equals("warrior") && (ac.getStoneId() == lifeStoneId))
@@ -683,7 +684,7 @@ public class AugmentationData
{
c = 3;
}
List<AugmentationChance> _selectedChances34final = new ArrayList<>();
final List<AugmentationChance> _selectedChances34final = new ArrayList<>();
for (AugmentationChance ac : _selectedChances34)
{
if (ac.getCategoryChance() == c)
@@ -838,8 +839,8 @@ public class AugmentationData
int offset;
if (stat34 == 0)
{
int temp = Rnd.get(2, 3);
int colorOffset = (resultColor * (10 * STAT_SUBBLOCKSIZE)) + (temp * STAT_BLOCKSIZE) + 1;
final int temp = Rnd.get(2, 3);
final int colorOffset = (resultColor * (10 * STAT_SUBBLOCKSIZE)) + (temp * STAT_BLOCKSIZE) + 1;
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + colorOffset;
stat34 = Rnd.get(offset, (offset + STAT_SUBBLOCKSIZE) - 1);
@@ -878,8 +879,8 @@ public class AugmentationData
int stat34 = 0;
if (Config.RETAIL_LIKE_AUGMENTATION_ACCESSORY)
{
List<augmentationChanceAcc> _selectedChances12 = new ArrayList<>();
List<augmentationChanceAcc> _selectedChances34 = new ArrayList<>();
final List<augmentationChanceAcc> _selectedChances12 = new ArrayList<>();
final List<augmentationChanceAcc> _selectedChances34 = new ArrayList<>();
for (augmentationChanceAcc ac : _augmentationChancesAcc)
{
if (ac.getWeaponType().equals("warrior") && (ac.getStoneId() == lifeStoneId))
@@ -921,7 +922,7 @@ public class AugmentationData
{
c = 1;
}
List<augmentationChanceAcc> _selectedChances34final = new ArrayList<>();
final List<augmentationChanceAcc> _selectedChances34final = new ArrayList<>();
for (augmentationChanceAcc ac : _selectedChances34)
{
if (ac.getCategoryChance() == c)
@@ -964,7 +965,7 @@ public class AugmentationData
return null;
}
int resultColor = Rnd.get(0, 3);
final int resultColor = Rnd.get(0, 3);
// first augmentation (stats only)
stat12 = Rnd.get(ACC_STAT_SUBBLOCKSIZE);

View File

@@ -86,13 +86,13 @@ public final class BotReportTable
try
{
File punishments = new File("./config/botreport_punishments.xml");
final File punishments = new File("./config/botreport_punishments.xml");
if (!punishments.exists())
{
throw new FileNotFoundException(punishments.getName());
}
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
final SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(punishments, new PunishmentsLoader());
}
catch (Exception e)
@@ -118,8 +118,8 @@ public final class BotReportTable
long lastResetTime = 0;
try
{
String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
Calendar c = Calendar.getInstance();
final String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
final Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
@@ -137,16 +137,16 @@ public final class BotReportTable
while (rset.next())
{
int botId = rset.getInt(COLUMN_BOT_ID);
int reporter = rset.getInt(COLUMN_REPORTER_ID);
long date = rset.getLong(COLUMN_REPORT_TIME);
final int botId = rset.getInt(COLUMN_BOT_ID);
final int reporter = rset.getInt(COLUMN_REPORTER_ID);
final long date = rset.getLong(COLUMN_REPORT_TIME);
if (_reports.containsKey(botId))
{
_reports.get(botId).addReporter(reporter, date);
}
else
{
ReportedCharData rcd = new ReportedCharData();
final ReportedCharData rcd = new ReportedCharData();
rcd.addReporter(reporter, date);
_reports.put(rset.getInt(COLUMN_BOT_ID), rcd);
}
@@ -189,7 +189,7 @@ public final class BotReportTable
for (Map.Entry<Integer, ReportedCharData> entrySet : _reports.entrySet())
{
Map<Integer, Long> reportTable = entrySet.getValue()._reporters;
final Map<Integer, Long> reportTable = entrySet.getValue()._reporters;
for (int reporterId : reportTable.keySet())
{
ps.setInt(1, entrySet.getKey());
@@ -212,14 +212,14 @@ public final class BotReportTable
*/
public boolean reportBot(L2PcInstance reporter)
{
L2Object target = reporter.getTarget();
final L2Object target = reporter.getTarget();
if (target == null)
{
return false;
}
L2PcInstance bot = target.getActingPlayer();
final L2PcInstance bot = target.getActingPlayer();
if ((bot == null) || (target.getObjectId() == reporter.getObjectId()))
{
@@ -292,10 +292,10 @@ public final class BotReportTable
return false;
}
long reuse = (System.currentTimeMillis() - rcdRep.getLastReporTime());
final long reuse = (System.currentTimeMillis() - rcdRep.getLastReporTime());
if (reuse < Config.BOTREPORT_REPORT_DELAY)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CAN_MAKE_ANOTHER_REPORT_IN_S1_MINUTE_S_YOU_HAVE_S2_POINT_S_REMAINING_ON_THIS_ACCOUNT);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CAN_MAKE_ANOTHER_REPORT_IN_S1_MINUTE_S_YOU_HAVE_S2_POINT_S_REMAINING_ON_THIS_ACCOUNT);
sm.addInt((int) (reuse / 60000));
sm.addInt(rcdRep.getPointsLeft());
reporter.sendPacket(sm);
@@ -368,7 +368,7 @@ public final class BotReportTable
ph._punish.applyEffects(bot, bot);
if (ph._systemMessageId > -1)
{
SystemMessageId id = SystemMessageId.getSystemMessageId(ph._systemMessageId);
final SystemMessageId id = SystemMessageId.getSystemMessageId(ph._systemMessageId);
if (id != null)
{
bot.sendPacket(id);
@@ -386,7 +386,7 @@ public final class BotReportTable
*/
void addPunishment(int neededReports, int skillId, int skillLevel, int sysMsg)
{
Skill sk = SkillData.getInstance().getSkill(skillId, skillLevel);
final Skill sk = SkillData.getInstance().getSkill(skillId, skillLevel);
if (sk != null)
{
_punishments.put(neededReports, new PunishHolder(sk, sysMsg));
@@ -414,8 +414,8 @@ public final class BotReportTable
{
try
{
String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
Calendar c = Calendar.getInstance();
final String[] hour = Config.BOTREPORT_RESETPOINT_HOUR;
final Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
c.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
@@ -445,9 +445,9 @@ public final class BotReportTable
*/
private static int hashIp(L2PcInstance player)
{
String con = player.getClient().getConnection().getInetAddress().getHostAddress();
String[] rawByte = con.split("\\.");
int[] rawIp = new int[4];
final String con = player.getClient().getConnection().getInetAddress().getHostAddress();
final String[] rawByte = con.split("\\.");
final int[] rawIp = new int[4];
for (int i = 0; i < 4; i++)
{
rawIp[i] = Integer.parseInt(rawByte[i]);
@@ -572,8 +572,8 @@ public final class BotReportTable
{
reportCount = Integer.parseInt(attr.getValue("neededReportCount"));
skillId = Integer.parseInt(attr.getValue("skillId"));
String level = attr.getValue("skillLevel");
String systemMessageId = attr.getValue("sysMessageId");
final String level = attr.getValue("skillLevel");
final String systemMessageId = attr.getValue("sysMessageId");
if (level != null)
{
skillLevel = Integer.parseInt(level);

View File

@@ -211,14 +211,14 @@ public class ItemTable
public L2ItemInstance createItem(String process, int itemId, long count, L2PcInstance actor, Object reference)
{
// Create and Init the L2ItemInstance corresponding to the Item Identifier
L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
final L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), itemId);
if (process.equalsIgnoreCase("loot"))
{
ScheduledFuture<?> itemLootShedule;
if ((reference instanceof L2Attackable) && ((L2Attackable) reference).isRaid()) // loot privilege for raids
{
L2Attackable raid = (L2Attackable) reference;
final L2Attackable raid = (L2Attackable) reference;
// if in CommandChannel and was killing a World/RaidBoss
if ((raid.getFirstCommandChannelAttacked() != null) && !Config.AUTO_LOOT_RAIDS)
{
@@ -253,7 +253,7 @@ public class ItemTable
{
if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || (item.getId() == ADENA_ID))))
{
LogRecord record = new LogRecord(Level.INFO, "CREATE:" + process);
final LogRecord record = new LogRecord(Level.INFO, "CREATE:" + process);
record.setLoggerName("item");
record.setParameters(new Object[]
{
@@ -278,7 +278,7 @@ public class ItemTable
{
referenceName = (String) reference;
}
String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
final String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(actor.getName() + " [" + actor.getObjectId() + "]", process + "(id: " + itemId + " count: " + count + " name: " + item.getItemName() + " objId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: " + referenceName);
@@ -313,7 +313,7 @@ public class ItemTable
{
synchronized (item)
{
long old = item.getCount();
final long old = item.getCount();
item.setCount(0);
item.setOwnerId(0);
item.setItemLocation(ItemLocation.VOID);
@@ -326,7 +326,7 @@ public class ItemTable
{
if (!Config.LOG_ITEMS_SMALL_LOG || (Config.LOG_ITEMS_SMALL_LOG && (item.isEquipable() || (item.getId() == ADENA_ID))))
{
LogRecord record = new LogRecord(Level.INFO, "DELETE:" + process);
final LogRecord record = new LogRecord(Level.INFO, "DELETE:" + process);
record.setLoggerName("item");
record.setParameters(new Object[]
{
@@ -352,7 +352,7 @@ public class ItemTable
{
referenceName = (String) reference;
}
String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
final String targetName = (actor.getTarget() != null ? actor.getTarget().getName() : "no-target");
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(actor.getName() + " [" + actor.getObjectId() + "]", process + "(id: " + item.getId() + " count: " + item.getCount() + " itemObjId: " + item.getObjectId() + ")", targetName, "L2Object referencing this action is: " + referenceName);

View File

@@ -75,17 +75,17 @@ public class MerchantPriceConfigTable implements InstanceListManager
public void loadXML() throws SAXException, IOException, ParserConfigurationException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT + "/" + MPCS_FILE);
final File file = new File(Config.DATAPACK_ROOT + "/" + MPCS_FILE);
if (file.exists())
{
int defaultPriceConfigId;
Document doc = factory.newDocumentBuilder().parse(file);
final Document doc = factory.newDocumentBuilder().parse(file);
Node n = doc.getDocumentElement();
Node dpcNode = n.getAttributes().getNamedItem("defaultPriceConfig");
final Node dpcNode = n.getAttributes().getNamedItem("defaultPriceConfig");
if (dpcNode == null)
{
throw new IllegalStateException("merchantPriceConfig must define an 'defaultPriceConfig'");
@@ -102,7 +102,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
}
}
MerchantPriceConfig defaultMpc = this.getMerchantPriceConfig(defaultPriceConfigId);
final MerchantPriceConfig defaultMpc = this.getMerchantPriceConfig(defaultPriceConfigId);
if (defaultMpc == null)
{
throw new IllegalStateException("'defaultPriceConfig' points to an non-loaded priceConfig");
@@ -176,7 +176,7 @@ public class MerchantPriceConfigTable implements InstanceListManager
@Override
public void updateReferences()
{
for (final MerchantPriceConfig mpc : _mpcs.values())
for (MerchantPriceConfig mpc : _mpcs.values())
{
mpc.updateReferences();
}

View File

@@ -92,7 +92,7 @@ public class NpcPersonalAIData
{
if (_AIData.containsKey(spawnName))
{
Map<String, Integer> map = _AIData.get(spawnName);
final Map<String, Integer> map = _AIData.get(spawnName);
try
{

View File

@@ -90,7 +90,7 @@ public final class SpawnTable implements IXmlReader
*/
private boolean checkTemplate(int npcId)
{
L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcId);
final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcId);
if (npcTemplate == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Data missing in NPC table for ID: " + npcId + ".");
@@ -198,7 +198,7 @@ public final class SpawnTable implements IXmlReader
continue;
}
StatsSet spawnInfo = new StatsSet();
final StatsSet spawnInfo = new StatsSet();
spawnInfo.set("npcTemplateid", templateId);
spawnInfo.set("x", x);
spawnInfo.set("y", y);
@@ -229,7 +229,7 @@ public final class SpawnTable implements IXmlReader
if (attrs.getNamedItem("periodOfDay") != null)
{
String period = attrs.getNamedItem("periodOfDay").getNodeValue();
final String period = attrs.getNamedItem("periodOfDay").getNodeValue();
if (period.equalsIgnoreCase("day") || period.equalsIgnoreCase("night"))
{
spawnInfo.set("periodOfDay", period.equalsIgnoreCase("day") ? 1 : 2);
@@ -259,8 +259,8 @@ public final class SpawnTable implements IXmlReader
{
while (rs.next())
{
StatsSet spawnInfo = new StatsSet();
int npcId = rs.getInt("npc_templateid");
final StatsSet spawnInfo = new StatsSet();
final int npcId = rs.getInt("npc_templateid");
// Check basic requirements first
if (!checkTemplate(npcId))
@@ -310,8 +310,8 @@ public final class SpawnTable implements IXmlReader
spawnDat.setHeading(spawnInfo.getInt("heading", -1));
spawnDat.setRespawnDelay(spawnInfo.getInt("respawnDelay", 0), spawnInfo.getInt("respawnRandom", 0));
spawnDat.setLocationId(spawnInfo.getInt("locId", 0));
String territoryName = spawnInfo.getString("territoryName", "");
String spawnName = spawnInfo.getString("spawnName", "");
final String territoryName = spawnInfo.getString("territoryName", "");
final String spawnName = spawnInfo.getString("spawnName", "");
spawnDat.setCustom(spawnInfo.getBoolean("isCustomSpawn", false));
if (!spawnName.isEmpty())
{
@@ -479,7 +479,7 @@ public final class SpawnTable implements IXmlReader
final Set<L2Spawn> set = _spawnTable.get(spawn.getId());
if (set != null)
{
boolean removed = set.remove(spawn);
final boolean removed = set.remove(spawn);
if (set.isEmpty())
{
_spawnTable.remove(spawn.getId());

View File

@@ -161,7 +161,7 @@ public abstract class DocumentBase
Document doc = null;
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
doc = factory.newDocumentBuilder().parse(_file);
@@ -208,8 +208,8 @@ public abstract class DocumentBase
if ("cond".equalsIgnoreCase(n.getNodeName()))
{
condition = parseCondition(n.getFirstChild(), template);
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -217,7 +217,7 @@ public abstract class DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -257,7 +257,7 @@ public abstract class DocumentBase
protected void attachFunc(Node n, Object template, String functionName, Condition attachCond)
{
Stats stat = Stats.valueOfXml(n.getAttributes().getNamedItem("stat").getNodeValue());
final Stats stat = Stats.valueOfXml(n.getAttributes().getNamedItem("stat").getNodeValue());
int order = -1;
final Node orderNode = n.getAttributes().getNamedItem("order");
if (orderNode != null)
@@ -265,7 +265,7 @@ public abstract class DocumentBase
order = Integer.parseInt(orderNode.getNodeValue());
}
String valueString = n.getAttributes().getNamedItem("val").getNodeValue();
final String valueString = n.getAttributes().getNamedItem("val").getNodeValue();
double value;
if (valueString.charAt(0) == '#')
{
@@ -303,7 +303,7 @@ public abstract class DocumentBase
final StatsSet set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
Node att = attrs.item(i);
final Node att = attrs.item(i);
set.set(att.getNodeName(), getValue(att.getNodeValue(), template));
}
@@ -357,10 +357,10 @@ public abstract class DocumentBase
{
parameters = new StatsSet();
}
NamedNodeMap params = n.getAttributes();
final NamedNodeMap params = n.getAttributes();
for (int i = 0; i < params.getLength(); i++)
{
Node att = params.item(i);
final Node att = params.item(i);
parameters.set(att.getNodeName(), getValue(att.getNodeValue(), template));
}
}
@@ -423,7 +423,7 @@ public abstract class DocumentBase
protected Condition parseLogicAnd(Node n, Object template)
{
ConditionLogicAnd cond = new ConditionLogicAnd();
final ConditionLogicAnd cond = new ConditionLogicAnd();
for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
{
if (n.getNodeType() == Node.ELEMENT_NODE)
@@ -440,7 +440,7 @@ public abstract class DocumentBase
protected Condition parseLogicOr(Node n, Object template)
{
ConditionLogicOr cond = new ConditionLogicOr();
final ConditionLogicOr cond = new ConditionLogicOr();
for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
{
if (n.getNodeType() == Node.ELEMENT_NODE)
@@ -471,10 +471,10 @@ public abstract class DocumentBase
protected Condition parsePlayerCondition(Node n, Object template)
{
Condition cond = null;
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node a = attrs.item(i);
final Node a = attrs.item(i);
switch (a.getNodeName().toLowerCase())
{
case "races":
@@ -493,16 +493,16 @@ public abstract class DocumentBase
}
case "level":
{
int lvl = Integer.decode(getValue(a.getNodeValue(), template));
final int lvl = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerLevel(lvl));
break;
}
case "levelrange":
{
String[] range = getValue(a.getNodeValue(), template).split(";");
final String[] range = getValue(a.getNodeValue(), template).split(";");
if (range.length == 2)
{
int[] lvlRange = new int[2];
final int[] lvlRange = new int[2];
lvlRange[0] = Integer.decode(getValue(a.getNodeValue(), template).split(";")[0]);
lvlRange[1] = Integer.decode(getValue(a.getNodeValue(), template).split(";")[1]);
cond = joinAnd(cond, new ConditionPlayerLevelRange(lvlRange));
@@ -511,161 +511,161 @@ public abstract class DocumentBase
}
case "resting":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.RESTING, val));
break;
}
case "flying":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.FLYING, val));
break;
}
case "moving":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.MOVING, val));
break;
}
case "running":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.RUNNING, val));
break;
}
case "standing":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.STANDING, val));
break;
}
case "behind":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.BEHIND, val));
break;
}
case "front":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.FRONT, val));
break;
}
case "chaotic":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.CHAOTIC, val));
break;
}
case "olympiad":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(PlayerState.OLYMPIAD, val));
break;
}
case "ishero":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerIsHero(val));
break;
}
case "transformationid":
{
int id = Integer.parseInt(a.getNodeValue());
final int id = Integer.parseInt(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerTransformationId(id));
break;
}
case "hp":
{
int hp = Integer.decode(getValue(a.getNodeValue(), template));
final int hp = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerHp(hp));
break;
}
case "mp":
{
int mp = Integer.decode(getValue(a.getNodeValue(), template));
final int mp = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerMp(mp));
break;
}
case "cp":
{
int cp = Integer.decode(getValue(a.getNodeValue(), template));
final int cp = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerCp(cp));
break;
}
case "grade":
{
int expIndex = Integer.decode(getValue(a.getNodeValue(), template));
final int expIndex = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerGrade(expIndex));
break;
}
case "pkcount":
{
int expIndex = Integer.decode(getValue(a.getNodeValue(), template));
final int expIndex = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerPkCount(expIndex));
break;
}
case "siegezone":
{
int value = Integer.decode(getValue(a.getNodeValue(), null));
final int value = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionSiegeZone(value, true));
break;
}
case "siegeside":
{
int value = Integer.decode(getValue(a.getNodeValue(), null));
final int value = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerSiegeSide(value));
break;
}
case "charges":
{
int value = Integer.decode(getValue(a.getNodeValue(), template));
final int value = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerCharges(value));
break;
}
case "souls":
{
int value = Integer.decode(getValue(a.getNodeValue(), template));
final int value = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerSouls(value));
break;
}
case "weight":
{
int weight = Integer.decode(getValue(a.getNodeValue(), null));
final int weight = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerWeight(weight));
break;
}
case "invsize":
{
int size = Integer.decode(getValue(a.getNodeValue(), null));
final int size = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerInvSize(size));
break;
}
case "isclanleader":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerIsClanLeader(val));
break;
}
case "ontvtevent":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerTvTEvent(val));
break;
}
case "pledgeclass":
{
int pledgeClass = Integer.decode(getValue(a.getNodeValue(), null));
final int pledgeClass = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerPledgeClass(pledgeClass));
break;
}
case "clanhall":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, template)));
}
cond = joinAnd(cond, new ConditionPlayerHasClanHall(array));
@@ -673,75 +673,75 @@ public abstract class DocumentBase
}
case "fort":
{
int fort = Integer.decode(getValue(a.getNodeValue(), null));
final int fort = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerHasFort(fort));
break;
}
case "castle":
{
int castle = Integer.decode(getValue(a.getNodeValue(), null));
final int castle = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerHasCastle(castle));
break;
}
case "sex":
{
int sex = Integer.decode(getValue(a.getNodeValue(), null));
final int sex = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionPlayerSex(sex));
break;
}
case "flymounted":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerFlyMounted(val));
break;
}
case "vehiclemounted":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerVehicleMounted(val));
break;
}
case "landingzone":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerLandingZone(val));
break;
}
case "active_effect_id":
{
int effect_id = Integer.decode(getValue(a.getNodeValue(), template));
final int effect_id = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerActiveEffectId(effect_id));
break;
}
case "active_effect_id_lvl":
{
String val = getValue(a.getNodeValue(), template);
int effect_id = Integer.decode(getValue(val.split(",")[0], template));
int effect_lvl = Integer.decode(getValue(val.split(",")[1], template));
final String val = getValue(a.getNodeValue(), template);
final int effect_id = Integer.decode(getValue(val.split(",")[0], template));
final int effect_lvl = Integer.decode(getValue(val.split(",")[1], template));
cond = joinAnd(cond, new ConditionPlayerActiveEffectId(effect_id, effect_lvl));
break;
}
case "active_skill_id":
{
int skill_id = Integer.decode(getValue(a.getNodeValue(), template));
final int skill_id = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionPlayerActiveSkillId(skill_id));
break;
}
case "active_skill_id_lvl":
{
String val = getValue(a.getNodeValue(), template);
int skill_id = Integer.decode(getValue(val.split(",")[0], template));
int skill_lvl = Integer.decode(getValue(val.split(",")[1], template));
final String val = getValue(a.getNodeValue(), template);
final int skill_id = Integer.decode(getValue(val.split(",")[0], template));
final int skill_lvl = Integer.decode(getValue(val.split(",")[1], template));
cond = joinAnd(cond, new ConditionPlayerActiveSkillId(skill_id, skill_lvl));
break;
}
case "class_id_restriction":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, template)));
}
cond = joinAnd(cond, new ConditionPlayerClassIdRestriction(array));
@@ -749,7 +749,7 @@ public abstract class DocumentBase
}
case "subclass":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerSubclass(val));
break;
}
@@ -760,11 +760,11 @@ public abstract class DocumentBase
}
case "instanceid":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, template)));
}
cond = joinAnd(cond, new ConditionPlayerInstanceId(array));
@@ -772,23 +772,23 @@ public abstract class DocumentBase
}
case "agathionid":
{
int agathionId = Integer.decode(a.getNodeValue());
final int agathionId = Integer.decode(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerAgathionId(agathionId));
break;
}
case "cloakstatus":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerCloakStatus(val));
break;
}
case "haspet":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
ArrayList<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final ArrayList<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, template)));
}
cond = joinAnd(cond, new ConditionPlayerHasPet(array));
@@ -888,11 +888,11 @@ public abstract class DocumentBase
}
case "insidezoneid":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
List<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, template)));
}
cond = joinAnd(cond, new ConditionPlayerInsideZoneId(array));
@@ -951,36 +951,36 @@ public abstract class DocumentBase
protected Condition parseTargetCondition(Node n, Object template)
{
Condition cond = null;
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node a = attrs.item(i);
final Node a = attrs.item(i);
switch (a.getNodeName().toLowerCase())
{
case "aggro":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionTargetAggro(val));
break;
}
case "siegezone":
{
int value = Integer.decode(getValue(a.getNodeValue(), null));
final int value = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionSiegeZone(value, false));
break;
}
case "level":
{
int lvl = Integer.decode(getValue(a.getNodeValue(), template));
final int lvl = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionTargetLevel(lvl));
break;
}
case "levelrange":
{
String[] range = getValue(a.getNodeValue(), template).split(";");
final String[] range = getValue(a.getNodeValue(), template).split(";");
if (range.length == 2)
{
int[] lvlRange = new int[2];
final int[] lvlRange = new int[2];
lvlRange[0] = Integer.decode(getValue(a.getNodeValue(), template).split(";")[0]);
lvlRange[1] = Integer.decode(getValue(a.getNodeValue(), template).split(";")[1]);
cond = joinAnd(cond, new ConditionTargetLevelRange(lvlRange));
@@ -999,11 +999,11 @@ public abstract class DocumentBase
}
case "class_id_restriction":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
List<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, null)));
}
cond = joinAnd(cond, new ConditionTargetClassIdRestriction(array));
@@ -1011,47 +1011,47 @@ public abstract class DocumentBase
}
case "active_effect_id":
{
int effect_id = Integer.decode(getValue(a.getNodeValue(), template));
final int effect_id = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionTargetActiveEffectId(effect_id));
break;
}
case "active_effect_id_lvl":
{
String val = getValue(a.getNodeValue(), template);
int effect_id = Integer.decode(getValue(val.split(",")[0], template));
int effect_lvl = Integer.decode(getValue(val.split(",")[1], template));
final String val = getValue(a.getNodeValue(), template);
final int effect_id = Integer.decode(getValue(val.split(",")[0], template));
final int effect_lvl = Integer.decode(getValue(val.split(",")[1], template));
cond = joinAnd(cond, new ConditionTargetActiveEffectId(effect_id, effect_lvl));
break;
}
case "active_skill_id":
{
int skill_id = Integer.decode(getValue(a.getNodeValue(), template));
final int skill_id = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionTargetActiveSkillId(skill_id));
break;
}
case "active_skill_id_lvl":
{
String val = getValue(a.getNodeValue(), template);
int skill_id = Integer.decode(getValue(val.split(",")[0], template));
int skill_lvl = Integer.decode(getValue(val.split(",")[1], template));
final String val = getValue(a.getNodeValue(), template);
final int skill_id = Integer.decode(getValue(val.split(",")[0], template));
final int skill_lvl = Integer.decode(getValue(val.split(",")[1], template));
cond = joinAnd(cond, new ConditionTargetActiveSkillId(skill_id, skill_lvl));
break;
}
case "abnormaltype":
{
AbnormalType abnormalType = AbnormalType.getAbnormalType(getValue(a.getNodeValue(), template));
final AbnormalType abnormalType = AbnormalType.getAbnormalType(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionTargetAbnormalType(abnormalType));
break;
}
case "hp":
{
int hp = Integer.decode(getValue(a.getNodeValue(), template));
final int hp = Integer.decode(getValue(a.getNodeValue(), template));
cond = joinAnd(cond, new ConditionTargetHp(hp));
break;
}
case "mindistance":
{
int distance = Integer.decode(getValue(a.getNodeValue(), null));
final int distance = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionMinDistance(distance * distance));
break;
}
@@ -1063,10 +1063,10 @@ public abstract class DocumentBase
case "using":
{
int mask = 0;
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
for (WeaponType wt : WeaponType.values())
{
if (wt.name().equals(item))
@@ -1089,11 +1089,11 @@ public abstract class DocumentBase
}
case "npcid":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
List<Integer> array = new ArrayList<>(st.countTokens());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final List<Integer> array = new ArrayList<>(st.countTokens());
while (st.hasMoreTokens())
{
String item = st.nextToken().trim();
final String item = st.nextToken().trim();
array.add(Integer.decode(getValue(item, null)));
}
cond = joinAnd(cond, new ConditionTargetNpcId(array));
@@ -1101,9 +1101,9 @@ public abstract class DocumentBase
}
case "npctype":
{
String values = getValue(a.getNodeValue(), template).trim();
String[] valuesSplit = values.split(",");
InstanceType[] types = new InstanceType[valuesSplit.length];
final String values = getValue(a.getNodeValue(), template).trim();
final String[] valuesSplit = values.split(",");
final InstanceType[] types = new InstanceType[valuesSplit.length];
InstanceType type;
for (int j = 0; j < valuesSplit.length; j++)
{
@@ -1119,13 +1119,13 @@ public abstract class DocumentBase
}
case "weight":
{
int weight = Integer.decode(getValue(a.getNodeValue(), null));
final int weight = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionTargetWeight(weight));
break;
}
case "invsize":
{
int size = Integer.decode(getValue(a.getNodeValue(), null));
final int size = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionTargetInvSize(size));
break;
}
@@ -1142,20 +1142,20 @@ public abstract class DocumentBase
protected Condition parseUsingCondition(Node n)
{
Condition cond = null;
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node a = attrs.item(i);
final Node a = attrs.item(i);
switch (a.getNodeName().toLowerCase())
{
case "kind":
{
int mask = 0;
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
while (st.hasMoreTokens())
{
int old = mask;
String item = st.nextToken().trim();
final int old = mask;
final String item = st.nextToken().trim();
for (WeaponType wt : WeaponType.values())
{
if (wt.name().equals(item))
@@ -1183,11 +1183,11 @@ public abstract class DocumentBase
case "slot":
{
int mask = 0;
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
while (st.hasMoreTokens())
{
int old = mask;
String item = st.nextToken().trim();
final int old = mask;
final String item = st.nextToken().trim();
if (ItemTable.SLOTS.containsKey(item))
{
mask |= ItemTable.SLOTS.get(item);
@@ -1203,15 +1203,15 @@ public abstract class DocumentBase
}
case "skill":
{
int id = Integer.parseInt(a.getNodeValue());
final int id = Integer.parseInt(a.getNodeValue());
cond = joinAnd(cond, new ConditionUsingSkill(id));
break;
}
case "slotitem":
{
StringTokenizer st = new StringTokenizer(a.getNodeValue(), ";");
int id = Integer.parseInt(st.nextToken().trim());
int slot = Integer.parseInt(st.nextToken().trim());
final StringTokenizer st = new StringTokenizer(a.getNodeValue(), ";");
final int id = Integer.parseInt(st.nextToken().trim());
final int slot = Integer.parseInt(st.nextToken().trim());
int enchant = 0;
if (st.hasMoreTokens())
{
@@ -1222,7 +1222,7 @@ public abstract class DocumentBase
}
case "weaponchange":
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionChangeWeapon(val));
break;
}
@@ -1239,23 +1239,23 @@ public abstract class DocumentBase
protected Condition parseGameCondition(Node n)
{
Condition cond = null;
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
{
Node a = attrs.item(i);
final Node a = attrs.item(i);
if ("skill".equalsIgnoreCase(a.getNodeName()))
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionWithSkill(val));
}
if ("night".equalsIgnoreCase(a.getNodeName()))
{
boolean val = Boolean.parseBoolean(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionGameTime(CheckGameTime.NIGHT, val));
}
if ("chance".equalsIgnoreCase(a.getNodeName()))
{
int val = Integer.decode(getValue(a.getNodeValue(), null));
final int val = Integer.decode(getValue(a.getNodeValue(), null));
cond = joinAnd(cond, new ConditionGameChance(val));
}
}
@@ -1268,14 +1268,14 @@ public abstract class DocumentBase
protected void parseTable(Node n)
{
NamedNodeMap attrs = n.getAttributes();
String name = attrs.getNamedItem("name").getNodeValue();
final NamedNodeMap attrs = n.getAttributes();
final String name = attrs.getNamedItem("name").getNodeValue();
if (name.charAt(0) != '#')
{
throw new IllegalArgumentException("Table name must start with #");
}
StringTokenizer data = new StringTokenizer(n.getFirstChild().getNodeValue());
List<String> array = new ArrayList<>(data.countTokens());
final StringTokenizer data = new StringTokenizer(n.getFirstChild().getNodeValue());
final List<String> array = new ArrayList<>(data.countTokens());
while (data.hasMoreTokens())
{
array.add(data.nextToken());
@@ -1285,9 +1285,9 @@ public abstract class DocumentBase
protected void parseBeanSet(Node n, StatsSet set, Integer level)
{
String name = n.getAttributes().getNamedItem("name").getNodeValue().trim();
String value = n.getAttributes().getNamedItem("val").getNodeValue().trim();
char ch = value.isEmpty() ? ' ' : value.charAt(0);
final String name = n.getAttributes().getNamedItem("name").getNodeValue().trim();
final String value = n.getAttributes().getNamedItem("val").getNodeValue().trim();
final char ch = value.isEmpty() ? ' ' : value.charAt(0);
if ((ch == '#') || (ch == '-') || Character.isDigit(ch))
{
set.set(name, String.valueOf(getValue(value, level)));
@@ -1345,7 +1345,7 @@ public abstract class DocumentBase
((ConditionLogicAnd) cond).add(c);
return cond;
}
ConditionLogicAnd and = new ConditionLogicAnd();
final ConditionLogicAnd and = new ConditionLogicAnd();
and.add(cond);
and.add(c);
return and;

View File

@@ -63,7 +63,7 @@ public class DocumentEngine
private void hashFiles(String dirname, List<File> hash)
{
File dir = new File(Config.DATAPACK_ROOT, dirname);
final File dir = new File(Config.DATAPACK_ROOT, dirname);
if (!dir.exists())
{
_log.warning("Dir " + dir.getAbsolutePath() + " not exists");
@@ -87,7 +87,7 @@ public class DocumentEngine
_log.warning("Skill file not found.");
return null;
}
DocumentSkill doc = new DocumentSkill(file);
final DocumentSkill doc = new DocumentSkill(file);
doc.parse();
return doc.getSkills();
}
@@ -97,7 +97,7 @@ public class DocumentEngine
int count = 0;
for (File file : _skillFiles)
{
List<Skill> s = loadSkills(file);
final List<Skill> s = loadSkills(file);
if (s == null)
{
continue;
@@ -117,10 +117,10 @@ public class DocumentEngine
*/
public List<L2Item> loadItems()
{
List<L2Item> list = new ArrayList<>();
final List<L2Item> list = new ArrayList<>();
for (File f : _itemFiles)
{
DocumentItem document = new DocumentItem(f);
final DocumentItem document = new DocumentItem(f);
document.parse();
list.addAll(document.getItemList());
}

View File

@@ -98,9 +98,9 @@ public final class DocumentItem extends DocumentBase
protected void parseItem(Node n) throws InvocationTargetException
{
int itemId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
String className = n.getAttributes().getNamedItem("type").getNodeValue();
String itemName = n.getAttributes().getNamedItem("name").getNodeValue();
final int itemId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
final String className = n.getAttributes().getNamedItem("type").getNodeValue();
final String itemName = n.getAttributes().getNamedItem("name").getNodeValue();
_currentItem.id = itemId;
_currentItem.name = itemName;
@@ -109,7 +109,7 @@ public final class DocumentItem extends DocumentBase
_currentItem.set.set("item_id", itemId);
_currentItem.set.set("name", itemName);
Node first = n.getFirstChild();
final Node first = n.getFirstChild();
for (n = first; n != null; n = n.getNextSibling())
{
if ("table".equalsIgnoreCase(n.getNodeName()))
@@ -136,9 +136,9 @@ public final class DocumentItem extends DocumentBase
else if ("cond".equalsIgnoreCase(n.getNodeName()))
{
makeItem();
Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentItem.item);
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -146,7 +146,7 @@ public final class DocumentItem extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -167,7 +167,7 @@ public final class DocumentItem extends DocumentBase
}
try
{
Constructor<?> c = Class.forName("com.l2jserver.gameserver.model.items.L2" + _currentItem.type).getConstructor(StatsSet.class);
final Constructor<?> c = Class.forName("com.l2jserver.gameserver.model.items.L2" + _currentItem.type).getConstructor(StatsSet.class);
_currentItem.item = (L2Item) c.newInstance(_currentItem.set);
}
catch (Exception e)

View File

@@ -139,7 +139,7 @@ public class DocumentSkill extends DocumentBase
protected void parseSkill(Node n)
{
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
int enchantLevels1 = 0;
int enchantLevels2 = 0;
int enchantLevels3 = 0;
@@ -149,10 +149,10 @@ public class DocumentSkill extends DocumentBase
int enchantLevels7 = 0;
int enchantLevels8 = 0;
int enchantLevels9 = 0;
int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
String skillName = attrs.getNamedItem("name").getNodeValue();
String levels = attrs.getNamedItem("levels").getNodeValue();
int lastLvl = Integer.parseInt(levels);
final int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
final String skillName = attrs.getNamedItem("name").getNodeValue();
final String levels = attrs.getNamedItem("levels").getNodeValue();
final int lastLvl = Integer.parseInt(levels);
if (attrs.getNamedItem("enchantGroup1") != null)
{
enchantLevels1 = EnchantSkillGroupsData.getInstance().addNewRouteForSkill(skillId, lastLvl, 1, Integer.parseInt(attrs.getNamedItem("enchantGroup1").getNodeValue()));
@@ -216,7 +216,7 @@ public class DocumentSkill extends DocumentBase
throw new RuntimeException("Skill id=" + skillId + " number of levels missmatch, " + lastLvl + " levels expected");
}
Node first = n.getFirstChild();
final Node first = n.getFirstChild();
for (n = first; n != null; n = n.getNextSibling())
{
if ("table".equalsIgnoreCase(n.getNodeName()))
@@ -545,9 +545,9 @@ public class DocumentSkill extends DocumentBase
{
if ("cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -555,7 +555,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -603,9 +603,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -613,7 +613,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -665,9 +665,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -675,7 +675,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -723,9 +723,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -733,7 +733,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -785,9 +785,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -795,7 +795,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -839,9 +839,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -849,7 +849,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -901,9 +901,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -911,7 +911,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -959,9 +959,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -969,7 +969,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1021,9 +1021,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1031,7 +1031,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1079,9 +1079,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1089,7 +1089,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1141,9 +1141,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1151,7 +1151,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1199,9 +1199,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1209,7 +1209,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1261,9 +1261,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1271,7 +1271,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1319,9 +1319,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant7cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1329,7 +1329,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1381,9 +1381,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1391,7 +1391,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1439,9 +1439,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant8cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1449,7 +1449,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1501,9 +1501,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1511,7 +1511,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1559,9 +1559,9 @@ public class DocumentSkill extends DocumentBase
if ("enchant9cond".equalsIgnoreCase(n.getNodeName()))
{
foundCond = true;
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1569,7 +1569,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();
@@ -1621,9 +1621,9 @@ public class DocumentSkill extends DocumentBase
{
if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
{
Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
Node msg = n.getAttributes().getNamedItem("msg");
Node msgId = n.getAttributes().getNamedItem("msgId");
final Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
final Node msg = n.getAttributes().getNamedItem("msg");
final Node msgId = n.getAttributes().getNamedItem("msgId");
if ((condition != null) && (msg != null))
{
condition.setMessage(msg.getNodeValue());
@@ -1631,7 +1631,7 @@ public class DocumentSkill extends DocumentBase
else if ((condition != null) && (msgId != null))
{
condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
Node addName = n.getAttributes().getNamedItem("addName");
final Node addName = n.getAttributes().getNamedItem("addName");
if ((addName != null) && (Integer.decode(getValue(msgId.getNodeValue(), null)) > 0))
{
condition.addName();

View File

@@ -36,7 +36,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
@Override
public void registerHandler(IAdminCommandHandler handler)
{
String[] ids = handler.getAdminCommandList();
final String[] ids = handler.getAdminCommandList();
for (String id : ids)
{
_datatable.put(id, handler);
@@ -46,7 +46,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
@Override
public synchronized void removeHandler(IAdminCommandHandler handler)
{
String[] ids = handler.getAdminCommandList();
final String[] ids = handler.getAdminCommandList();
for (String id : ids)
{
_datatable.remove(id);

View File

@@ -66,7 +66,7 @@ public final class EffectHandler implements IHandler<Class<? extends AbstractEff
try
{
File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/EffectMasterHandler.java");
final File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "handlers/EffectMasterHandler.java");
L2ScriptEngineManager.getInstance().executeScript(file);
}
catch (Exception e)

View File

@@ -36,7 +36,7 @@ public class UserCommandHandler implements IHandler<IUserCommandHandler, Integer
@Override
public void registerHandler(IUserCommandHandler handler)
{
int[] ids = handler.getUserCommandList();
final int[] ids = handler.getUserCommandList();
for (int id : ids)
{
_datatable.put(id, handler);
@@ -46,7 +46,7 @@ public class UserCommandHandler implements IHandler<IUserCommandHandler, Integer
@Override
public synchronized void removeHandler(IUserCommandHandler handler)
{
int[] ids = handler.getUserCommandList();
final int[] ids = handler.getUserCommandList();
for (int id : ids)
{
_datatable.remove(id);

View File

@@ -36,7 +36,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
@Override
public void registerHandler(IVoicedCommandHandler handler)
{
String[] ids = handler.getVoicedCommandList();
final String[] ids = handler.getVoicedCommandList();
for (String id : ids)
{
_datatable.put(id, handler);
@@ -46,7 +46,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
@Override
public synchronized void removeHandler(IVoicedCommandHandler handler)
{
String[] ids = handler.getVoicedCommandList();
final String[] ids = handler.getVoicedCommandList();
for (String id : ids)
{
_datatable.remove(id);

View File

@@ -71,7 +71,7 @@ public class BitSetIDFactory extends IdFactory
for (int usedObjectId : extractUsedObjectIDTable())
{
int objectID = usedObjectId - FIRST_OID;
final int objectID = usedObjectId - FIRST_OID;
if (objectID < 0)
{
_log.warning(getClass().getSimpleName() + ": Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
@@ -108,7 +108,7 @@ public class BitSetIDFactory extends IdFactory
@Override
public synchronized int getNextId()
{
int newID = _nextFreeId.get();
final int newID = _nextFreeId.get();
_freeIds.set(newID);
_freeIdCount.decrementAndGet();
@@ -159,7 +159,7 @@ public class BitSetIDFactory extends IdFactory
protected synchronized void increaseBitSetCapacity()
{
BitSet newBitSet = new BitSet(PrimeFinder.nextPrime((usedIdCount() * 11) / 10));
final BitSet newBitSet = new BitSet(PrimeFinder.nextPrime((usedIdCount() * 11) / 10));
newBitSet.or(_freeIds);
_freeIds = newBitSet;
}

View File

@@ -43,7 +43,7 @@ public class CompactionIDFactory extends IdFactory
try (Connection con = ConnectionFactory.getInstance().getConnection())
{
Integer[] tmp_obj_ids = extractUsedObjectIDTable();
final Integer[] tmp_obj_ids = extractUsedObjectIDTable();
int N = tmp_obj_ids.length;
for (int idx = 0; idx < N; idx++)
@@ -81,7 +81,7 @@ public class CompactionIDFactory extends IdFactory
{
while (rs.next())
{
int badId = rs.getInt(1);
final int badId = rs.getInt(1);
_log.severe(getClass().getSimpleName() + ": Bad ID " + badId + " in DB found by: " + check);
throw new RuntimeException();
}

View File

@@ -195,7 +195,7 @@ public abstract class IdFactory
try (Connection con = ConnectionFactory.getInstance().getConnection();
Statement stmt = con.createStatement())
{
long cleanupStart = System.currentTimeMillis();
final long cleanupStart = System.currentTimeMillis();
int cleanCount = 0;
// Misc/Account Related
// Please read the descriptions above each before uncommenting them. If you are still

View File

@@ -48,7 +48,7 @@ public class StackIDFactory extends IdFactory
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
Integer[] tmp_obj_ids = extractUsedObjectIDTable();
final Integer[] tmp_obj_ids = extractUsedObjectIDTable();
if (tmp_obj_ids.length > 0)
{
_curOID = tmp_obj_ids[tmp_obj_ids.length - 1];
@@ -73,7 +73,7 @@ public class StackIDFactory extends IdFactory
private int insertUntil(Integer[] tmp_obj_ids, int idx, int N, Connection con) throws SQLException
{
int id = tmp_obj_ids[idx];
final int id = tmp_obj_ids[idx];
if (id == _tempOID)
{
_tempOID++;
@@ -93,7 +93,7 @@ public class StackIDFactory extends IdFactory
{
while (rs.next())
{
int badId = rs.getInt(1);
final int badId = rs.getInt(1);
_log.severe("Bad ID " + badId + " in DB found by: " + check);
throw new RuntimeException();
}

View File

@@ -53,7 +53,7 @@ public class AirShipManager
protected AirShipManager()
{
StatsSet npcDat = new StatsSet();
final StatsSet npcDat = new StatsSet();
npcDat.set("npcId", 9);
npcDat.set("level", 0);
npcDat.set("jClass", "boat");
@@ -223,7 +223,7 @@ public class AirShipManager
return;
}
int dockId = ship.getDockId();
final int dockId = ship.getDockId();
if (!_teleports.containsKey(dockId))
{
return;
@@ -292,7 +292,7 @@ public class AirShipManager
private void storeInDb(int ownerId)
{
StatsSet info = _airShipsInfo.get(ownerId);
final StatsSet info = _airShipsInfo.get(ownerId);
if (info == null)
{
return;

View File

@@ -59,7 +59,7 @@ public class BoatManager
return null;
}
StatsSet npcDat = new StatsSet();
final StatsSet npcDat = new StatsSet();
npcDat.set("npcId", boatId);
npcDat.set("level", 0);
npcDat.set("jClass", "boat");

View File

@@ -64,7 +64,7 @@ public final class CHSiegeManager
{
final int id = rs.getInt("clanHallId");
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
set.set("id", id);
set.set("name", rs.getString("name"));
@@ -74,7 +74,7 @@ public final class CHSiegeManager
set.set("nextSiege", rs.getLong("nextSiege"));
set.set("siegeLenght", rs.getLong("siegeLenght"));
set.set("scheduleConfig", rs.getString("schedule_config"));
SiegableHall hall = new SiegableHall(set);
final SiegableHall hall = new SiegableHall(set);
_siegableHalls.put(id, hall);
ClanHallManager.addClanHall(hall);
}
@@ -118,7 +118,7 @@ public final class CHSiegeManager
public final ClanHallSiegeEngine getSiege(L2Character character)
{
SiegableHall hall = getNearbyClanHall(character);
final SiegableHall hall = getNearbyClanHall(character);
if (hall == null)
{
return null;
@@ -134,7 +134,7 @@ public final class CHSiegeManager
}
else if (hall.isWaitingBattle())
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DEADLINE_TO_REGISTER_FOR_THE_SIEGE_OF_S1_HAS_PASSED);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_DEADLINE_TO_REGISTER_FOR_THE_SIEGE_OF_S1_HAS_PASSED);
sm.addString(hall.getName());
player.sendPacket(sm);
}

View File

@@ -225,8 +225,8 @@ public final class CastleManager implements InstanceListManager
{
return;
}
L2PcInstance player = member.getPlayerInstance();
int circletId = getCircletByCastleId(castleId);
final L2PcInstance player = member.getPlayerInstance();
final int circletId = getCircletByCastleId(castleId);
if (circletId != 0)
{
@@ -235,7 +235,7 @@ public final class CastleManager implements InstanceListManager
{
try
{
L2ItemInstance circlet = player.getInventory().getItemByItemId(circletId);
final L2ItemInstance circlet = player.getInventory().getItemByItemId(circletId);
if (circlet != null)
{
if (circlet.isEquipped())
@@ -293,7 +293,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void activateInstances()
{
for (final Castle castle : _castles)
for (Castle castle : _castles)
{
castle.activateInstance();
}

View File

@@ -118,7 +118,7 @@ public final class ClanHallAuctionManager
public final Auction getAuction(int auctionId)
{
int index = getAuctionIndex(auctionId);
final int index = getAuctionIndex(auctionId);
if (index >= 0)
{
return _auctions.get(index);

View File

@@ -71,7 +71,7 @@ public final class ClanHallManager
int id, ownerId, lease;
while (rs.next())
{
StatsSet set = new StatsSet();
final StatsSet set = new StatsSet();
id = rs.getInt("id");
ownerId = rs.getInt("ownerId");
@@ -86,7 +86,7 @@ public final class ClanHallManager
set.set("paidUntil", rs.getLong("paidUntil"));
set.set("grade", rs.getInt("Grade"));
set.set("paid", rs.getBoolean("paid"));
AuctionableHall ch = new AuctionableHall(set);
final AuctionableHall ch = new AuctionableHall(set);
_allAuctionableClanHalls.put(id, ch);
addClanHall(ch);
@@ -97,7 +97,7 @@ public final class ClanHallManager
}
_freeClanHall.put(id, ch);
Auction auc = ClanHallAuctionManager.getInstance().getAuction(id);
final Auction auc = ClanHallAuctionManager.getInstance().getAuction(id);
if ((auc == null) && (lease > 0))
{
ClanHallAuctionManager.getInstance().initNPC(id);

View File

@@ -71,7 +71,7 @@ public final class CoupleManager
public final Couple getCouple(int coupleId)
{
int index = getCoupleIndex(coupleId);
final int index = getCoupleIndex(coupleId);
if (index >= 0)
{
return getCouples().get(index);
@@ -85,10 +85,10 @@ public final class CoupleManager
{
if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0))
{
int player1id = player1.getObjectId();
int player2id = player2.getObjectId();
final int player1id = player1.getObjectId();
final int player2id = player2.getObjectId();
Couple couple = new Couple(player1, player2);
final Couple couple = new Couple(player1, player2);
getCouples().add(couple);
player1.setPartnerId(player2id);
player2.setPartnerId(player1id);
@@ -100,12 +100,12 @@ public final class CoupleManager
public void deleteCouple(int coupleId)
{
int index = getCoupleIndex(coupleId);
Couple couple = getCouples().get(index);
final int index = getCoupleIndex(coupleId);
final Couple couple = getCouples().get(index);
if (couple != null)
{
L2PcInstance player1 = L2World.getInstance().getPlayer(couple.getPlayer1Id());
L2PcInstance player2 = L2World.getInstance().getPlayer(couple.getPlayer2Id());
final L2PcInstance player1 = L2World.getInstance().getPlayer(couple.getPlayer1Id());
final L2PcInstance player2 = L2World.getInstance().getPlayer(couple.getPlayer2Id());
if (player1 != null)
{
player1.setPartnerId(0);

View File

@@ -92,18 +92,18 @@ public final class CursedWeaponsManager
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT + "/cursedWeapons.xml");
final File file = new File(Config.DATAPACK_ROOT + "/cursedWeapons.xml");
if (!file.exists())
{
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't find " + file.getName());
return;
}
Document doc = factory.newDocumentBuilder().parse(file);
final Document doc = factory.newDocumentBuilder().parse(file);
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
@@ -114,11 +114,11 @@ public final class CursedWeaponsManager
if ("item".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
int skillId = Integer.parseInt(attrs.getNamedItem("skillId").getNodeValue());
String name = attrs.getNamedItem("name").getNodeValue();
final int id = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
final int skillId = Integer.parseInt(attrs.getNamedItem("skillId").getNodeValue());
final String name = attrs.getNamedItem("name").getNodeValue();
CursedWeapon cw = new CursedWeapon(id, skillId, name);
final CursedWeapon cw = new CursedWeapon(id, skillId, name);
int val;
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
@@ -284,10 +284,10 @@ public final class CursedWeaponsManager
public void activate(L2PcInstance player, L2ItemInstance item)
{
CursedWeapon cw = _cursedWeapons.get(item.getId());
final CursedWeapon cw = _cursedWeapons.get(item.getId());
if (player.isCursedWeaponEquipped()) // cannot own 2 cursed swords
{
CursedWeapon cw2 = _cursedWeapons.get(player.getCursedWeaponEquippedId());
final CursedWeapon cw2 = _cursedWeapons.get(player.getCursedWeaponEquippedId());
// TODO: give the bonus level in a more appropriate manner.
// The following code adds "_stageKills" levels. This will also show in the char status.
// I do not have enough info to know if the bonus should be shown in the pk count, or if it
@@ -308,21 +308,21 @@ public final class CursedWeaponsManager
public void drop(int itemId, L2Character killer)
{
CursedWeapon cw = _cursedWeapons.get(itemId);
final CursedWeapon cw = _cursedWeapons.get(itemId);
cw.dropIt(killer);
}
public void increaseKills(int itemId)
{
CursedWeapon cw = _cursedWeapons.get(itemId);
final CursedWeapon cw = _cursedWeapons.get(itemId);
cw.increaseKills();
}
public int getLevel(int itemId)
{
CursedWeapon cw = _cursedWeapons.get(itemId);
final CursedWeapon cw = _cursedWeapons.get(itemId);
return cw.getLevel();
}
@@ -348,7 +348,7 @@ public final class CursedWeaponsManager
cw.giveSkill();
player.setCursedWeaponEquippedId(cw.getItemId());
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_S2_MINUTE_S_OF_USAGE_TIME_REMAINING);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_S2_MINUTE_S_OF_USAGE_TIME_REMAINING);
sm.addString(cw.getName());
// sm.addItemName(cw.getItemId());
sm.addInt((int) ((cw.getEndTime() - System.currentTimeMillis()) / 60000));

View File

@@ -102,7 +102,7 @@ public final class DayNightSpawnManager
}
spawn.stopRespawn();
L2Npc last = spawn.getLastSpawn();
final L2Npc last = spawn.getLastSpawn();
if (last != null)
{
last.deleteMe();
@@ -249,7 +249,7 @@ public final class DayNightSpawnManager
if (GameTimeController.getInstance().isNight())
{
L2RaidBossInstance raidboss = (L2RaidBossInstance) spawnDat.doSpawn();
final L2RaidBossInstance raidboss = (L2RaidBossInstance) spawnDat.doSpawn();
_bosses.put(spawnDat, raidboss);
return raidboss;

View File

@@ -54,7 +54,7 @@ public final class DuelManager
}
// return if a player has PvPFlag
String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat.";
final String engagedInPvP = "The duel was canceled because a duelist engaged in PvP combat.";
if (partyDuel)
{
boolean playerInPvP = false;
@@ -234,7 +234,7 @@ public final class DuelManager
if (reason != null)
{
SystemMessage msg = SystemMessage.getSystemMessage(reason);
final SystemMessage msg = SystemMessage.getSystemMessage(reason);
msg.addString(target.getName());
player.sendPacket(msg);
return false;

View File

@@ -87,7 +87,7 @@ public class FishingChampionshipManager
protected void setEndOfChamp()
{
Calendar finishtime = Calendar.getInstance();
final Calendar finishtime = Calendar.getInstance();
finishtime.setTimeInMillis(_enddate);
finishtime.set(Calendar.MINUTE, 0);
finishtime.set(Calendar.SECOND, 0);
@@ -103,11 +103,11 @@ public class FishingChampionshipManager
try (Connection con = ConnectionFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(SELECT);
ResultSet rs = statement.executeQuery();
final PreparedStatement statement = con.prepareStatement(SELECT);
final ResultSet rs = statement.executeQuery();
while (rs.next())
{
int rewarded = rs.getInt("rewarded");
final int rewarded = rs.getInt("rewarded");
if (rewarded == 0)
{
_tmpPlayers.add(new Fisher(rs.getString("player_name"), rs.getDouble("fish_length"), 0));

View File

@@ -191,7 +191,7 @@ public final class FortManager implements InstanceListManager
@Override
public void activateInstances()
{
for (final Fort fort : _forts)
for (Fort fort : _forts)
{
fort.activateInstance();
}

View File

@@ -143,8 +143,8 @@ public final class FortSiegeManager
for (Fort fort : FortManager.getInstance().getForts())
{
List<FortSiegeSpawn> commanderSpawns = new ArrayList<>();
List<CombatFlag> flagSpawns = new ArrayList<>();
final List<FortSiegeSpawn> commanderSpawns = new ArrayList<>();
final List<CombatFlag> flagSpawns = new ArrayList<>();
for (int i = 1; i < 5; i++)
{
final String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
@@ -156,11 +156,11 @@ public final class FortSiegeManager
try
{
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
int z = Integer.parseInt(st.nextToken());
int heading = Integer.parseInt(st.nextToken());
int npc_id = Integer.parseInt(st.nextToken());
final int x = Integer.parseInt(st.nextToken());
final int y = Integer.parseInt(st.nextToken());
final int z = Integer.parseInt(st.nextToken());
final int heading = Integer.parseInt(st.nextToken());
final int npc_id = Integer.parseInt(st.nextToken());
commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
}
@@ -183,10 +183,10 @@ public final class FortSiegeManager
try
{
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
int z = Integer.parseInt(st.nextToken());
int flag_id = Integer.parseInt(st.nextToken());
final int x = Integer.parseInt(st.nextToken());
final int y = Integer.parseInt(st.nextToken());
final int z = Integer.parseInt(st.nextToken());
final int flag_id = Integer.parseInt(st.nextToken());
flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
}

View File

@@ -201,7 +201,7 @@ public final class FourSepulchersManager
protected void timeSelector()
{
timeCalculator();
long currentTime = Calendar.getInstance().getTimeInMillis();
final long currentTime = Calendar.getInstance().getTimeInMillis();
// if current time >= time of entry beginning and if current time < time of entry beginning + time of entry end
if ((currentTime >= _coolDownTimeEnd) && (currentTime < _entryTimeEnd)) // entry time check
{
@@ -232,7 +232,7 @@ public final class FourSepulchersManager
// phase end times calculator
protected void timeCalculator()
{
Calendar tmp = Calendar.getInstance();
final Calendar tmp = Calendar.getInstance();
if (tmp.get(Calendar.MINUTE) < _newCycleMin)
{
tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
@@ -253,7 +253,7 @@ public final class FourSepulchersManager
LOG.warning("[" + i + "] is not inside " + _startHallSpawns);
continue;
}
int[] Location = _startHallSpawns.get(i);
final int[] Location = _startHallSpawns.get(i);
GrandBossManager.getInstance().getZone(Location[0], Location[1], Location[2]).oustAllPlayers();
}
@@ -427,7 +427,7 @@ public final class FourSepulchersManager
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"));
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
int keyNpcId = rs.getInt("key_npc_id");
final int keyNpcId = rs.getInt("key_npc_id");
_mysteriousBoxSpawns.put(keyNpcId, spawnDat);
}
}
@@ -477,7 +477,7 @@ public final class FourSepulchersManager
{
while (rs1.next())
{
int keyNpcId = rs1.getInt("key_npc_id");
final int keyNpcId = rs1.getInt("key_npc_id");
ps2.setInt(1, keyNpcId);
ps2.setInt(2, 1);
@@ -524,7 +524,7 @@ public final class FourSepulchersManager
{
while (rs1.next())
{
int keyNpcId = rs1.getInt("key_npc_id");
final int keyNpcId = rs1.getInt("key_npc_id");
ps2.setInt(1, keyNpcId);
ps2.setInt(2, 2);
@@ -573,7 +573,7 @@ public final class FourSepulchersManager
{
while (rs1.next())
{
int keyNpcId = rs1.getInt("key_npc_id");
final int keyNpcId = rs1.getInt("key_npc_id");
ps2.setInt(1, keyNpcId);
ps2.setInt(2, 5);
@@ -624,7 +624,7 @@ public final class FourSepulchersManager
{
while (rs1.next())
{
int keyNpcId = rs1.getInt("key_npc_id");
final int keyNpcId = rs1.getInt("key_npc_id");
ps2.setInt(1, keyNpcId);
ps2.setInt(2, 6);
@@ -660,7 +660,7 @@ public final class FourSepulchersManager
protected void initLocationShadowSpawns()
{
int locNo = Rnd.get(4);
final int locNo = Rnd.get(4);
final int[] gateKeeper =
{
31929,
@@ -841,13 +841,13 @@ public final class FourSepulchersManager
public synchronized void tryEntry(L2Npc npc, L2PcInstance player)
{
Quest hostQuest = QuestManager.getInstance().getQuest(QUEST_ID);
final Quest hostQuest = QuestManager.getInstance().getQuest(QUEST_ID);
if (hostQuest == null)
{
LOG.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't find quest: " + QUEST_ID);
return;
}
int npcId = npc.getId();
final int npcId = npc.getId();
switch (npcId)
{
// ID ok
@@ -888,7 +888,7 @@ public final class FourSepulchersManager
for (L2PcInstance mem : player.getParty().getMembers())
{
QuestState qs = mem.getQuestState(hostQuest.getName());
final QuestState qs = mem.getQuestState(hostQuest.getName());
if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
{
showHtmlFile(player, npcId + "-NS.htm", npc, mem);
@@ -916,7 +916,7 @@ public final class FourSepulchersManager
}
for (L2PcInstance mem : player.getParty().getMembers())
{
QuestState qs = mem.getQuestState(hostQuest.getName());
final QuestState qs = mem.getQuestState(hostQuest.getName());
if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
{
showHtmlFile(player, npcId + "-NS.htm", npc, mem);
@@ -937,7 +937,7 @@ public final class FourSepulchersManager
}
else
{
QuestState qs = player.getQuestState(hostQuest.getName());
final QuestState qs = player.getQuestState(hostQuest.getName());
if ((qs == null) || (!qs.isStarted() && !qs.isCompleted()))
{
showHtmlFile(player, npcId + "-NS.htm", npc, player);
@@ -969,7 +969,7 @@ public final class FourSepulchersManager
private void entry(int npcId, L2PcInstance player)
{
int[] Location = _startHallSpawns.get(npcId);
final int[] Location = _startHallSpawns.get(npcId);
int driftx;
int drifty;
@@ -996,7 +996,7 @@ public final class FourSepulchersManager
mem.addItem("Quest", USED_PASS, 1, mem, true);
}
L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
final L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
if (hallsKey != null)
{
mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
@@ -1030,7 +1030,7 @@ public final class FourSepulchersManager
mem.addItem("Quest", USED_PASS, 1, mem, true);
}
L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
final L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
if (hallsKey != null)
{
mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
@@ -1053,7 +1053,7 @@ public final class FourSepulchersManager
player.addItem("Quest", USED_PASS, 1, player, true);
}
L2ItemInstance hallsKey = player.getInventory().getItemByItemId(CHAPEL_KEY);
final L2ItemInstance hallsKey = player.getInventory().getItemByItemId(CHAPEL_KEY);
if (hallsKey != null)
{
player.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), player, true);
@@ -1072,7 +1072,7 @@ public final class FourSepulchersManager
return;
}
L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
final L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
if (spawnDat != null)
{
_allMobs.add(spawnDat.doSpawn());
@@ -1194,7 +1194,7 @@ public final class FourSepulchersManager
public synchronized boolean isViscountMobsAnnihilated(int npcId)
{
List<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
final List<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
if (mobs == null)
{
return true;
@@ -1213,7 +1213,7 @@ public final class FourSepulchersManager
public synchronized boolean isDukeMobsAnnihilated(int npcId)
{
List<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
final List<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
if (mobs == null)
{
return true;
@@ -1237,7 +1237,7 @@ public final class FourSepulchersManager
return;
}
L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getId());
final L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getId());
if (spawnDat != null)
{
spawnDat.setAmount(1);
@@ -1258,7 +1258,7 @@ public final class FourSepulchersManager
return;
}
L2Spawn spawnDat = _executionerSpawns.get(activeChar.getId());
final L2Spawn spawnDat = _executionerSpawns.get(activeChar.getId());
if (spawnDat != null)
{
spawnDat.setAmount(1);
@@ -1284,12 +1284,12 @@ public final class FourSepulchersManager
return;
}
List<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
final List<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
if (monsterList != null)
{
for (L2Spawn spawnDat : monsterList)
{
L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
final L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
spawnDat.stopRespawn();
if (mob != null)
@@ -1309,7 +1309,7 @@ public final class FourSepulchersManager
return;
}
List<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
final List<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
if (monsterList != null)
{
for (L2Spawn spawnDat : monsterList)
@@ -1322,7 +1322,7 @@ public final class FourSepulchersManager
public void locationShadowSpawns()
{
int locNo = Rnd.get(4);
final int locNo = Rnd.get(4);
final int[] gateKeeper =
{
31929,
@@ -1333,8 +1333,8 @@ public final class FourSepulchersManager
for (int i = 0; i <= 3; i++)
{
int keyNpcId = gateKeeper[i];
L2Spawn spawnDat = _shadowSpawns.get(keyNpcId);
final int keyNpcId = gateKeeper[i];
final L2Spawn spawnDat = _shadowSpawns.get(keyNpcId);
spawnDat.setX(_shadowSpawnLoc[locNo][i][1]);
spawnDat.setY(_shadowSpawnLoc[locNo][i][2]);
spawnDat.setZ(_shadowSpawnLoc[locNo][i][3]);
@@ -1350,10 +1350,10 @@ public final class FourSepulchersManager
return;
}
L2Spawn spawnDat = _shadowSpawns.get(npcId);
final L2Spawn spawnDat = _shadowSpawns.get(npcId);
if (spawnDat != null)
{
L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
final L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
spawnDat.stopRespawn();
if (mob != null)
@@ -1390,7 +1390,7 @@ public final class FourSepulchersManager
{
try
{
L2DoorInstance door = DoorData.getInstance().getDoor(doorId);
final L2DoorInstance door = DoorData.getInstance().getDoor(doorId);
if (door != null)
{
door.closeMe();
@@ -1528,8 +1528,8 @@ public final class FourSepulchersManager
else if (_inEntryTime)
{
NpcStringId msg1 = NpcStringId.YOU_MAY_NOW_ENTER_THE_SEPULCHER;
NpcStringId msg2 = NpcStringId.IF_YOU_PLACE_YOUR_HAND_ON_THE_STONE_STATUE_IN_FRONT_OF_EACH_SEPULCHER_YOU_WILL_BE_ABLE_TO_ENTER;
final NpcStringId msg1 = NpcStringId.YOU_MAY_NOW_ENTER_THE_SEPULCHER;
final NpcStringId msg2 = NpcStringId.IF_YOU_PLACE_YOUR_HAND_ON_THE_STONE_STATUE_IN_FRONT_OF_EACH_SEPULCHER_YOU_WILL_BE_ABLE_TO_ENTER;
for (L2Spawn temp : _managers)
{
if (temp == null)

View File

@@ -95,7 +95,7 @@ public final class GraciaSeedsManager
break;
case 2:
// Conquest Complete state, if too much time is passed than change to defense state
long timePast = System.currentTimeMillis() - _SoDLastStateChangeDate.getTimeInMillis();
final long timePast = System.currentTimeMillis() - _SoDLastStateChangeDate.getTimeInMillis();
if (timePast >= Config.SOD_STAGE_2_LENGTH)
{
// change to Attack state because Defend statet is not implemented
@@ -138,7 +138,7 @@ public final class GraciaSeedsManager
setSoDState(2, false);
}
saveData(SODTYPE);
Quest esQuest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
final Quest esQuest = QuestManager.getInstance().getQuest(ENERGY_SEEDS);
if (esQuest == null)
{
_log.warning(getClass().getSimpleName() + ": missing EnergySeeds Quest!");

View File

@@ -83,20 +83,20 @@ public final class GrandBossManager implements IStorable
{
// Read all info from DB, and store it for AI to read and decide what to do
// faster than accessing DB in real time
StatsSet info = new StatsSet();
int bossId = rs.getInt("boss_id");
final StatsSet info = new StatsSet();
final int bossId = rs.getInt("boss_id");
info.set("loc_x", rs.getInt("loc_x"));
info.set("loc_y", rs.getInt("loc_y"));
info.set("loc_z", rs.getInt("loc_z"));
info.set("heading", rs.getInt("heading"));
info.set("respawn_time", rs.getLong("respawn_time"));
double HP = rs.getDouble("currentHP"); // jython doesn't recognize doubles
int true_HP = (int) HP; // so use java's ability to type cast
final double HP = rs.getDouble("currentHP"); // jython doesn't recognize doubles
final int true_HP = (int) HP; // so use java's ability to type cast
info.set("currentHP", true_HP); // to convert double to int
double MP = rs.getDouble("currentMP");
int true_MP = (int) MP;
final double MP = rs.getDouble("currentMP");
final int true_MP = (int) MP;
info.set("currentMP", true_MP);
int status = rs.getInt("status");
final int status = rs.getInt("status");
_bossStatus.put(bossId, status);
_storedInfo.put(bossId, info);
_log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status + ".");
@@ -135,8 +135,8 @@ public final class GrandBossManager implements IStorable
{
while (rs.next())
{
int id = rs.getInt("player_id");
int zoneId = rs.getInt("zone");
final int id = rs.getInt("player_id");
final int zoneId = rs.getInt("zone");
zones.get(zoneId).add(id);
}
_log.info(getClass().getSimpleName() + ": Initialized " + _zones.size() + " Grand Boss Zones");
@@ -246,7 +246,7 @@ public final class GrandBossManager implements IStorable
{
for (Entry<Integer, L2BossZone> e : _zones.entrySet())
{
List<Integer> list = e.getValue().getAllowedPlayers();
final List<Integer> list = e.getValue().getAllowedPlayers();
if ((list == null) || list.isEmpty())
{
continue;
@@ -263,7 +263,7 @@ public final class GrandBossManager implements IStorable
for (Entry<Integer, StatsSet> e : _storedInfo.entrySet())
{
final L2GrandBossInstance boss = BOSSES.get(e.getKey());
StatsSet info = e.getValue();
final StatsSet info = e.getValue();
if ((boss == null) || (info == null))
{
try (PreparedStatement update = con.prepareStatement(UPDATE_GRAND_BOSS_DATA2))
@@ -312,8 +312,8 @@ public final class GrandBossManager implements IStorable
{
try (Connection con = ConnectionFactory.getInstance().getConnection())
{
L2GrandBossInstance boss = BOSSES.get(bossId);
StatsSet info = _storedInfo.get(bossId);
final L2GrandBossInstance boss = BOSSES.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
if (statusOnly || (boss == null) || (info == null))
{

View File

@@ -74,8 +74,8 @@ public final class HandysBlockCheckerManager
*/
public synchronized void increaseArenaVotes(int arena)
{
int newVotes = _arenaVotes.get(arena) + 1;
ArenaParticipantsHolder holder = _arenaPlayers[arena];
final int newVotes = _arenaVotes.get(arena) + 1;
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted())
{
@@ -149,7 +149,7 @@ public final class HandysBlockCheckerManager
*/
public boolean addPlayerToArena(L2PcInstance player, int arenaId)
{
ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
@@ -159,7 +159,7 @@ public final class HandysBlockCheckerManager
{
if (_arenaPlayers[i].getAllPlayers().contains(player))
{
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
msg.addCharName(player);
player.sendPacket(msg);
return false;
@@ -224,16 +224,16 @@ public final class HandysBlockCheckerManager
*/
public void removePlayer(L2PcInstance player, int arenaId, int team)
{
ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
boolean isRed = team == 0 ? true : false;
final boolean isRed = team == 0 ? true : false;
holder.removePlayer(player, team);
holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
// End event if theres an empty team
int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize();
final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize();
if (teamSize == 0)
{
holder.getEvent().endEventAbnormally();
@@ -252,11 +252,11 @@ public final class HandysBlockCheckerManager
*/
public void changePlayerToTeam(L2PcInstance player, int arena, int team)
{
ArenaParticipantsHolder holder = _arenaPlayers[arena];
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
synchronized (holder)
{
boolean isFromRed = holder.getRedPlayers().contains(player);
final boolean isFromRed = holder.getRedPlayers().contains(player);
if (isFromRed && (holder.getBlueTeamSize() == 6))
{
@@ -269,7 +269,7 @@ public final class HandysBlockCheckerManager
return;
}
int futureTeam = isFromRed ? 1 : 0;
final int futureTeam = isFromRed ? 1 : 0;
holder.addPlayer(player, futureTeam);
if (isFromRed)
@@ -331,8 +331,8 @@ public final class HandysBlockCheckerManager
*/
public void onDisconnect(L2PcInstance player)
{
int arena = player.getBlockCheckerArena();
int team = getHolder(arena).getPlayerTeam(player);
final int arena = player.getBlockCheckerArena();
final int team = getHolder(arena).getPlayerTeam(player);
HandysBlockCheckerManager.getInstance().removePlayer(player, arena, team);
if (player.getTeam() != Team.NONE)
{
@@ -341,16 +341,16 @@ public final class HandysBlockCheckerManager
player.setTeam(Team.NONE);
// Remove the event items
PcInventory inv = player.getInventory();
final PcInventory inv = player.getInventory();
if (inv.getItemByItemId(13787) != null)
{
long count = inv.getInventoryItemCount(13787, 0);
final long count = inv.getInventoryItemCount(13787, 0);
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
}
if (inv.getItemByItemId(13788) != null)
{
long count = inv.getInventoryItemCount(13788, 0);
final long count = inv.getInventoryItemCount(13788, 0);
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
}
player.setInsideZone(ZoneId.PVP, false);

View File

@@ -177,8 +177,8 @@ public final class InstanceManager implements IXmlReader
{
while (rs.next())
{
int id = rs.getInt("instanceId");
long time = rs.getLong("time");
final int id = rs.getInt("instanceId");
final long time = rs.getLong("time");
if (time < System.currentTimeMillis())
{
deleteInstanceTime(playerObjId, id);

View File

@@ -69,7 +69,7 @@ public final class ItemAuctionManager
_auctionIds.set(rs.getInt(1) + 1);
}
}
catch (final SQLException e)
catch (SQLException e)
{
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Failed loading auctions.", e);
}

View File

@@ -105,10 +105,10 @@ public class JumpManager
public void load()
{
_tracks.clear();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT, "JumpTrack.xml");
final File file = new File(Config.DATAPACK_ROOT, "JumpTrack.xml");
Document doc = null;
if (file.exists())
@@ -122,13 +122,13 @@ public class JumpManager
_log.log(Level.WARNING, "Could not parse JumpTrack.xml file: " + e.getMessage(), e);
return;
}
Node root = doc.getFirstChild();
final Node root = doc.getFirstChild();
for (Node t = root.getFirstChild(); t != null; t = t.getNextSibling())
{
if (t.getNodeName().equals("track"))
{
Track track = new Track();
int trackId = Integer.parseInt(t.getAttributes().getNamedItem("trackId").getNodeValue());
final Track track = new Track();
final int trackId = Integer.parseInt(t.getAttributes().getNamedItem("trackId").getNodeValue());
try
{
track.x = Integer.parseInt(t.getAttributes().getNamedItem("ToX").getNodeValue());
@@ -143,17 +143,17 @@ public class JumpManager
{
if (w.getNodeName().equals("way"))
{
JumpWay jw = new JumpWay();
int wayId = Integer.parseInt(w.getAttributes().getNamedItem("id").getNodeValue());
final JumpWay jw = new JumpWay();
final int wayId = Integer.parseInt(w.getAttributes().getNamedItem("id").getNodeValue());
for (Node j = w.getFirstChild(); j != null; j = j.getNextSibling())
{
if (j.getNodeName().equals("jumpLoc"))
{
NamedNodeMap attrs = j.getAttributes();
int next = Integer.parseInt(attrs.getNamedItem("next").getNodeValue());
int x = Integer.parseInt(attrs.getNamedItem("x").getNodeValue());
int y = Integer.parseInt(attrs.getNamedItem("y").getNodeValue());
int z = Integer.parseInt(attrs.getNamedItem("z").getNodeValue());
final NamedNodeMap attrs = j.getAttributes();
final int next = Integer.parseInt(attrs.getNamedItem("next").getNodeValue());
final int x = Integer.parseInt(attrs.getNamedItem("x").getNodeValue());
final int y = Integer.parseInt(attrs.getNamedItem("y").getNodeValue());
final int z = Integer.parseInt(attrs.getNamedItem("z").getNodeValue());
jw.add(new JumpNode(x, y, z, next));
}
}
@@ -186,7 +186,7 @@ public class JumpManager
public JumpWay getJumpWay(int trackId, int wayId)
{
Track t = _tracks.get(trackId);
final Track t = _tracks.get(trackId);
if (t != null)
{
return t.get(wayId);
@@ -205,12 +205,12 @@ public class JumpManager
{
return;
}
JumpWay jw = getJumpWay(player.getJumpTrackId(), 0);
final JumpWay jw = getJumpWay(player.getJumpTrackId(), 0);
if (jw == null)
{
return;
}
Track t = getTrack(player.getJumpTrackId());
final Track t = getTrack(player.getJumpTrackId());
if (!((t.x == 0) && (t.y == 0) && (t.z == 0)))
{
player.broadcastPacket(new FlyToLocation(player, t.x, t.y, t.z, FlyType.DUMMY));
@@ -226,14 +226,14 @@ public class JumpManager
return;
}
JumpWay jw = getJumpWay(player.getJumpTrackId(), nextId);
final JumpWay jw = getJumpWay(player.getJumpTrackId(), nextId);
if (jw == null)
{
player.enableAllSkills(); // unlock player skills
return;
}
player.sendPacket(new ExFlyMove(player.getObjectId(), player.getJumpTrackId(), jw));
JumpNode n = jw.get(0);
final JumpNode n = jw.get(0);
player.setXYZ(n.getX(), n.getY(), n.getZ());
}

View File

@@ -67,12 +67,12 @@ public final class MailManager
final Message msg = new Message(rs);
int msgId = msg.getId();
final int msgId = msg.getId();
_messages.put(msgId, msg);
count++;
long expiration = msg.getExpiration();
final long expiration = msg.getExpiration();
if (expiration < System.currentTimeMillis())
{

Some files were not shown because too many files have changed in this diff Show More