Code review Part 5.

This commit is contained in:
MobiusDevelopment
2019-12-22 15:33:46 +00:00
parent 4a563b8832
commit 7f3befa63c
4071 changed files with 23938 additions and 28938 deletions

View File

@@ -61,7 +61,7 @@ public class Antharas extends AbstractNpcAI
private static final int BOMBER = 29070; // Dragon Bomber
private static final int HEART = 13001; // Heart of Warding
private static final int CUBE = 31859; // Teleportation Cubic
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
static
{
INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735)); // antaras_clear_npc_1

View File

@@ -126,8 +126,8 @@ public class Orfen extends AbstractNpcAI
final int loc_y = info.getInt("loc_y");
final int loc_z = info.getInt("loc_z");
final int heading = info.getInt("heading");
double hp = info.getDouble("currentHP");
double mp = info.getDouble("currentMP");
final double hp = info.getDouble("currentHP");
final double mp = info.getDouble("currentMP");
final GrandBossInstance orfen = (GrandBossInstance) addSpawn(ORFEN, loc_x, loc_y, loc_z, heading, false, 0);
orfen.setCurrentHpMp(hp, mp);
spawnBoss(orfen);

View File

@@ -114,8 +114,8 @@ public class QueenAnt extends AbstractNpcAI
final int loc_y = QUEEN_Y;
final int loc_z = QUEEN_Z;
final int heading = info.getInt("heading");
double hp = info.getDouble("currentHP");
double mp = info.getDouble("currentMP");
final double hp = info.getDouble("currentHP");
final double mp = info.getDouble("currentMP");
final GrandBossInstance queen = (GrandBossInstance) addSpawn(QUEEN, loc_x, loc_y, loc_z, heading, false, 0);
queen.setCurrentHpMp(hp, mp);
spawnBoss(queen);

View File

@@ -138,7 +138,7 @@ public class NevitsHerald extends AbstractNpcAI
{
for (Location loc : NEVITS_HERALD_LOC)
{
Npc herald = addSpawn(NEVITS_HERALD, loc, false, 0);
final Npc herald = addSpawn(NEVITS_HERALD, loc, false, 0);
startQuestTimer("text_spam", 3000, herald, null);
SPAWNS.add(herald);
}

View File

@@ -73,7 +73,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
String cmd = "";
StringBuilder params = new StringBuilder();
final StringBuilder params = new StringBuilder();
final StringTokenizer st = new StringTokenizer(command, " ");
if (st.hasMoreTokens())
@@ -130,7 +130,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
}
else
{
StringBuilder title = new StringBuilder();
final StringBuilder title = new StringBuilder();
title.append("BUFF SELL: ");
final StringTokenizer st = new StringTokenizer(params, " ");
while (st.hasMoreTokens())

View File

@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.quest.LongTimeEvent;
public class L2Day extends LongTimeEvent
{
// NPCs
private static final Map<Integer, Integer> MANAGERS = new HashMap<>();
private static final Map<Integer, Integer> MANAGERS = new HashMap<>();
static
{
MANAGERS.put(31854, 7117); // Talking Island Village

View File

@@ -199,7 +199,7 @@ public class SavingSanta extends LongTimeEvent
continue;
}
int result = pl.getEffectList().getBuffInfoBySkillId(23019).getSkill().getLevel() - skill.getLevel();
final int result = pl.getEffectList().getBuffInfoBySkillId(23019).getSkill().getLevel() - skill.getLevel();
if (result == 0)
{
@@ -216,7 +216,7 @@ public class SavingSanta extends LongTimeEvent
}
else if ((result == 1) || (result == -2))
{
int level = (pl.isAffectedBySkill(23022) ? (pl.getEffectList().getBuffInfoBySkillId(23022).getSkill().getLevel() + 1) : 1);
final int level = (pl.isAffectedBySkill(23022) ? (pl.getEffectList().getBuffInfoBySkillId(23022).getSkill().getLevel() + 1) : 1);
pl.broadcastPacket(new MagicSkillUse(pl, pl, 23022, level, 3000, 1));
SkillData.getInstance().getSkill(23022, level).applyEffects(pl, pl);
@@ -324,7 +324,7 @@ public class SavingSanta extends LongTimeEvent
{
if (_rewardedPlayers.containsKey(pl.getAccountName()))
{
long elapsedTimeSinceLastRewarded = System.currentTimeMillis() - _rewardedPlayers.get(pl.getAccountName());
final long elapsedTimeSinceLastRewarded = System.currentTimeMillis() - _rewardedPlayers.get(pl.getAccountName());
if (elapsedTimeSinceLastRewarded < MIN_TIME_BETWEEN_2_REWARDS)
{
continue;
@@ -339,10 +339,10 @@ public class SavingSanta extends LongTimeEvent
continue;
}
}
int locx = (int) (pl.getX() + (Math.pow(-1, getRandom(1, 2)) * 50));
int locy = (int) (pl.getY() + (Math.pow(-1, getRandom(1, 2)) * 50));
int heading = Util.calculateHeadingFrom(locx, locy, pl.getX(), pl.getY());
Npc santa = addSpawn(HOLIDAY_SANTA_ID, locx, locy, pl.getZ(), heading, false, 30000);
final int locx = (int) (pl.getX() + (Math.pow(-1, getRandom(1, 2)) * 50));
final int locy = (int) (pl.getY() + (Math.pow(-1, getRandom(1, 2)) * 50));
final int heading = Util.calculateHeadingFrom(locx, locy, pl.getX(), pl.getY());
final Npc santa = addSpawn(HOLIDAY_SANTA_ID, locx, locy, pl.getZ(), heading, false, 30000);
_rewardedPlayers.put(pl.getAccountName(), System.currentTimeMillis());
player.getVariables().set("LAST_SANTA_REWARD", System.currentTimeMillis());
startQuestTimer("SantaRewarding0", 500, santa, pl);
@@ -446,7 +446,7 @@ public class SavingSanta extends LongTimeEvent
{
if (_blessedPlayers.containsKey(plb.getAccountName()))
{
long elapsedTimeSinceLastBlessed = currentTime - _blessedPlayers.get(plb.getAccountName());
final long elapsedTimeSinceLastBlessed = currentTime - _blessedPlayers.get(plb.getAccountName());
if (elapsedTimeSinceLastBlessed < MIN_TIME_BETWEEN_2_BLESSINGS)
{
continue;
@@ -504,12 +504,12 @@ public class SavingSanta extends LongTimeEvent
{
for (PlayerInstance playerr : World.getInstance().getVisibleObjects(tree, PlayerInstance.class))
{
int xxMin = tree.getX() - 60;
int yyMin = tree.getY() - 60;
int xxMax = tree.getX() + 60;
int yyMax = tree.getY() + 60;
int playerX = playerr.getX();
int playerY = playerr.getY();
final int xxMin = tree.getX() - 60;
final int yyMin = tree.getY() - 60;
final int xxMax = tree.getX() + 60;
final int yyMax = tree.getY() + 60;
final int playerX = playerr.getX();
final int playerY = playerr.getY();
if ((playerX > xxMin) && (playerX < xxMax) && (playerY > yyMin) && (playerY < yyMax))
{
@@ -528,7 +528,7 @@ public class SavingSanta extends LongTimeEvent
for (ItemHolder item : TREE_REQUIRED_ITEMS)
{
long pieceCount = player.getInventory().getInventoryItemCount(item.getId(), -1);
final long pieceCount = player.getInventory().getInventoryItemCount(item.getId(), -1);
if (pieceCount >= item.getCount())
{
itemsOk = itemsOk + 1;
@@ -573,7 +573,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SpecialTree"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Special Christmas Tree</font></td><td width=40><img src=\"Icon.etc_x_mas_tree_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
final long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
int itemsOk = 0;
if (pieceCount >= 10)
@@ -613,7 +613,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SantaHat"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Santa's Hat</font></td><td width=40><img src=\"Icon.Accessory_santas_cap_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
final long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
int itemsOk = 0;
if (pieceCount >= 10)
@@ -651,7 +651,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SavingSantaHat"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Saving Santa's Hat</font></td><td width=40><img src=\"Icon.Accessory_santas_cap_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getAdena();
final long pieceCount = player.getInventory().getAdena();
int itemsOk = 0;
if (pieceCount >= 50000)

View File

@@ -87,9 +87,9 @@ public class SkillTransfer extends AbstractNpcAI
return;
}
int pomanderId = PORMANDERS[index].getId();
final int pomanderId = PORMANDERS[index].getId();
// remove unsused HolyPomander
PlayerInventory inv = player.getInventory();
final PlayerInventory inv = player.getInventory();
for (ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
{
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);

View File

@@ -251,8 +251,8 @@ public class AdminBuffs implements IAdminCommandHandler
html.append(target.getName());
html.append("</font></td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br><table width=\"100%\"><tr><td width=200>Skill</td><td width=30>Rem. Time</td><td width=70>Action</td></tr>");
int start = ((page - 1) * PAGE_LIMIT);
int end = Math.min(((page - 1) * PAGE_LIMIT) + PAGE_LIMIT, effects.size());
final int start = ((page - 1) * PAGE_LIMIT);
final int end = Math.min(((page - 1) * PAGE_LIMIT) + PAGE_LIMIT, effects.size());
int count = 0;
for (BuffInfo info : effects)
{

View File

@@ -100,7 +100,7 @@ public class AdminCursedWeapons implements IAdminCommandHandler
if (cw.isActivated())
{
PlayerInstance pl = cw.getPlayer();
final PlayerInstance pl = cw.getPlayer();
replyMSG.append("<tr><td>Weilder:</td><td>");
replyMSG.append(pl == null ? "null" : pl.getName());
replyMSG.append("</td></tr>");

View File

@@ -45,7 +45,7 @@ public class AdminGamePoints implements IAdminCommandHandler
{
try
{
String val = command.substring(22);
final String val = command.substring(22);
if (!addGamePoints(activeChar, val))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //add_game_points count");
@@ -60,7 +60,7 @@ public class AdminGamePoints implements IAdminCommandHandler
{
if ((activeChar.getTarget() != null) && activeChar.getTarget().isPlayer())
{
PlayerInstance target = (PlayerInstance) activeChar.getTarget();
final PlayerInstance target = (PlayerInstance) activeChar.getTarget();
activeChar.sendMessage(target.getName() + " has a total of " + target.getGamePoints() + " game points.");
}
else
@@ -76,7 +76,7 @@ public class AdminGamePoints implements IAdminCommandHandler
{
try
{
String val = command.substring(22);
final String val = command.substring(22);
if (!setGamePoints(activeChar, val))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //set_game_points count");
@@ -91,7 +91,7 @@ public class AdminGamePoints implements IAdminCommandHandler
{
try
{
String val = command.substring(27);
final String val = command.substring(27);
if (!subtractGamePoints(activeChar, val))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //subtract_game_points count");
@@ -114,7 +114,7 @@ public class AdminGamePoints implements IAdminCommandHandler
private boolean addGamePoints(PlayerInstance admin, String val)
{
WorldObject target = admin.getTarget();
final WorldObject target = admin.getTarget();
PlayerInstance player = null;
if (target.isPlayer())
{
@@ -150,7 +150,7 @@ public class AdminGamePoints implements IAdminCommandHandler
private boolean setGamePoints(PlayerInstance admin, String val)
{
WorldObject target = admin.getTarget();
final WorldObject target = admin.getTarget();
PlayerInstance player = null;
if (target.isPlayer())
{
@@ -176,7 +176,7 @@ public class AdminGamePoints implements IAdminCommandHandler
private boolean subtractGamePoints(PlayerInstance admin, String val)
{
WorldObject target = admin.getTarget();
final WorldObject target = admin.getTarget();
PlayerInstance player = null;
if (target.isPlayer())
{

View File

@@ -29,8 +29,8 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in
* that radius will be killed.
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in that
* radius will be killed.
* @version $Revision: 1.2.4.5 $ $Date: 2007/07/31 10:06:06 $
*/
public class AdminKill implements IAdminCommandHandler

View File

@@ -39,7 +39,7 @@ public class AdminPathNode implements IAdminCommandHandler
{
if (activeChar.getTarget() != null)
{
List<Location> path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId());
final List<Location> path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId());
if (path == null)
{
BuilderUtil.sendSysMessage(activeChar, "No route found or pathfinding disabled.");

View File

@@ -65,7 +65,7 @@ public class AdminQuest implements IAdminCommandHandler
{
if (command.startsWith("admin_quest_reload"))
{
StringTokenizer st = new StringTokenizer(command);
final StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // skip command token
if (!st.hasMoreTokens())
@@ -74,8 +74,8 @@ public class AdminQuest implements IAdminCommandHandler
return false;
}
String script = st.nextToken();
Quest quest = findScript(script);
final String script = st.nextToken();
final Quest quest = findScript(script);
if (quest == null)
{
BuilderUtil.sendSysMessage(activeChar, "The script " + script + " couldn't be found!");
@@ -92,7 +92,7 @@ public class AdminQuest implements IAdminCommandHandler
}
else if (command.startsWith("admin_script_load"))
{
StringTokenizer st = new StringTokenizer(command);
final StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // skip command token
if (!st.hasMoreTokens())
@@ -101,7 +101,7 @@ public class AdminQuest implements IAdminCommandHandler
return false;
}
String script = st.nextToken();
final String script = st.nextToken();
try
{
ScriptEngineManager.getInstance().executeScript(Paths.get(script));
@@ -115,7 +115,7 @@ public class AdminQuest implements IAdminCommandHandler
}
else if (command.startsWith("admin_script_unload"))
{
StringTokenizer st = new StringTokenizer(command);
final StringTokenizer st = new StringTokenizer(command);
st.nextToken(); // skip command token
if (!st.hasMoreTokens())
@@ -124,8 +124,8 @@ public class AdminQuest implements IAdminCommandHandler
return false;
}
String script = st.nextToken();
Quest quest = findScript(script);
final String script = st.nextToken();
final Quest quest = findScript(script);
if (quest == null)
{
BuilderUtil.sendSysMessage(activeChar, "The script " + script + " couldn't be found!");

View File

@@ -84,7 +84,7 @@ public class FindPvP implements IBypassHandler
// Check if the player's clan is already outnumbering the PvP
if (player.getClan() != null)
{
Map<Integer, Integer> clanNumbers = new HashMap<>();
final Map<Integer, Integer> clanNumbers = new HashMap<>();
int allyId = player.getAllyId();
if (allyId == 0)
{

View File

@@ -282,7 +282,7 @@ public class NpcViewMod implements IBypassHandler
{
final StringBuilder sb = new StringBuilder();
int height = 64;
final int height = 64;
final DropHolder dropItem = dropList.get(i);
final Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());

View File

@@ -141,35 +141,35 @@ public class DropSearchBoard implements IParseBoardHandler
public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
{
final String navigation = HtmCache.getInstance().getHtm(player, NAVIGATION_PATH);
String[] params = command.split(" ");
final String[] params = command.split(" ");
String html = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/dropsearch/main.html");
switch (params[0])
{
case "_bbs_search_item":
{
String itemName = buildItemName(params);
String result = buildItemSearchResult(itemName);
final String itemName = buildItemName(params);
final String result = buildItemSearchResult(itemName);
html = html.replace("%searchResult%", result);
break;
}
case "_bbs_search_drop":
{
final DecimalFormat chanceFormat = new DecimalFormat("0.00##");
int itemId = Integer.parseInt(params[1]);
final int itemId = Integer.parseInt(params[1]);
int page = Integer.parseInt(params[2]);
List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
final List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
int pages = list.size() / 14;
if (pages == 0)
{
pages++;
}
int start = (page - 1) * 14;
int end = Math.min(list.size() - 1, start + 14);
StringBuilder builder = new StringBuilder();
final int start = (page - 1) * 14;
final int end = Math.min(list.size() - 1, start + 14);
final StringBuilder builder = new StringBuilder();
for (int index = start; index <= end; index++)
{
CBDropHolder cbDropHolder = list.get(index);
final CBDropHolder cbDropHolder = list.get(index);
// real time server rate calculations
double rateChance = 1;
@@ -286,8 +286,8 @@ public class DropSearchBoard implements IParseBoardHandler
}
case "_bbs_npc_trace":
{
int npcId = Integer.parseInt(params[1]);
Spawn spawn = SpawnTable.getInstance().getAnySpawn(npcId);
final int npcId = Integer.parseInt(params[1]);
final Spawn spawn = SpawnTable.getInstance().getAnySpawn(npcId);
if (spawn == null)
{
player.sendMessage("Cannot find any spawn. Maybe dropped by a boss or instance monster.");
@@ -316,8 +316,8 @@ public class DropSearchBoard implements IParseBoardHandler
private String buildItemSearchResult(String itemName)
{
int limit = 0;
Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
List<Item> items = new ArrayList<>();
final Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
final List<Item> items = new ArrayList<>();
for (Item item : ItemTable.getInstance().getAllItems())
{
if (item == null)
@@ -349,7 +349,7 @@ public class DropSearchBoard implements IParseBoardHandler
int line = 0;
StringBuilder builder = new StringBuilder(items.size() * 28);
final StringBuilder builder = new StringBuilder(items.size() * 28);
int i = 0;
for (Item item : items)
{
@@ -402,7 +402,7 @@ public class DropSearchBoard implements IParseBoardHandler
*/
private String buildItemName(String[] params)
{
StringJoiner joiner = new StringJoiner(" ");
final StringJoiner joiner = new StringJoiner(" ");
for (int i = 1; i < params.length; i++)
{
joiner.add(params[i]);

View File

@@ -98,7 +98,7 @@ public class HomeBoard implements IParseBoardHandler
@Override
public String[] getCommunityBoardCommands()
{
List<String> commands = new ArrayList<>();
final List<String> commands = new ArrayList<>();
commands.addAll(Arrays.asList(COMMANDS));
commands.addAll(Arrays.asList(CUSTOM_COMMANDS));
return commands.stream().filter(Objects::nonNull).toArray(String[]::new);
@@ -201,7 +201,7 @@ public class HomeBoard implements IParseBoardHandler
{
player.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, player, true);
final Summon pet = player.getSummon();
List<Creature> targets = new ArrayList<>(4);
final List<Creature> targets = new ArrayList<>(4);
targets.add(player);
if (pet != null)
{

View File

@@ -111,7 +111,7 @@ public class RestorationRandom extends AbstractEffect
continue;
}
long itemCount = (long) (item.getCount() * Config.RATE_EXTRACTABLE);
final long itemCount = (long) (item.getCount() * Config.RATE_EXTRACTABLE);
final Item template = ItemTable.getInstance().getTemplate(item.getId());
if (template.isStackable())
{

View File

@@ -39,9 +39,9 @@ public class AuraFriendly implements ITargetTypeHandler
@Override
public WorldObject[] getTargetList(Skill skill, Creature creature, boolean onlyFirst, Creature target)
{
List<Creature> targetList = new ArrayList<>();
PlayerInstance player = creature.getActingPlayer();
int maxTargets = skill.getAffectLimit();
final List<Creature> targetList = new ArrayList<>();
final PlayerInstance player = creature.getActingPlayer();
final int maxTargets = skill.getAffectLimit();
World.getInstance().forEachVisibleObject(player, Creature.class, obj ->
{
if ((obj == creature) || !checkTarget(player, obj))
@@ -79,7 +79,7 @@ public class AuraFriendly implements ITargetTypeHandler
if (target.isPlayable())
{
PlayerInstance targetPlayer = target.getActingPlayer();
final PlayerInstance targetPlayer = target.getActingPlayer();
if (player.isInDuelWith(target))
{

View File

@@ -42,7 +42,7 @@ public class ClanPenalty implements IUserCommandHandler
}
boolean penalty = false;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
final StringBuilder htmlContent = new StringBuilder(500);
htmlContent.append("<html><body><center><table width=270 border=0 bgcolor=111111><tr><td width=170>Penalty</td><td width=100 align=center>Expiration Date</td></tr></table><table width=270 border=0><tr>");

View File

@@ -142,7 +142,7 @@ public class CastleDungeon extends AbstractInstance
@Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
{
if (CommonUtil.contains(RAIDS3, npc.getId()))

View File

@@ -1616,7 +1616,7 @@ public class CrystalCaverns extends AbstractInstance
{
world.setStatus(8);
// first door opener trap
Npc trap = addTrap(DOOR_OPENING_TRAP[0], DOOR_OPENING_TRAP[1], DOOR_OPENING_TRAP[2], DOOR_OPENING_TRAP[3], DOOR_OPENING_TRAP[4], world.getInstanceId());
final Npc trap = addTrap(DOOR_OPENING_TRAP[0], DOOR_OPENING_TRAP[1], DOOR_OPENING_TRAP[2], DOOR_OPENING_TRAP[3], DOOR_OPENING_TRAP[4], world.getInstanceId());
trap.broadcastSay(ChatType.NPC_SHOUT, NpcStringId.YOU_HAVE_FINALLY_COME_HERE_BUT_YOU_WILL_NOT_BE_ABLE_TO_FIND_THE_SECRET_ROOM);
}
}

View File

@@ -655,7 +655,7 @@ public class DarkCloudMansion extends AbstractInstance
DMCNpc thisNpc;
int idx = 0;
int[] temp = Beleths[getRandom(Beleths.length)];
final int[] temp = Beleths[getRandom(Beleths.length)];
fifthRoom.reset = 0;
fifthRoom.founded = 0;

View File

@@ -708,7 +708,7 @@ public class FinalEmperialTomb extends AbstractInstance implements IXmlReader
@Override
public void run()
{
Map<Npc, Integer> portraits = _world.getParameters().getMap("portraits", Npc.class, Integer.class);
final Map<Npc, Integer> portraits = _world.getParameters().getMap("portraits", Npc.class, Integer.class);
if ((InstanceManager.getInstance().getWorld(_world.getInstanceId()) != _world) || (portraits == null) || portraits.isEmpty())
{
if (DEBUG)
@@ -1522,7 +1522,7 @@ public class FinalEmperialTomb extends AbstractInstance implements IXmlReader
}
else if (CommonUtil.contains(PORTRAITS, npc.getId()))
{
Map<Npc, Integer> portraits = world.getParameters().getMap("portraits", Npc.class, Integer.class);
final Map<Npc, Integer> portraits = world.getParameters().getMap("portraits", Npc.class, Integer.class);
portraits.remove(npc);
world.setParameter("portraits", portraits);
}

View File

@@ -389,7 +389,7 @@ public class SSQMonasteryOfSilence extends AbstractInstance
for (Location LOC : SLAVE_SPAWN_1_LOC)
{
Attackable mob = (Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId());
final Attackable mob = (Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId());
mob.setRunning();
mob.addDamageHate(player, 0, 999);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -399,7 +399,7 @@ public class SSQMonasteryOfSilence extends AbstractInstance
for (Location LOC : SLAVE_SPAWN_2_LOC)
{
Attackable mob = (Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId());
final Attackable mob = (Attackable) addSpawn(TRAINEE_OF_REST, LOC, false, 0, false, world.getInstanceId());
mob.setRunning();
mob.addDamageHate(player, 0, 999);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -409,7 +409,7 @@ public class SSQMonasteryOfSilence extends AbstractInstance
for (Location LOC : SLAVE_SPAWN_3_LOC)
{
Attackable mob = (Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId());
final Attackable mob = (Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId());
mob.setRunning();
mob.addDamageHate(player, 0, 999);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -419,7 +419,7 @@ public class SSQMonasteryOfSilence extends AbstractInstance
for (Location LOC : SLAVE_SPAWN_4_LOC)
{
Attackable mob = (Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId());
final Attackable mob = (Attackable) addSpawn(SUPPLICANT_OF_REST, LOC, false, 0, false, world.getInstanceId());
mob.setRunning();
mob.addDamageHate(player, 0, 999);
mob.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
@@ -453,7 +453,7 @@ public class SSQMonasteryOfSilence extends AbstractInstance
@Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
{
switch (npc.getId())

View File

@@ -110,7 +110,7 @@ public class SSQSanctumOfTheLordsOfDawn extends AbstractInstance
}
}
InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
if (world != null)
{
boolean teleported = false;

View File

@@ -46,7 +46,7 @@ public class Q00032_AnObviousLie extends Quest
// Misc
private static final int MIN_LVL = 45;
// Reward
private static final Map<String, Integer> EARS = new HashMap<>();
private static final Map<String, Integer> EARS = new HashMap<>();
static
{
EARS.put("cat", 6843); // Cat Ears

View File

@@ -77,7 +77,7 @@ public class Q00101_SwordOfSolidarity extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -57,7 +57,7 @@ public class Q00152_ShardsOfGolem extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -51,7 +51,7 @@ public class Q00156_MillenniumLove extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -53,7 +53,7 @@ public class Q00157_RecoverSmuggledGoods extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -60,7 +60,7 @@ public class Q00163_LegacyOfThePoet extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -51,7 +51,7 @@ public class Q00167_DwarvenKinship extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -57,7 +57,7 @@ public class Q00169_OffspringOfNightmares extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -126,7 +126,7 @@ public class Q00259_RequestFromTheFarmOwner extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
giveItems(killer, SPIDER_SKIN, 1);
playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);

View File

@@ -55,7 +55,7 @@ public class Q00267_WrathOfVerdure extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -107,7 +107,7 @@ public class Q00269_InventionAmbition extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, ENERGY_ORE, 1, 0, MONSTERS.get(npc.getId()), true);
}

View File

@@ -65,7 +65,7 @@ public class Q00273_InvadersOfTheHolyLand extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{
@@ -95,7 +95,7 @@ public class Q00273_InvadersOfTheHolyLand extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
if (getRandom(100) <= MONSTERS.get(npc.getId()))
{

View File

@@ -103,7 +103,7 @@ public class Q00283_TheFewTheProudTheBrave extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(killer, npc, CRIMSON_SPIDER_CLAW, 1, 0, 0.6, true);
}

View File

@@ -109,7 +109,7 @@ public class Q00293_TheHiddenVeins extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
final int chance = getRandom(100);
if (chance > 50)

View File

@@ -72,7 +72,7 @@ public class Q00326_VanquishRemnants extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -345,7 +345,7 @@ public class Q00327_RecoverTheFarmland extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
if ((npc.getId() == TUREK_ORK_SHAMAN) || (npc.getId() == TUREK_ORK_WARLORD))
{

View File

@@ -74,7 +74,7 @@ public class Q00328_SenseForBusiness extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -105,7 +105,7 @@ public class Q00338_AlligatorHunter extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if (qs != null)
{
giveItems(player, ALLIGATOR_LEATHER, 1);
if (getRandom(100) < SECOND_CHANCE)

View File

@@ -44,7 +44,7 @@ public class Q00344_1000YearsTheEndOfLamentation extends Quest
private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1);
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
// Monsters
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant

View File

@@ -166,7 +166,7 @@ public class Q00348_AnArrogantSearch extends Quest
}
case "30864-08.html":
{
int memoState = qs.getMemoState();
final int memoState = qs.getMemoState();
if (((memoState == 1) && hasAtLeastOneQuestItem(player, TITANS_POWERSTONE, SHELL_OF_MONSTERS)) || (memoState == 2))
{
qs.setMemoStateEx(0, 4);
@@ -565,7 +565,7 @@ public class Q00348_AnArrogantSearch extends Quest
{
if ((qs.getMemoStateEx(0) == 17) && hasQuestItems(qs.getPlayer(), WHITE_FABRIC_1))
{
int i0 = qs.getMemoStateEx(1) + getRandom(100) + 100;
final int i0 = qs.getMemoStateEx(1) + getRandom(100) + 100;
qs.setMemoStateEx(1, i0);
if ((qs.getMemoStateEx(1) + i0) > 750)
{
@@ -630,7 +630,7 @@ public class Q00348_AnArrogantSearch extends Quest
case 1:
case 2:
{
int memoState = qs.getMemoState();
final int memoState = qs.getMemoState();
if ((memoState == 1) && !hasQuestItems(player, TITANS_POWERSTONE) && !hasQuestItems(player, SHELL_OF_MONSTERS))
{
htmltext = "30864-06.html";
@@ -1239,7 +1239,7 @@ public class Q00348_AnArrogantSearch extends Quest
{
if (hasQuestItems(player, HANELLINS_2ND_LETTER))
{
int i0 = qs.getMemoStateEx(1) + 100;
final int i0 = qs.getMemoStateEx(1) + 100;
if ((i0 % 10) == 0)
{
addRadar(player, 181472, 7158, -2725);
@@ -1282,7 +1282,7 @@ public class Q00348_AnArrogantSearch extends Quest
{
if (hasQuestItems(player, HANELLINS_1ST_LETTER))
{
int i0 = qs.getMemoStateEx(1) + 10;
final int i0 = qs.getMemoStateEx(1) + 10;
if ((i0 % 10) == 0)
{
addRadar(player, 2908, 44128, -2712);
@@ -1325,7 +1325,7 @@ public class Q00348_AnArrogantSearch extends Quest
{
if (hasQuestItems(player, HANELLINS_3RD_LETTER))
{
int i0 = qs.getMemoStateEx(1) + 1000;
final int i0 = qs.getMemoStateEx(1) + 1000;
if ((i0 % 10) == 0)
{
addRadar(player, 50693, 158674, 376);

View File

@@ -136,7 +136,7 @@ public class Q00354_ConquestOfAlligatorIsland extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
final int npcId = npc.getId();
if (MOB1.containsKey(npcId))

View File

@@ -108,7 +108,7 @@ public class Q00368_TrespassingIntoTheHolyGround extends Quest
}
final QuestState qs = getRandomPartyMemberState(player, -1, i, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(player, npc, BLADE_STAKATO_FANG, 1, 0, MOBS.get(npc.getId()), true);
}

View File

@@ -143,7 +143,7 @@ public class Q00370_AnElderSowsSeeds extends Quest
else
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, SPELLBOOK_PAGE, 1, 0, MOBS2.get(npcId), true);
}

View File

@@ -40,7 +40,7 @@ public class Q00380_BringOutTheFlavorOfIngredients extends Quest
private static final int MOON_FLOWER = 5896;
private static final int LEECH_FLUIDS = 5897;
// Monsters
private static final Map<Integer, ItemChanceHolder> MONSTER_CHANCES = new HashMap<>();
private static final Map<Integer, ItemChanceHolder> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(20205, new ItemChanceHolder(RITRON_FRUIT, 0.1, 4)); // Dire Wolf

View File

@@ -101,7 +101,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
public String onTalk(Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
final String htmltext = getNoQuestMsg(player);
switch (npc.getId())
{
@@ -387,7 +387,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
{
for (int i0 = 0; i0 < 9; i0 += 1)
{
int i1 = getNumberFromBingoBoard(qs, i0);
final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1))
{
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
@@ -404,7 +404,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
{
for (int i0 = 0; i0 < 9; i0 += 1)
{
int i1 = getNumberFromBingoBoard(qs, i0);
final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff");
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
@@ -416,7 +416,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
if (!isSelectedBingoNumber(qs, num))
{
selectBingoNumber(qs, num);
int i3 = getMatchedBingoLineCount(qs);
final int i3 = getMatchedBingoLineCount(qs);
String html;
if ((i3 == 3) && ((getBingoSelectCount(qs)) == 6))
{
@@ -443,7 +443,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
{
if (qs.getMemoState() == 10)
{
int random = getRandom(100);
final int random = getRandom(100);
if (random < 16)
{
giveItems(player, SYNTHESIS_COKES, 1);
@@ -476,7 +476,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
}
else if (qs.getMemoState() == 20)
{
int random = getRandom(100);
final int random = getRandom(100);
if (random < 50)
{
@@ -500,7 +500,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
{
if (qs.getMemoState() == 10)
{
int random = getRandom(100);
final int random = getRandom(100);
if (random < 50)
{
@@ -521,7 +521,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
}
else if (qs.getMemoState() == 20)
{
int random = getRandom(100);
final int random = getRandom(100);
if (random < 50)
{
@@ -550,7 +550,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
private void createBingoBoard(QuestState qs)
{
//@formatter:off
Integer[] arr = {1,2,3,4,5,6,7,8,9};
final Integer[] arr = {1,2,3,4,5,6,7,8,9};
//@formatter:on
Collections.shuffle(Arrays.asList(arr));
qs.set("numbers", Arrays.asList(arr).toString().replaceAll("[^\\d ]", ""));
@@ -563,7 +563,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
*/
private int getMatchedBingoLineCount(QuestState qs)
{
String[] q = qs.get("selected").split(" ");
final String[] q = qs.get("selected").split(" ");
int found = 0;
// Horizontal
if ((q[0] + q[1] + q[2]).matches("\\d+"))
@@ -609,7 +609,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
*/
private void selectBingoNumber(QuestState qs, int num)
{
String[] numbers = qs.get("numbers").split(" ");
final String[] numbers = qs.get("numbers").split(" ");
int pos = 0;
for (int i = 0; i < numbers.length; i++)
{
@@ -619,7 +619,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
break;
}
}
String[] selected = qs.get("selected").split(" ");
final String[] selected = qs.get("selected").split(" ");
for (int i = 0; i < selected.length; i++)
{
if (i == pos)
@@ -661,7 +661,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
*/
private int getBingoSelectCount(QuestState qs)
{
String current = qs.get("selected");
final String current = qs.get("selected");
return current.replaceAll("\\D", "").length();
}
@@ -889,7 +889,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
private QuestState getRandomPlayerFromParty(PlayerInstance player, Npc npc)
{
QuestState qs = getQuestState(player, false);
final QuestState qs = getQuestState(player, false);
final List<QuestState> candidates = new ArrayList<>();
if ((qs != null) && qs.isStarted())
@@ -903,7 +903,7 @@ public class Q00384_WarehouseKeepersPastime extends Quest
player.getParty().getMembers().stream().forEach(pm ->
{
QuestState qss = getQuestState(pm, false);
final QuestState qss = getQuestState(pm, false);
if ((qss != null) && qss.isStarted() && Util.checkIfInRange(Config.ALT_PARTY_RANGE, npc, pm, true))
{
candidates.add(qss);

View File

@@ -46,7 +46,7 @@ public class Q00385_YokeOfThePast extends Quest
// Reward
private static final int BLANK_SCROLL = 5965;
// Monsters
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(21144, 0.306); // Catacomb Shadow

View File

@@ -205,7 +205,7 @@ public class Q00457_LostAndFound extends Quest
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState qs = getQuestState(player, true);
final QuestState qs = getQuestState(player, true);
switch (qs.getState())
{

View File

@@ -414,7 +414,7 @@ public class Q00511_AwlUnderFoot extends Quest
{
return ret;
}
else if(qs != null)
else if (qs != null)
{
final int npcId = npc.getId();
int cond = 0;

View File

@@ -100,7 +100,7 @@ public class Q00512_BladeUnderFoot extends Quest
final QuestState qs = getQuestState(player, false);
if ((qs != null) && Util.checkIfInRange(Config.ALT_PARTY_RANGE, npc, player, false))
{
int playerCount = player.getParty().getMemberCount();
final int playerCount = player.getParty().getMemberCount();
int itemCount = RAID_BOSSES.get(npc.getId()).getSecondChance();
if (playerCount > 0)
@@ -164,7 +164,7 @@ public class Q00512_BladeUnderFoot extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if (qs != null)
{
if (player.getParty() != null)
{

View File

@@ -58,7 +58,7 @@ public class Q00551_OlympiadStarter extends Quest
{
return getNoQuestMsg(player);
}
String htmltext = event;
final String htmltext = event;
switch (event)
{

View File

@@ -268,7 +268,7 @@ public class Q00619_RelicsOfTheOldEmpire extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
final int npcId = npc.getId();
if (CommonUtil.contains(ARCHON_OF_HALISHA, npcId))

View File

@@ -457,7 +457,7 @@ public class Q00620_FourGoblets extends Quest
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if (qs != null)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (MOB1.containsKey(npcId))
{
giveItemRandomly(qs.getPlayer(), npc, SEALED_BOX, 1, 0, MOB1.get(npcId), true);
@@ -631,7 +631,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 848)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 43)
{
giveItems(player, CORD);
@@ -677,7 +677,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 323)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 335)
{
giveItems(player, SYNTETHIC_COKES);
@@ -714,7 +714,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 847)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 148)
{
giveItems(player, BRAIDED_HEMP);
@@ -760,7 +760,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 251)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 350)
{
giveItems(player, VARNISH_OF_PURITY);
@@ -797,7 +797,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 31)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 223)
{
giveItems(player, ENCHANT_ARMOR_A_GRADE);
@@ -815,7 +815,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 5)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 202)
{
giveItems(player, ENCHANT_WEAPON_A_GRADE);
@@ -836,7 +836,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 329)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 88)
{
giveItems(player, SEALED_TATEOSSIAN_EARRING_PART);
@@ -910,7 +910,7 @@ public class Q00620_FourGoblets extends Quest
if (getRandom(1000) < 54)
{
i2 = true;
int i1 = getRandom(1000);
final int i1 = getRandom(1000);
if (i1 < 100)
{
giveItems(player, FORGOTTEN_BLADE_EDGE);

View File

@@ -67,7 +67,7 @@ public class Q00624_TheFinestIngredientsPart1 extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@@ -109,7 +109,7 @@ public class Q00659_IdRatherBeCollectingFairyBreath extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(player, npc, FAIRY_BREATH, 1, 0, MOBS.get(npc.getId()), true);
}

View File

@@ -345,14 +345,14 @@ public class Q00663_SeductiveWhispers extends Quest
if (qs.isStarted() && ((qs.getMemoState() % 10) == 6) && ((qs.getMemoState() / 1000) == 0))
{
final int card1pic = Math.max(qs.getMemoStateEx(1), 0);
int i1 = card1pic % 10;
int i2 = (card1pic - i1) / 10;
int rnd1 = getRandom(2) + 1;
int rnd2 = getRandom(5) + 1;
int card2pic = (rnd1 * 10) + rnd2;
final int i1 = card1pic % 10;
final int i2 = (card1pic - i1) / 10;
final int rnd1 = getRandom(2) + 1;
final int rnd2 = getRandom(5) + 1;
final int card2pic = (rnd1 * 10) + rnd2;
if (rnd1 == i2)
{
int i3 = rnd2 + i1;
final int i3 = rnd2 + i1;
if (((i3 % 5) == 0) && (i3 != 10))
{
qs.setMemoState(1);
@@ -397,7 +397,7 @@ public class Q00663_SeductiveWhispers extends Quest
{
if (qs.isStarted() && ((qs.getMemoState() % 10) == 7) && ((qs.getMemoState() / 1000) == 0))
{
int i0 = qs.getMemoState() / 10;
final int i0 = qs.getMemoState() / 10;
if (i0 == 0)
{
giveAdena(player, 40000, true);
@@ -616,14 +616,14 @@ public class Q00663_SeductiveWhispers extends Quest
{
card1pic = 0;
}
int card1 = card1pic % 10;
int i2 = (card1pic - card1) / 10;
int rnd1 = getRandom(2) + 1;
int rnd2 = getRandom(5) + 1;
int card2pic = (rnd1 * 10) + rnd2;
final int card1 = card1pic % 10;
final int i2 = (card1pic - card1) / 10;
final int rnd1 = getRandom(2) + 1;
final int rnd2 = getRandom(5) + 1;
final int card2pic = (rnd1 * 10) + rnd2;
if (rnd1 == i2)
{
int i3 = rnd2 + card1;
final int i3 = rnd2 + card1;
if (((i3 % 5) == 0) && (i3 != 10))
{
qs.setMemoState(1);
@@ -662,11 +662,11 @@ public class Q00663_SeductiveWhispers extends Quest
if (qs.isStarted() && qs.isMemoState(1006))
{
final int card1pic = Math.max(qs.getMemoStateEx(1), 0);
int i1 = card1pic % 10;
int i2 = (card1pic - i1) / 10;
int rnd1 = getRandom(2) + 1;
int rnd2 = getRandom(5) + 1;
int card2pic = (rnd1 * 10) + rnd2;
final int i1 = card1pic % 10;
final int i2 = (card1pic - i1) / 10;
final int rnd1 = getRandom(2) + 1;
final int rnd2 = getRandom(5) + 1;
final int card2pic = (rnd1 * 10) + rnd2;
if (rnd1 == i2)
{
final int i3 = rnd2 + i1;

View File

@@ -197,7 +197,7 @@ public class Q10292_SevenSignsGirlOfDoubt extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
if (CommonUtil.contains(MOBS, npc.getId()))
{

View File

@@ -108,7 +108,7 @@ public class TerritoryWarSuperClass extends Quest
private void handleKillTheQuest(PlayerInstance player)
{
QuestState qs = getQuestState(player, true);
final QuestState qs = getQuestState(player, true);
int kill = 1;
int max = 10;
if (!qs.isCompleted())

View File

@@ -3303,11 +3303,11 @@ public class Config
NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", "");
NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5);
NETWORK_REWARD_CHECK_TIME = VoteReward.getInt("NetworkRewardCheckTime", 5);
String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
final String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
final String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
for (String i : NETWORK_small_reward_splitted_1)
{
String[] NETWORK_small_reward_splitted_2 = i.split(",");
final String[] NETWORK_small_reward_splitted_2 = i.split(",");
NETWORK_REWARD.put(Integer.parseInt(NETWORK_small_reward_splitted_2[0]), Integer.parseInt(NETWORK_small_reward_splitted_2[1]));
}
NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1);
@@ -3316,11 +3316,11 @@ public class Config
TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", "");
TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5);
TOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("TopzoneRewardCheckTime", 5);
String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
final String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
final String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
for (String i : topzone_small_reward_splitted_1)
{
String[] topzone_small_reward_splitted_2 = i.split(",");
final String[] topzone_small_reward_splitted_2 = i.split(",");
TOPZONE_REWARD.put(Integer.parseInt(topzone_small_reward_splitted_2[0]), Integer.parseInt(topzone_small_reward_splitted_2[1]));
}
TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1);
@@ -3329,11 +3329,11 @@ public class Config
HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", "");
HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5);
HOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("HopzoneRewardCheckTime", 5);
String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
final String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
final String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
for (String i : hopzone_small_reward_splitted_1)
{
String[] hopzone_small_reward_splitted_2 = i.split(",");
final String[] hopzone_small_reward_splitted_2 = i.split(",");
HOPZONE_REWARD.put(Integer.parseInt(hopzone_small_reward_splitted_2[0]), Integer.parseInt(hopzone_small_reward_splitted_2[1]));
}
HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1);

View File

@@ -71,7 +71,7 @@ public class LimitLinesDocumentListener implements DocumentListener
{
if (maximumLines < 1)
{
String message = "Maximum lines must be greater than 0";
final String message = "Maximum lines must be greater than 0";
throw new IllegalArgumentException(message);
}
@@ -106,8 +106,8 @@ public class LimitLinesDocumentListener implements DocumentListener
private void removeLines(DocumentEvent e)
{
// The root Element of the Document will tell us the total number of line in the Document.
Document document = e.getDocument();
Element root = document.getDefaultRootElement();
final Document document = e.getDocument();
final Element root = document.getDefaultRootElement();
while (root.getElementCount() > _maximumLines)
{
@@ -127,8 +127,8 @@ public class LimitLinesDocumentListener implements DocumentListener
*/
private void removeFromStart(Document document, Element root)
{
Element line = root.getElement(0);
int end = line.getEndOffset();
final Element line = root.getElement(0);
final int end = line.getEndOffset();
try
{
@@ -147,9 +147,9 @@ public class LimitLinesDocumentListener implements DocumentListener
{
// We use start minus 1 to make sure we remove the newline character of the previous line.
Element line = root.getElement(root.getElementCount() - 1);
int start = line.getStartOffset();
int end = line.getEndOffset();
final Element line = root.getElement(root.getElementCount() - 1);
final int start = line.getStartOffset();
final int end = line.getEndOffset();
try
{

View File

@@ -44,7 +44,7 @@ public class SplashScreen extends JWindow
{
setBackground(new Color(0, 255, 0, 0)); // Transparency.
image = Toolkit.getDefaultToolkit().getImage(path);
ImageIcon imageIcon = new ImageIcon(image);
final ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null);
setAlwaysOnTop(true);

View File

@@ -818,7 +818,7 @@ public class AttackableAI extends CreatureAI
// Handle all WorldObject 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;
@@ -839,8 +839,8 @@ public class AttackableAI extends CreatureAI
{
if (originalAttackTarget.isInParty() && originalAttackTarget.getParty().isInDimensionalRift())
{
byte riftType = originalAttackTarget.getParty().getDimensionalRift().getType();
byte riftRoom = originalAttackTarget.getParty().getDimensionalRift().getCurrentRoom();
final byte riftType = originalAttackTarget.getParty().getDimensionalRift().getType();
final byte riftRoom = originalAttackTarget.getParty().getDimensionalRift().getCurrentRoom();
if ((npc instanceof RiftInvaderInstance) && !DimensionalRiftManager.getInstance().getRoom(riftType, riftRoom).checkIfInZone(npc.getX(), npc.getY(), npc.getZ()))
{
@@ -911,12 +911,12 @@ public class AttackableAI extends CreatureAI
if (!npc.isMovementDisabled() && (npc.getDodge() > 0) && (Rnd.get(100) <= npc.getDodge()))
{
// Micht: Keeping this one otherwise we should do 2 sqrt
double distance2 = npc.calculateDistanceSq2D(mostHate);
final double distance2 = npc.calculateDistanceSq2D(mostHate);
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)
{
@@ -973,7 +973,7 @@ public class AttackableAI extends CreatureAI
{
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();
@@ -1107,7 +1107,7 @@ public class AttackableAI extends CreatureAI
{
if (npc.isMinion())
{
Creature leader = npc.getLeader();
final Creature leader = npc.getLeader();
if ((leader != null) && leader.isDead())
{
for (Skill sk : aiResSkills)
@@ -1350,7 +1350,7 @@ public class AttackableAI extends CreatureAI
}
else if (sk.getTargetType() == TargetType.ONE)
{
Creature target = effectTargetReconsider(sk, false);
final Creature target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1483,7 +1483,7 @@ public class AttackableAI extends CreatureAI
return true;
}
Creature target = skillTargetReconsider(sk);
final Creature target = skillTargetReconsider(sk);
if (target != null)
{
clientStopMoving(null);
@@ -1512,7 +1512,7 @@ public class AttackableAI extends CreatureAI
return true;
}
Creature target = effectTargetReconsider(sk, false);
final Creature target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1565,7 +1565,7 @@ public class AttackableAI extends CreatureAI
}
else if (sk.getTargetType() == TargetType.ONE)
{
Creature target = effectTargetReconsider(sk, false);
final Creature target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1603,7 +1603,7 @@ public class AttackableAI extends CreatureAI
}
else if (sk.getTargetType() == TargetType.ONE)
{
Creature target = effectTargetReconsider(sk, false);
final Creature target = effectTargetReconsider(sk, false);
if (target != null)
{
clientStopMoving(null);
@@ -1619,7 +1619,7 @@ public class AttackableAI extends CreatureAI
{
if (caster.isMinion() && (sk.getTargetType() != TargetType.SELF))
{
Creature leader = caster.getLeader();
final Creature leader = caster.getLeader();
if (leader != null)
{
if (leader.isDead() && !Util.checkIfInRange((sk.getCastRange() + caster.getTemplate().getCollisionRadius() + leader.getTemplate().getCollisionRadius()), caster, leader, false) && !isParty(sk) && !caster.isMovementDisabled())
@@ -1684,7 +1684,7 @@ public class AttackableAI extends CreatureAI
return true;
}
Creature target = skillTargetReconsider(sk);
final Creature target = skillTargetReconsider(sk);
if (target != null)
{
clientStopMoving(null);

View File

@@ -175,7 +175,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
// Check if actor is not dead
if (!_actor.isAlikeDead())
{
Attackable npc = (Attackable) _actor;
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (!World.getInstance().getVisibleObjects(npc, PlayerInstance.class).isEmpty())

View File

@@ -168,7 +168,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
// Check if actor is not dead
if (!_actor.isAlikeDead())
{
Attackable npc = (Attackable) _actor;
final Attackable npc = (Attackable) _actor;
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
if (!World.getInstance().getVisibleObjects(npc, PlayerInstance.class).isEmpty())

View File

@@ -120,7 +120,7 @@ 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, StandardCharsets.UTF_8);

View File

@@ -60,8 +60,8 @@ public class SchemeBufferTable
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
final PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
final ResultSet rs = st.executeQuery();
while (rs.next())
{
@@ -70,7 +70,7 @@ public class SchemeBufferTable
final String schemeName = rs.getString("scheme_name");
final String[] skills = rs.getString("skills").split(",");
ArrayList<Integer> schemeList = new ArrayList<>();
final ArrayList<Integer> schemeList = new ArrayList<>();
for (String skill : skills)
{
@@ -97,9 +97,9 @@ public class SchemeBufferTable
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("./data/SchemeBufferSkills.xml"));
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
final DocumentBuilder db = dbf.newDocumentBuilder();
final Document doc = db.parse(new File("./data/SchemeBufferSkills.xml"));
final Node n = doc.getFirstChild();
@@ -246,7 +246,7 @@ public class SchemeBufferTable
*/
public List<Integer> getSkillsIdsByType(String groupType)
{
List<Integer> skills = new ArrayList<>();
final List<Integer> skills = new ArrayList<>();
for (BuffSkillHolder skill : _availableBuffs.values())
{
if (skill.getType().equalsIgnoreCase(groupType))
@@ -262,7 +262,7 @@ public class SchemeBufferTable
*/
public List<String> getSkillTypes()
{
List<String> skillTypes = new ArrayList<>();
final List<String> skillTypes = new ArrayList<>();
for (BuffSkillHolder skill : _availableBuffs.values())
{
if (!skillTypes.contains(skill.getType()))

View File

@@ -132,7 +132,7 @@ public class GeoEngine
FileChannel fc = raf.getChannel())
{
// initialize file buffer
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
final MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
buffer.order(ByteOrder.LITTLE_ENDIAN);
// get block indexes
@@ -553,7 +553,7 @@ public class GeoEngine
dirt = 0;
// calculate next point coordinates
int e2 = 2 * d;
final int e2 = 2 * d;
if ((e2 > -dy) && (e2 < dx))
{
// calculate next point XY coordinates
@@ -703,7 +703,7 @@ public class GeoEngine
}
// perform geodata check
GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instanceId);
final GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instanceId);
return (loc.getGeoX() == gtx) && (loc.getGeoY() == gty);
}
@@ -829,7 +829,7 @@ public class GeoEngine
direction = 0;
// calculate next point coordinates
int e2 = 2 * d;
final int e2 = 2 * d;
if ((e2 > -dy) && (e2 < dx))
{
d -= dy;

View File

@@ -39,18 +39,18 @@ final class GeoEnginePathfinding extends GeoEngine
{
super();
String[] array = Config.PATHFIND_BUFFERS.split(";");
final String[] array = Config.PATHFIND_BUFFERS.split(";");
_buffers = new BufferHolder[array.length];
int count = 0;
for (int i = 0; i < array.length; i++)
{
String buf = array[i];
String[] args = buf.split("x");
final String buf = array[i];
final String[] args = buf.split("x");
try
{
int size = Integer.parseInt(args[1]);
final int size = Integer.parseInt(args[1]);
count += size;
_buffers[i] = new BufferHolder(Integer.parseInt(args[0]), size);
}
@@ -67,24 +67,24 @@ final class GeoEnginePathfinding extends GeoEngine
public List<Location> findPath(int ox, int oy, int oz, int tx, int ty, int tz, int instance)
{
// get origin and check existing geo coords
int gox = getGeoX(ox);
int goy = getGeoY(oy);
final int gox = getGeoX(ox);
final int goy = getGeoY(oy);
if (!hasGeoPos(gox, goy))
{
return null;
}
short goz = getHeightNearest(gox, goy, oz);
final short goz = getHeightNearest(gox, goy, oz);
// get target and check existing geo coords
int gtx = getGeoX(tx);
int gty = getGeoY(ty);
final int gtx = getGeoX(tx);
final int gty = getGeoY(ty);
if (!hasGeoPos(gtx, gty))
{
return null;
}
short gtz = getHeightNearest(gtx, gty, tz);
final short gtz = getHeightNearest(gtx, gty, tz);
// Prepare buffer for pathfinding calculations
final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))));
@@ -97,7 +97,7 @@ final class GeoEnginePathfinding extends GeoEngine
List<Location> path = null;
try
{
Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
final Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
if (result == null)
{
@@ -123,7 +123,7 @@ final class GeoEnginePathfinding extends GeoEngine
}
// get path list iterator
ListIterator<Location> point = path.listIterator();
final ListIterator<Location> point = path.listIterator();
// get node A (origin)
int nodeAx = gox;
@@ -138,10 +138,10 @@ final class GeoEnginePathfinding extends GeoEngine
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{
// get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
final GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
// check movement from node A to node C
GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
final GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
if ((loc.getGeoX() == nodeC.getGeoX()) && (loc.getGeoY() == nodeC.getGeoY()))
{
// can move from node A to node C
@@ -174,7 +174,7 @@ final class GeoEnginePathfinding extends GeoEngine
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();
final LinkedList<Location> list = new LinkedList<>();
// set direction X/Y
int dx = 0;

View File

@@ -86,7 +86,7 @@ public class BlockMultilayer extends ABlock
if (format != GeoFormat.L2D)
{
// get data
short data = bb.getShort();
final short data = bb.getShort();
// add nswe and height
_temp.put((byte) (data & 0x000F));
@@ -453,7 +453,7 @@ public class BlockMultilayer extends ABlock
for (int i = 0; i < GeoStructure.BLOCK_CELLS; i++)
{
// write layers count
byte layers = _buffer[index++];
final byte layers = _buffer[index++];
stream.write(layers);
// write cell data

View File

@@ -133,7 +133,7 @@ public class NodeBuffer
private final void expand()
{
// can't move anywhere, don't expand
byte nswe = _current.getLoc().getNSWE();
final byte nswe = _current.getLoc().getNSWE();
if (nswe == 0)
{
return;
@@ -217,7 +217,7 @@ public class NodeBuffer
}
// get node
Node result = _buffer[ix][iy];
final Node result = _buffer[ix][iy];
// check and update
if (result.getLoc() == null)
@@ -239,7 +239,7 @@ public class NodeBuffer
private final void addNode(int x, int y, short z, int weight)
{
// get node to be expanded
Node node = getNode(x, y, z);
final Node node = getNode(x, y, z);
if (node == null)
{
return;

View File

@@ -90,7 +90,7 @@ public class GrandBossManager implements IStorable
info.set("respawn_time", rs.getLong("respawn_time"));
info.set("currentHP", rs.getDouble("currentHP"));
info.set("currentMP", rs.getDouble("currentMP"));
int status = rs.getInt("status");
final int status = rs.getInt("status");
_bossStatus.put(bossId, status);
_storedInfo.put(bossId, info);
LOGGER.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status + ".");

View File

@@ -227,7 +227,7 @@ public class InstanceManager implements IXmlReader
}
case "instance":
{
NamedNodeMap attrs = n.getAttributes();
final NamedNodeMap attrs = n.getAttributes();
_instanceTemplates.put(parseInteger(attrs, "id"), new File("data/instances/").toURI().relativize(f.toURI()).getPath());
break;
}

View File

@@ -95,7 +95,7 @@ public class PremiumManager
private final Consumer<OnPlayerLogout> playerLogoutEvent = (event) ->
{
PlayerInstance player = event.getPlayer();
final PlayerInstance player = event.getPlayer();
stopExpireTask(player);
};
@@ -111,7 +111,7 @@ public class PremiumManager
*/
private void startExpireTask(PlayerInstance player, long delay)
{
ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
final ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
expiretasks.put(player.getAccountName(), task);
}
@@ -155,11 +155,11 @@ public class PremiumManager
public void addPremiumTime(String accountName, int timeValue, TimeUnit timeUnit)
{
long addTime = timeUnit.toMillis(timeValue);
long now = System.currentTimeMillis();
final long addTime = timeUnit.toMillis(timeValue);
final long now = System.currentTimeMillis();
// new premium task at least from now
long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
long newPremiumExpiration = oldPremiumExpiration + addTime;
final long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
final long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
try (Connection con = DatabaseFactory.getConnection();
@@ -178,7 +178,7 @@ public class PremiumManager
premiumData.put(accountName, newPremiumExpiration);
// UPDATE PlAYER PREMIUMSTATUS
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
if (playerOnline != null)
{
stopExpireTask(playerOnline);
@@ -195,7 +195,7 @@ public class PremiumManager
{
if (checkOnline)
{
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
if ((playerOnline != null) && playerOnline.hasPremiumStatus())
{
playerOnline.setPremiumStatus(false);

View File

@@ -326,7 +326,7 @@ public class RaidBossSpawnManager
{
for (Entry<Integer, StatsSet> entry : _storedInfo.entrySet())
{
Integer bossId = entry.getKey();
final Integer bossId = entry.getKey();
if (bossId == null)
{
continue;

View File

@@ -170,7 +170,7 @@ public class Territory
int zmin = _zMin;
for (Point p1 : _points)
{
double distance = Math.hypot(p1._x - x, p1._y - y);
final double distance = Math.hypot(p1._x - x, p1._y - y);
if ((curdistance == 0) || (distance < curdistance))
{
curdistance = distance;

View File

@@ -1996,7 +1996,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
boolean canCast = true;
if ((skill.getTargetType() == TargetType.GROUND) && isPlayer())
{
Location wp = getActingPlayer().getCurrentSkillWorldPosition();
final Location wp = getActingPlayer().getCurrentSkillWorldPosition();
if (!zoneRegion.checkEffectRangeInsidePeaceZone(skill, wp.getX(), wp.getY(), wp.getZ()))
{
canCast = false;
@@ -3908,7 +3908,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
final int xPrev = getX();
final int yPrev = getY();
int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
double dx;
double dy;
@@ -5726,12 +5726,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if ((skillEffectPoint > 0) && attackable.hasAI() && (attackable.getAI().getIntention() == AI_INTENTION_ATTACK))
{
WorldObject npcTarget = attackable.getTarget();
final WorldObject npcTarget = attackable.getTarget();
for (WorldObject skillTarget : targets)
{
if ((npcTarget == skillTarget) || (npcMob == skillTarget))
{
Creature originalCaster = isSummon() ? this : player;
final Creature originalCaster = isSummon() ? this : player;
attackable.addDamageHate(originalCaster, 0, (skillEffectPoint * 150) / (attackable.getLevel() + 7));
}
}

View File

@@ -151,7 +151,7 @@ public class Npc extends Creature
private int _shotsMask = 0;
private int _killingBlowWeaponId;
/** Map of summoned NPCs by this NPC. */
private volatile Map<Integer, Npc> _summonedNpcs = null;
private Map<Integer, Npc> _summonedNpcs = null;
/**
* Creates a NPC.

View File

@@ -307,7 +307,7 @@ public abstract class Summon extends Playable
return;
}
AggroInfo info = targetMob.getAggroList().get(this);
final AggroInfo info = targetMob.getAggroList().get(this);
if (info != null)
{
targetMob.addDamageHate(_owner, info.getDamage(), info.getHate());

View File

@@ -289,14 +289,14 @@ public abstract class Vehicle extends Creature
{
if (itemId > 0)
{
ItemInstance ticket = player.getInventory().getItemByItemId(itemId);
final ItemInstance ticket = player.getInventory().getItemByItemId(itemId);
if ((ticket == null) || (player.getInventory().destroyItem("Boat", ticket, count, player, this) == null))
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_POSSESS_THE_CORRECT_TICKET_TO_BOARD_THE_BOAT);
player.teleToLocation(new Location(oustX, oustY, oustZ), true);
return;
}
InventoryUpdate iu = new InventoryUpdate();
final InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(ticket);
player.sendPacket(iu);
}

View File

@@ -417,7 +417,7 @@ public class DoorInstance extends Creature
@Override
public void broadcastStatusUpdate()
{
Collection<PlayerInstance> knownPlayers = World.getInstance().getVisibleObjects(this, PlayerInstance.class);
final Collection<PlayerInstance> knownPlayers = World.getInstance().getVisibleObjects(this, PlayerInstance.class);
if ((knownPlayers == null) || knownPlayers.isEmpty())
{
return;

View File

@@ -53,7 +53,7 @@ public class GuardInstance extends Attackable
}
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayable())
{
PlayerInstance player = attacker.getActingPlayer();
final PlayerInstance player = attacker.getActingPlayer();
if ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)))
{
return true;

View File

@@ -49,8 +49,8 @@ public class SchemeBufferInstance extends Npc
// Simple hack to use createscheme bypass with a space.
command = command.replace("createscheme ", "createscheme;");
StringTokenizer st = new StringTokenizer(command, ";");
String currentCommand = st.nextToken();
final StringTokenizer st = new StringTokenizer(command, ";");
final String currentCommand = st.nextToken();
if (currentCommand.startsWith("menu"))
{

View File

@@ -332,7 +332,7 @@ public class TrapInstance extends Npc
else
{
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_DONE_S3_POINTS_OF_DAMAGE_TO_C2);
sm.addString(this.getName());
sm.addString(getName());
sm.addString(target.getName());
sm.addInt(damage);
_owner.sendPacket(sm);

View File

@@ -908,7 +908,7 @@ public class VillageMasterInstance extends NpcInstance
}
}
Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
final Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
if (unavailableClasses != null)
{
subclasses.removeAll(unavailableClasses);

View File

@@ -140,7 +140,7 @@ public enum ClassId implements IIdentifiable
FORTUNE_SEEKER(117, false, Race.DWARF, BOUNTY_HUNTER),
MAESTRO(118, false, Race.DWARF, WARSMITH),
MALE_SOLDIER(123, false, Race.KAMAEL, null),
FEMALE_SOLDIER(124, false, Race.KAMAEL, null),
TROOPER(125, false, Race.KAMAEL, MALE_SOLDIER),

View File

@@ -419,7 +419,7 @@ public class Instance
*/
public List<Npc> spawnGroup(String groupName)
{
List<Npc> spawnedNpcs = new ArrayList<>();
final List<Npc> spawnedNpcs = new ArrayList<>();
for (StatsSet set : _spawnTemplates)
{
if (set.getString("spawnGroup").equals(groupName))

View File

@@ -67,7 +67,7 @@ public class PreparedListContainer extends ListContainer
{
if (!entry.getIngredients().isEmpty())
{
int ingredientId = entry.getIngredients().get(0).getItemId();
final int ingredientId = entry.getIngredients().get(0).getItemId();
for (ItemInstance item : items)
{
if (!item.isEquipped() && (item.getId() == ingredientId))

View File

@@ -675,13 +675,13 @@ public class Olympiad extends ListenersContainer
}
else
{
Calendar currentTime = Calendar.getInstance();
final Calendar currentTime = Calendar.getInstance();
currentTime.set(Calendar.AM_PM, Calendar.AM);
currentTime.set(Calendar.HOUR, 12);
currentTime.set(Calendar.MINUTE, 0);
currentTime.set(Calendar.SECOND, 0);
Calendar nextChange = Calendar.getInstance();
final Calendar nextChange = Calendar.getInstance();
switch (Config.ALT_OLY_PERIOD)
{

View File

@@ -48,7 +48,7 @@ public class Hopzone extends VoteSystem
try
{
URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection();
final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection();
con.addRequestProperty("User-Agent", "Mozilla/5.0");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

View File

@@ -48,7 +48,7 @@ public class Network extends VoteSystem
try
{
URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection();
final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection();
con.addRequestProperty("User-Agent", "Mozilla/5.0");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

View File

@@ -48,7 +48,7 @@ public class Topzone extends VoteSystem
try
{
URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection();
final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection();
con.addRequestProperty("User-Agent", "L2TopZone");
isr = new InputStreamReader(con.getInputStream());
br = new BufferedReader(isr);

View File

@@ -99,7 +99,7 @@ public abstract class VoteSystem implements Runnable
protected void reward()
{
int currentVotes = getVotes();
final int currentVotes = getVotes();
if (currentVotes == -1)
{
@@ -122,7 +122,7 @@ public abstract class VoteSystem implements Runnable
if (currentVotes >= (lastVotes + votesDiff))
{
Collection<PlayerInstance> pls = World.getInstance().getPlayers();
final Collection<PlayerInstance> pls = World.getInstance().getPlayers();
if (allowReport)
{
LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes);
@@ -139,10 +139,10 @@ public abstract class VoteSystem implements Runnable
}
boolean canReward = false;
String pIp = p.getClient().getConnectionAddress().getHostAddress();
final String pIp = p.getClient().getConnectionAddress().getHostAddress();
if (playerIps.containsKey(pIp))
{
int count = playerIps.get(pIp);
final int count = playerIps.get(pIp);
if (count < boxes)
{
playerIps.remove(pIp);
@@ -185,7 +185,7 @@ public abstract class VoteSystem implements Runnable
private void announce(String msg)
{
CreatureSay cs = new CreatureSay(0, ChatType.CRITICAL_ANNOUNCE, "", msg);
final CreatureSay cs = new CreatureSay(0, ChatType.CRITICAL_ANNOUNCE, "", msg);
Broadcast.toAllOnlinePlayers(cs);
}

View File

@@ -235,7 +235,7 @@ public class RequestBypassToServer implements IClientIncomingPacket
{
if (bypassOriginId > 0)
{
WorldObject bypassOrigin = World.getInstance().findObject(bypassOriginId);
final WorldObject bypassOrigin = World.getInstance().findObject(bypassOriginId);
if ((bypassOrigin != null) && bypassOrigin.isCreature())
{
handler.useBypass(_command, player, (Creature) bypassOrigin);

View File

@@ -77,7 +77,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
return;
}
ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
final ItemInstance item = player.getInventory().getItemByObjectId(_objectId);
ItemInstance scroll = player.getInventory().getItemByObjectId(player.getActiveEnchantItemId());
ItemInstance support = player.getInventory().getItemByObjectId(player.getActiveEnchantSupportItemId());

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