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

@@ -275,7 +275,7 @@ public abstract class AbstractOlympiadGame
player.disableAutoShotsAll();
// Discharge any active shots
L2ItemInstance item = player.getActiveWeaponInstance();
final L2ItemInstance item = player.getActiveWeaponInstance();
if (item != null)
{
item.unChargeAllShots();

View File

@@ -201,7 +201,7 @@ public class Olympiad extends ListenersContainer
{
_log.log(Level.INFO, "Olympiad System: failed to load data from database, trying to load from file.");
Properties OlympiadProperties = new Properties();
final Properties OlympiadProperties = new Properties();
try (InputStream is = new FileInputStream(Config.OLYMPIAD_CONFIG_FILE))
{
@@ -319,7 +319,7 @@ public class Olympiad extends ListenersContainer
public void loadNoblesRank()
{
NOBLES_RANK.clear();
Map<Integer, Integer> tmpPlace = new HashMap<>();
final Map<Integer, Integer> tmpPlace = new HashMap<>();
try (Connection con = ConnectionFactory.getInstance().getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery(GET_ALL_CLASSIFIED_NOBLESS))
@@ -405,7 +405,7 @@ public class Olympiad extends ListenersContainer
@Override
public void run()
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ROUND_S1_OF_THE_OLYMPIAD_GAMES_HAS_NOW_ENDED);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ROUND_S1_OF_THE_OLYMPIAD_GAMES_HAS_NOW_ENDED);
sm.addInt(_currentCycle);
Broadcast.toAllOnlinePlayers(sm);
@@ -426,7 +426,7 @@ public class Olympiad extends ListenersContainer
saveOlympiadStatus();
updateMonthlyData();
Calendar validationEnd = Calendar.getInstance();
final Calendar validationEnd = Calendar.getInstance();
_validationEnd = validationEnd.getTimeInMillis() + VALIDATION_PERIOD;
loadNoblesRank();
@@ -464,14 +464,14 @@ public class Olympiad extends ListenersContainer
synchronized (this)
{
long milliToStart = getMillisToCompBegin();
final long milliToStart = getMillisToCompBegin();
double numSecs = (milliToStart / 1000) % 60;
final double numSecs = (milliToStart / 1000) % 60;
double countDown = ((milliToStart / 1000.) - numSecs) / 60;
int numMins = (int) Math.floor(countDown % 60);
final int numMins = (int) Math.floor(countDown % 60);
countDown = (countDown - numMins) / 60;
int numHours = (int) Math.floor(countDown % 24);
int numDays = (int) Math.floor((countDown - numHours) / 24);
final int numHours = (int) Math.floor(countDown % 24);
final int numDays = (int) Math.floor((countDown - numHours) / 24);
_log.info("Olympiad System: Competition Period Starts in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
@@ -497,7 +497,7 @@ public class Olympiad extends ListenersContainer
_gameAnnouncer = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new OlympiadAnnouncer(), 30000, 500);
}
long regEnd = getMillisToCompEnd() - 600000;
final long regEnd = getMillisToCompEnd() - 600000;
if (regEnd > 0)
{
ThreadPoolManager.getInstance().scheduleGeneral(() -> Broadcast.toAllOnlinePlayers(SystemMessage.getSystemMessage(SystemMessageId.THE_OLYMPIAD_REGISTRATION_PERIOD_HAS_ENDED)), regEnd);
@@ -577,12 +577,12 @@ public class Olympiad extends ListenersContainer
protected void setNewOlympiadEnd()
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ROUND_S1_OF_THE_OLYMPIAD_GAMES_HAS_STARTED);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ROUND_S1_OF_THE_OLYMPIAD_GAMES_HAS_STARTED);
sm.addInt(_currentCycle);
Broadcast.toAllOnlinePlayers(sm);
Calendar currentTime = Calendar.getInstance();
final Calendar currentTime = Calendar.getInstance();
currentTime.add(Calendar.MONTH, 1);
currentTime.set(Calendar.DAY_OF_MONTH, 1);
currentTime.set(Calendar.AM_PM, Calendar.AM);
@@ -591,7 +591,7 @@ public class Olympiad extends ListenersContainer
currentTime.set(Calendar.SECOND, 0);
_olympiadEnd = currentTime.getTimeInMillis();
Calendar nextChange = Calendar.getInstance();
final Calendar nextChange = Calendar.getInstance();
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
scheduleWeeklyChange();
}
@@ -654,7 +654,7 @@ public class Olympiad extends ListenersContainer
resetWeeklyMatches();
_log.info("Olympiad System: Reset weekly matches to nobles");
Calendar nextChange = Calendar.getInstance();
final Calendar nextChange = Calendar.getInstance();
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
}, getMillisToWeekChange(), WEEKLY_PERIOD);
}
@@ -723,25 +723,25 @@ public class Olympiad extends ListenersContainer
{
for (Entry<Integer, StatsSet> entry : NOBLES.entrySet())
{
StatsSet nobleInfo = entry.getValue();
final StatsSet nobleInfo = entry.getValue();
if (nobleInfo == null)
{
continue;
}
int charId = entry.getKey();
int classId = nobleInfo.getInt(CLASS_ID);
int points = nobleInfo.getInt(POINTS);
int compDone = nobleInfo.getInt(COMP_DONE);
int compWon = nobleInfo.getInt(COMP_WON);
int compLost = nobleInfo.getInt(COMP_LOST);
int compDrawn = nobleInfo.getInt(COMP_DRAWN);
int compDoneWeek = nobleInfo.getInt(COMP_DONE_WEEK);
int compDoneWeekClassed = nobleInfo.getInt(COMP_DONE_WEEK_CLASSED);
int compDoneWeekNonClassed = nobleInfo.getInt(COMP_DONE_WEEK_NON_CLASSED);
int compDoneWeekTeam = nobleInfo.getInt(COMP_DONE_WEEK_TEAM);
boolean toSave = nobleInfo.getBoolean("to_save");
final int charId = entry.getKey();
final int classId = nobleInfo.getInt(CLASS_ID);
final int points = nobleInfo.getInt(POINTS);
final int compDone = nobleInfo.getInt(COMP_DONE);
final int compWon = nobleInfo.getInt(COMP_WON);
final int compLost = nobleInfo.getInt(COMP_LOST);
final int compDrawn = nobleInfo.getInt(COMP_DRAWN);
final int compDoneWeek = nobleInfo.getInt(COMP_DONE_WEEK);
final int compDoneWeekClassed = nobleInfo.getInt(COMP_DONE_WEEK_CLASSED);
final int compDoneWeekNonClassed = nobleInfo.getInt(COMP_DONE_WEEK_NON_CLASSED);
final int compDoneWeekTeam = nobleInfo.getInt(COMP_DONE_WEEK_TEAM);
final boolean toSave = nobleInfo.getBoolean("to_save");
try (PreparedStatement ps = con.prepareStatement(toSave ? OLYMPIAD_SAVE_NOBLES : OLYMPIAD_UPDATE_NOBLES))
{
@@ -856,17 +856,17 @@ public class Olympiad extends ListenersContainer
_logResults.info("Noble,charid,classid,compDone,points");
for (Entry<Integer, StatsSet> entry : NOBLES.entrySet())
{
StatsSet nobleInfo = entry.getValue();
final StatsSet nobleInfo = entry.getValue();
if (nobleInfo == null)
{
continue;
}
int charId = entry.getKey();
int classId = nobleInfo.getInt(CLASS_ID);
String charName = nobleInfo.getString(CHAR_NAME);
int points = nobleInfo.getInt(POINTS);
int compDone = nobleInfo.getInt(COMP_DONE);
final int charId = entry.getKey();
final int classId = nobleInfo.getInt(CLASS_ID);
final String charName = nobleInfo.getString(CHAR_NAME);
final int points = nobleInfo.getInt(POINTS);
final int compDone = nobleInfo.getInt(COMP_DONE);
record = new LogRecord(Level.INFO, charName);
record.setParameters(new Object[]
@@ -883,7 +883,7 @@ public class Olympiad extends ListenersContainer
PreparedStatement ps = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
List<StatsSet> soulHounds = new ArrayList<>();
final List<StatsSet> soulHounds = new ArrayList<>();
for (int element : HERO_IDS)
{
ps.setInt(1, element);
@@ -927,7 +927,7 @@ public class Olympiad extends ListenersContainer
case 1:
{
hero = new StatsSet();
StatsSet winner = soulHounds.get(0);
final StatsSet winner = soulHounds.get(0);
hero.set(CLASS_ID, winner.getInt(CLASS_ID));
hero.set(CHAR_ID, winner.getInt(CHAR_ID));
hero.set(CHAR_NAME, winner.getString(CHAR_NAME));
@@ -946,14 +946,14 @@ public class Olympiad extends ListenersContainer
{
hero = new StatsSet();
StatsSet winner;
StatsSet hero1 = soulHounds.get(0);
StatsSet hero2 = soulHounds.get(1);
int hero1Points = hero1.getInt(POINTS);
int hero2Points = hero2.getInt(POINTS);
int hero1Comps = hero1.getInt(COMP_DONE);
int hero2Comps = hero2.getInt(COMP_DONE);
int hero1Wins = hero1.getInt(COMP_WON);
int hero2Wins = hero2.getInt(COMP_WON);
final StatsSet hero1 = soulHounds.get(0);
final StatsSet hero2 = soulHounds.get(1);
final int hero1Points = hero1.getInt(POINTS);
final int hero2Points = hero2.getInt(POINTS);
final int hero1Comps = hero1.getInt(COMP_DONE);
final int hero2Comps = hero2.getInt(COMP_DONE);
final int hero1Wins = hero1.getInt(COMP_WON);
final int hero2Wins = hero2.getInt(COMP_WON);
if (hero1Points > hero2Points)
{
@@ -1011,7 +1011,7 @@ public class Olympiad extends ListenersContainer
public List<String> getClassLeaderBoard(int classId)
{
final List<String> names = new ArrayList<>();
String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(query))
{

View File

@@ -91,7 +91,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
continue;
}
Participant[] result = new Participant[2];
final Participant[] result = new Participant[2];
result[0] = new Participant(playerOne, 1);
result[1] = new Participant(playerTwo, 2);
@@ -323,8 +323,8 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
boolean tie = false;
int winside = 0;
List<OlympiadInfo> list1 = new ArrayList<>(1);
List<OlympiadInfo> list2 = new ArrayList<>(1);
final List<OlympiadInfo> list1 = new ArrayList<>(1);
final List<OlympiadInfo> list2 = new ArrayList<>(1);
final boolean _pOneCrash = ((_playerOne.getPlayer() == null) || _playerOne.isDisconnected());
final boolean _pTwoCrash = ((_playerTwo.getPlayer() == null) || _playerTwo.isDisconnected());
@@ -361,7 +361,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, _playerOne.getName() + " default");
final LogRecord record = new LogRecord(Level.INFO, _playerOne.getName() + " default");
record.setParameters(new Object[]
{
_playerOne.getName(),
@@ -400,7 +400,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, _playerTwo.getName() + " default");
final LogRecord record = new LogRecord(Level.INFO, _playerTwo.getName() + " default");
record.setParameters(new Object[]
{
_playerOne.getName(),
@@ -463,7 +463,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, _playerTwo.getName() + " crash");
final LogRecord record = new LogRecord(Level.INFO, _playerTwo.getName() + " crash");
record.setParameters(new Object[]
{
_playerOne.getName(),
@@ -501,7 +501,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, _playerOne.getName() + " crash");
final LogRecord record = new LogRecord(Level.INFO, _playerOne.getName() + " crash");
record.setParameters(new Object[]
{
_playerOne.getName(),
@@ -534,7 +534,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, "both crash");
final LogRecord record = new LogRecord(Level.INFO, "both crash");
record.setParameters(new Object[]
{
_playerOne.getName(),
@@ -584,7 +584,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
String winner = "draw";
// Calculate Fight time
long _fightTime = (System.currentTimeMillis() - _startTime);
final long _fightTime = (System.currentTimeMillis() - _startTime);
double playerOneHp = 0;
if ((_playerOne.getPlayer() != null) && !_playerOne.getPlayer().isDead())
@@ -706,7 +706,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
if (Config.ALT_OLY_LOG_FIGHTS)
{
LogRecord record = new LogRecord(Level.INFO, winner);
final LogRecord record = new LogRecord(Level.INFO, winner);
record.setParameters(new Object[]
{
_playerOne.getName(),

View File

@@ -185,7 +185,7 @@ public final class OlympiadGameTask implements Runnable
{
if (_countDown > 0)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_WILL_BE_MOVED_TO_THE_OLYMPIAD_STADIUM_IN_S1_SECOND_S);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_WILL_BE_MOVED_TO_THE_OLYMPIAD_STADIUM_IN_S1_SECOND_S);
sm.addInt(_countDown);
_game.broadcastPacket(sm);
}
@@ -216,7 +216,7 @@ public final class OlympiadGameTask implements Runnable
{
if (_countDown > 0)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MATCH_WILL_START_IN_S1_SECOND_S);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MATCH_WILL_START_IN_S1_SECOND_S);
sm.addInt(_countDown);
_zone.broadcastPacket(sm);
}
@@ -238,7 +238,7 @@ public final class OlympiadGameTask implements Runnable
{
if (_countDown > 0)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MATCH_WILL_START_IN_S1_SECOND_S);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_MATCH_WILL_START_IN_S1_SECOND_S);
sm.addInt(_countDown);
_zone.broadcastPacket(sm);
}
@@ -295,7 +295,7 @@ public final class OlympiadGameTask implements Runnable
{
if (_countDown > 0)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_WILL_BE_MOVED_BACK_TO_TOWN_IN_S1_SECOND_S);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_WILL_BE_MOVED_BACK_TO_TOWN_IN_S1_SECOND_S);
sm.addInt(_countDown);
_game.broadcastPacket(sm);
}

View File

@@ -106,8 +106,8 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
List<Integer> teamOne = null;
List<Integer> teamTwo = null;
L2PcInstance player;
List<L2PcInstance> teamOnePlayers = new ArrayList<>(MAX_TEAM_SIZE);
List<L2PcInstance> teamTwoPlayers = new ArrayList<>(MAX_TEAM_SIZE);
final List<L2PcInstance> teamOnePlayers = new ArrayList<>(MAX_TEAM_SIZE);
final List<L2PcInstance> teamTwoPlayers = new ArrayList<>(MAX_TEAM_SIZE);
while (list.size() > 1)
{
@@ -158,9 +158,9 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
continue;
}
Participant[] t1 = new Participant[teamOnePlayers.size()];
Participant[] t2 = new Participant[teamTwoPlayers.size()];
Participant[][] result = new Participant[2][];
final Participant[] t1 = new Participant[teamOnePlayers.size()];
final Participant[] t2 = new Participant[teamTwoPlayers.size()];
final Participant[][] result = new Participant[2][];
for (int i = 0; i < t1.length; i++)
{
@@ -565,8 +565,8 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
boolean tie = false;
int winside = 0;
List<OlympiadInfo> list1 = new ArrayList<>(3);
List<OlympiadInfo> list2 = new ArrayList<>(3);
final List<OlympiadInfo> list1 = new ArrayList<>(3);
final List<OlympiadInfo> list2 = new ArrayList<>(3);
final boolean tOneCrash = teamOneAllDisconnected();
final boolean tTwoCrash = teamTwoAllDisconnected();
@@ -586,7 +586,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
{
par = _teamOne[i];
points = par.getStats().getInt(POINTS) / getDivider();
int val = Math.min(par.getStats().getInt(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
final int val = Math.min(par.getStats().getInt(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
removePointsFromParticipant(par, val);
list1.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT1, points - val, -val));
}
@@ -598,7 +598,7 @@ public class OlympiadGameTeams extends AbstractOlympiadGame
{
par = _teamTwo[i];
points = par.getStats().getInt(POINTS) / getDivider();
int val = Math.min(par.getStats().getInt(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
final int val = Math.min(par.getStats().getInt(POINTS) / 3, Config.ALT_OLY_MAX_POINTS);
removePointsFromParticipant(par, val);
list2.add(new OlympiadInfo(par.getName(), par.getClanName(), par.getClanId(), par.getBaseClass(), _damageT2, points - val, -val));
}

View File

@@ -122,7 +122,7 @@ public class OlympiadManager
{
if (showMessage)
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_3_VS_3_CLASS_IRRELEVANT_TEAM_MATCH);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_WAITING_LIST_FOR_THE_3_VS_3_CLASS_IRRELEVANT_TEAM_MATCH);
sm.addPcName(noble);
player.sendPacket(sm);
}
@@ -297,7 +297,7 @@ public class OlympiadManager
}
int teamPoints = 0;
List<Integer> team = new ArrayList<>(party.getMemberCount());
final List<Integer> team = new ArrayList<>(party.getMemberCount());
for (L2PcInstance noble : party.getMembers())
{
if (!checkNoble(noble, player))
@@ -376,7 +376,7 @@ public class OlympiadManager
return false;
}
Integer objId = Integer.valueOf(noble.getObjectId());
final Integer objId = Integer.valueOf(noble.getObjectId());
if (_nonClassBasedRegisters.remove(objId))
{
if (Config.L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP > 0)
@@ -560,7 +560,7 @@ public class OlympiadManager
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_BEEN_REMOVED_FROM_THE_OLYMPIAD_WAITING_LIST);
for (int objectId : _team)
{
L2PcInstance teamMember = L2World.getInstance().getPlayer(objectId);
final L2PcInstance teamMember = L2World.getInstance().getPlayer(objectId);
if (teamMember != null)
{
teamMember.sendPacket(sm);