Small code improvements.

This commit is contained in:
MobiusDev 2017-08-28 03:19:28 +00:00
parent cfb8cc59e2
commit aec0c9dddb
114 changed files with 549 additions and 606 deletions

View File

@ -54,7 +54,7 @@ public class IPSubnet
_mask = getMask(mask, _addr.length);
if (!applyMask(_addr))
{
throw new UnknownHostException(addr.toString() + "/" + mask);
throw new UnknownHostException(addr + "/" + mask);
}
}
@ -117,7 +117,7 @@ public class IPSubnet
try
{
return InetAddress.getByAddress(_addr).toString() + "/" + size;
return InetAddress.getByAddress(_addr) + "/" + size;
}
catch (UnknownHostException e)
{
@ -144,7 +144,7 @@ public class IPSubnet
return false;
}
private static final byte[] getMask(int n, int maxLength) throws UnknownHostException
private static byte[] getMask(int n, int maxLength) throws UnknownHostException
{
if ((n > (maxLength << 3)) || (n < 0))
{

View File

@ -61,7 +61,7 @@ public class GeoEngine
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static final GeoEngine getInstance()
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
@ -226,7 +226,7 @@ public class GeoEngine
* @param worldX
* @return int : Geo X
*/
public static final int getGeoX(int worldX)
public static int getGeoX(int worldX)
{
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
}
@ -236,7 +236,7 @@ public class GeoEngine
* @param worldY
* @return int : Geo Y
*/
public static final int getGeoY(int worldY)
public static int getGeoY(int worldY)
{
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
}
@ -246,7 +246,7 @@ public class GeoEngine
* @param geoX
* @return int : World X
*/
public static final int getWorldX(int geoX)
public static int getWorldX(int geoX)
{
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
}
@ -256,7 +256,7 @@ public class GeoEngine
* @param geoY
* @return int : World Y
*/
public static final int getWorldY(int geoY)
public static int getWorldY(int geoY)
{
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
}
@ -364,7 +364,7 @@ public class GeoEngine
* @param inside : 2D description of {@link IGeoObject}
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
*/
public static final byte[][] calculateGeoObject(boolean inside[][])
public static byte[][] calculateGeoObject(boolean inside[][])
{
// get dimensions
final int width = inside.length;
@ -1260,7 +1260,7 @@ public class GeoEngine
* @param dirY : Y direction NSWE flag
* @return byte : NSWE flag of combined direction
*/
private static final byte getDirXY(byte dirX, byte dirY)
private static byte getDirXY(byte dirX, byte dirY)
{
// check axis directions
if (dirY == GeoStructure.CELL_FLAG_N)

View File

@ -171,7 +171,7 @@ final class GeoEnginePathfinding extends GeoEngine
* @param target : the entry point
* @return List<NodeLoc> : list of node location
*/
private static final List<Location> constructPath(Node target)
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();

View File

@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
/**
* Initializes the temporarily buffer.
*/
public static final void initialize()
public static void initialize()
{
// initialize temporarily buffer and sorting mechanism
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
/**
* Releases temporarily buffer.
*/
public static final void release()
public static void release()
{
_temp = null;
}

View File

@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -25,11 +25,11 @@ public interface IBlockDynamic
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be added.
*/
public void addGeoObject(IGeoObject object);
void addGeoObject(IGeoObject object);
/**
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be removed.
*/
public void removeGeoObject(IGeoObject object);
void removeGeoObject(IGeoObject object);
}

View File

@ -25,29 +25,29 @@ public interface IGeoObject
* Returns geodata X coordinate of the {@link IGeoObject}.
* @return int : Geodata X coordinate.
*/
public int getGeoX();
int getGeoX();
/**
* Returns geodata Y coordinate of the {@link IGeoObject}.
* @return int : Geodata Y coordinate.
*/
public int getGeoY();
int getGeoY();
/**
* Returns geodata Z coordinate of the {@link IGeoObject}.
* @return int : Geodata Z coordinate.
*/
public int getGeoZ();
int getGeoZ();
/**
* Returns height of the {@link IGeoObject}.
* @return int : Height.
*/
public int getHeight();
int getHeight();
/**
* Returns {@link IGeoObject} data.
* @return byte[][] : {@link IGeoObject} data.
*/
public byte[][] getObjectGeoData();
byte[][] getObjectGeoData();
}

View File

@ -44,12 +44,12 @@ import com.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState;
*/
public class PremiumManager
{
private final static Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
// SQL Statement
private final static String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private final static String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private final static String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private static final String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private static final String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
class PremiumExpireTask implements Runnable
{

View File

@ -59,7 +59,7 @@ public class PcStat extends PlayableStat
public static final int MAX_VITALITY_POINTS = 140000;
public static final int MIN_VITALITY_POINTS = 0;
private final static int FANCY_FISHING_ROD_SKILL = 21484;
private static final int FANCY_FISHING_ROD_SKILL = 21484;
public PcStat(L2PcInstance activeChar)
{

View File

@ -242,29 +242,26 @@ public class PlayerVariables extends AbstractVariables
final String data = getString(EXTEND_DROP, "");
if (data.isEmpty())
{
result = Integer.toString(id) + "," + Long.toString(count);
result = id + "," + count;
}
else if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + count;
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + Long.toString(count);
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
result = Integer.toString(id) + "," + Long.toString(count);
}
result = id + "," + count;
}
set(EXTEND_DROP, result);
}

View File

@ -31,18 +31,18 @@ public interface SchedulerListener
* This one is called by the scheduler when a task execution is starting.
* @param executor The task executor.
*/
public void taskLaunching(TaskExecutor executor);
void taskLaunching(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has been successfully completed.
* @param executor The task executor.
*/
public void taskSucceeded(TaskExecutor executor);
void taskSucceeded(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has failed.
* @param executor The task executor.
* @param exception The exception representing the failure notification.
*/
public void taskFailed(TaskExecutor executor, Throwable exception);
void taskFailed(TaskExecutor executor, Throwable exception);
}

View File

@ -519,19 +519,19 @@ public class SchedulingPattern
* @return The parsed value.
* @throws Exception If the value can't be parsed.
*/
public int parse(String value) throws Exception;
int parse(String value) throws Exception;
/**
* Returns the minimum value accepred by the parser.
* @return The minimum value accepred by the parser.
*/
public int getMinValue();
int getMinValue();
/**
* Returns the maximum value accepred by the parser.
* @return The maximum value accepred by the parser.
*/
public int getMaxValue();
int getMaxValue();
}
/**

View File

@ -33,5 +33,5 @@ public interface TaskCollector
* returned table elements, executing any task whose scheduling pattern is matching the current system time.
* @return The task table that will be automatically injected in the scheduler.
*/
public TaskTable getTasks();
TaskTable getTasks();
}

View File

@ -32,36 +32,36 @@ public interface TaskExecutionContext
* Returns the scheduler.
* @return The scheduler.
*/
public Scheduler getScheduler();
Scheduler getScheduler();
/**
* Returns the task executor.
* @return The task executor.
*/
public TaskExecutor getTaskExecutor();
TaskExecutor getTaskExecutor();
/**
* Sets the current status tracking message, that has to be something about what the task is doing at the moment.
* @param message A message representing the current execution status. Null messages will be blanked.
*/
public void setStatusMessage(String message);
void setStatusMessage(String message);
/**
* Sets the completeness tracking value, that has to be between 0 and 1.
* @param completeness A completeness value, between 0 and 1. Values out of range will be ignored.
*/
public void setCompleteness(double completeness);
void setCompleteness(double completeness);
/**
* If the task execution has been paused, stops until the operation is resumed. It can also returns because of a stop operation without any previous resuming. Due to this the task developer should always check the {@link TaskExecutionContext#isStopped()} value after any
* <em>pauseIfRequested()</em> call. Note that a task execution can be paused only if the task {@link Task#canBePaused()} method returns <em>true</em>.
*/
public void pauseIfRequested();
void pauseIfRequested();
/**
* Checks whether the task execution has been demanded to be stopped. If the returned value is <em>true</em>, the task developer must shut down gracefully its task execution, as soon as possible. Note that a task execution can be stopped only if the task {@link Task#canBePaused()} method returns
* <em>true</em>.
* @return <em>true</em> if the current task execution has been demanded to be stopped; <em>false</em> otherwise.
*/
public boolean isStopped();
boolean isStopped();
}

View File

@ -30,38 +30,38 @@ public interface TaskExecutorListener
* Called when the execution has been requested to be paused.
* @param executor The source executor.
*/
public void executionPausing(TaskExecutor executor);
void executionPausing(TaskExecutor executor);
/**
* Called when the execution has been requested to be resumed.
* @param executor The source executor.
*/
public void executionResuming(TaskExecutor executor);
void executionResuming(TaskExecutor executor);
/**
* Called when the executor has been requested to be stopped.
* @param executor The source executor.
*/
public void executionStopping(TaskExecutor executor);
void executionStopping(TaskExecutor executor);
/**
* Called at execution end. If the execution has failed due to an error, the encountered exception is reported.
* @param executor The source executor.
* @param exception If the execution has been terminated due to an error, this is the encountered exception; otherwise the parameter is null.
*/
public void executionTerminated(TaskExecutor executor, Throwable exception);
void executionTerminated(TaskExecutor executor, Throwable exception);
/**
* Called every time the execution status message changes.
* @param executor The source executor.
* @param statusMessage The new status message.
*/
public void statusMessageChanged(TaskExecutor executor, String statusMessage);
void statusMessageChanged(TaskExecutor executor, String statusMessage);
/**
* Called every time the execution completeness value changes.
* @param executor The source executor.
* @param completenessValue The new completeness value.
*/
public void completenessValueChanged(TaskExecutor executor, double completenessValue);
void completenessValueChanged(TaskExecutor executor, double completenessValue);
}

View File

@ -31,5 +31,5 @@ interface ValueMatcher
* @param value The value.
* @return true if the given value matches the rules of the ValueMatcher, false otherwise.
*/
public boolean match(int value);
boolean match(int value);
}

View File

@ -165,7 +165,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}
@ -179,7 +179,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}

View File

@ -228,7 +228,7 @@ public class Tokenizer
while (symbol.length() > 0)
{
Operator op = this.getOperator(symbol.toString());
Operator op = getOperator(symbol.toString());
if (op == null)
{
symbol.setLength(symbol.length() - 1);

View File

@ -49,7 +49,7 @@ public class IPv4Filter implements IAcceptFilter, Runnable
* @param ip
* @return
*/
private static final int hash(byte[] ip)
private static int hash(byte[] ip)
{
return (ip[0] & 0xFF) | ((ip[1] << 8) & 0xFF00) | ((ip[2] << 16) & 0xFF0000) | ((ip[3] << 24) & 0xFF000000);
}

View File

@ -70,7 +70,7 @@ public final class GeoDataConverter
_format = type.equalsIgnoreCase("J") ? GeoFormat.L2J : GeoFormat.L2OFF;
// start conversion
System.out.println("GeoDataConverter: Converting all " + _format.toString() + " files.");
System.out.println("GeoDataConverter: Converting all " + _format + " files.");
// initialize geodata container
_blocks = new ABlock[GeoStructure.REGION_BLOCKS_X][GeoStructure.REGION_BLOCKS_Y];
@ -116,7 +116,7 @@ public final class GeoDataConverter
}
}
}
System.out.println("GeoDataConverter: Converted " + converted + " " + _format.toString() + " to L2D region file(s).");
System.out.println("GeoDataConverter: Converted " + converted + " " + _format + " to L2D region file(s).");
// release multilayer block temporarily buffer
BlockMultilayer.release();
@ -127,7 +127,7 @@ public final class GeoDataConverter
* @param filename : The name of the to load.
* @return boolean : True when successful.
*/
private static final boolean loadGeoBlocks(String filename)
private static boolean loadGeoBlocks(String filename)
{
// region file is load-able, try to load it
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
@ -217,7 +217,7 @@ public final class GeoDataConverter
* Recalculate diagonal flags for the region file.
* @return boolean : True when successful.
*/
private static final boolean recalculateNswe()
private static boolean recalculateNswe()
{
try
{
@ -268,7 +268,7 @@ public final class GeoDataConverter
* @param nswe : NSWE flag to be updated.
* @return byte : Updated NSWE flag.
*/
private static final byte updateNsweBelow(int x, int y, short z, byte nswe)
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
{
// calculate virtual layer height
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
@ -306,7 +306,7 @@ public final class GeoDataConverter
return nswe;
}
private static final byte getNsweBelow(int geoX, int geoY, short worldZ)
private static byte getNsweBelow(int geoX, int geoY, short worldZ)
{
// out of geo coordinates
if ((geoX < 0) || (geoX >= GeoStructure.REGION_CELLS_X))
@ -333,7 +333,7 @@ public final class GeoDataConverter
* @param filename : The name of file to save.
* @return boolean : True when successful.
*/
private static final boolean saveGeoBlocks(String filename)
private static boolean saveGeoBlocks(String filename)
{
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(Config.GEODATA_PATH + filename), GeoStructure.REGION_BLOCKS * GeoStructure.BLOCK_CELLS * 3))
{
@ -357,7 +357,7 @@ public final class GeoDataConverter
}
}
private static final void loadGeoengineConfigs()
private static void loadGeoengineConfigs()
{
final PropertiesParser geoData = new PropertiesParser(Config.GEODATA_FILE);
Config.GEODATA_PATH = geoData.getString("GeoDataPath", "./data/geodata/");

View File

@ -48,7 +48,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
private static final int[] NORMAL_MOBS = {22931, 22932, 22933, 22934, 22935, 22936, 22937, 22938, 23349};
//@formatter:on
static Map<L2ZoneType, zoneInfo> _roomInfo = new HashMap<>(24);
final static Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
static final Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
public HarnakUndergroundRuinsZone()
{

View File

@ -43,16 +43,16 @@ public class NornilsGarden extends AbstractInstance
private static final int BOZ_CORE = 33781;
private static final int SPICULA_ZERO = 25901;
// Monsters
private final static int BOZ_STAGE1 = 19298;
private final static int BOZ_STAGE2 = 19305;
private final static int BOZ_STAGE3 = 19403;
private final static int BOZ_STAGE4 = BOZ_STAGE2;
private final static int SPICULA_ELITE_CAPTAIN = 19299;
private final static int SPICULA_ELITE_LIEUTNANT = 19300;
private final static int ELITE_SOLDIER_CLONE_1 = 19301;
private final static int SPICULA_ELITE_GUARD_1 = 19302;
private final static int ELITE_SOLDIER_CLONE_2 = 19303;
private final static int SPICULA_ELITE_GUARD_2 = 19304;
private static final int BOZ_STAGE1 = 19298;
private static final int BOZ_STAGE2 = 19305;
private static final int BOZ_STAGE3 = 19403;
private static final int BOZ_STAGE4 = BOZ_STAGE2;
private static final int SPICULA_ELITE_CAPTAIN = 19299;
private static final int SPICULA_ELITE_LIEUTNANT = 19300;
private static final int ELITE_SOLDIER_CLONE_1 = 19301;
private static final int SPICULA_ELITE_GUARD_1 = 19302;
private static final int ELITE_SOLDIER_CLONE_2 = 19303;
private static final int SPICULA_ELITE_GUARD_2 = 19304;
private static final int[] ATTACABLE_MONSTERS =
{
SPICULA_ELITE_CAPTAIN,
@ -70,11 +70,11 @@ public class NornilsGarden extends AbstractInstance
private static final SkillHolder DARK_BUSTER = new SkillHolder(15237, 1);
private static final SkillHolder DARK_BREATH = new SkillHolder(15238, 1);
// Chance
private final static int CHANCE_DARK_SPHERES = 15;
private final static int CHANCE_DARK_WIND = 30;
private final static int CHANCE_DARK_THRUST = 15;
private final static int CHANCE_DARK_BUSTER = 15;
private final static int CHANCE_DARK_BREATH = 30;
private static final int CHANCE_DARK_SPHERES = 15;
private static final int CHANCE_DARK_WIND = 30;
private static final int CHANCE_DARK_THRUST = 15;
private static final int CHANCE_DARK_BUSTER = 15;
private static final int CHANCE_DARK_BREATH = 30;
// Misc
private static final int TEMPLATE_ID = 231;

View File

@ -41,12 +41,12 @@ public class Q00245_ComeToMe extends Quest
// NPC
private static final int FERRIS = 30847;
// Monsters
private final static int[] BLAZING_MOBS_1 = new int[]
private static final int[] BLAZING_MOBS_1 = new int[]
{
21110, // Swamp Predator
21111 // Lava Wyrm
};
private final static int[] BLAZING_MOBS_2 = new int[]
private static final int[] BLAZING_MOBS_2 = new int[]
{
21112, // Hames Orc Foot Soldier
21113, // Hames Orc Sniper
@ -54,12 +54,12 @@ public class Q00245_ComeToMe extends Quest
21116 // Hames Orc Prefect
};
// Items
private final static int FLAME_ASHES = 30322;
private final static int CRYSTALS_OF_EXPERIENCE = 30323;
private final static int CRYSTAL_A = 1461;
private final static int MENTOR_RING = 30383;
private final static int ACADEMY_DYE_STR = 47205;
private final static int ACADEMY_DYE_WIT = 47210;
private static final int FLAME_ASHES = 30322;
private static final int CRYSTALS_OF_EXPERIENCE = 30323;
private static final int CRYSTAL_A = 1461;
private static final int MENTOR_RING = 30383;
private static final int ACADEMY_DYE_STR = 47205;
private static final int ACADEMY_DYE_WIT = 47210;
// Misc
private static final int MIN_LEVEL = 70;
private static final int MAX_LEVEL = 75;
@ -152,25 +152,22 @@ public class Q00245_ComeToMe extends Quest
{
htmltext = "30847-06.html";
}
else
else if (player.isMentee())
{
if (player.isMentee())
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-08.html";
}
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-09.html";
htmltext = "30847-08.html";
}
}
else
{
htmltext = "30847-09.html";
}
break;
}
case 3:

View File

@ -151,12 +151,9 @@ public class Q00483_IntendedTactic extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "33357-03.html";
}
htmltext = "33357-03.html";
}
return htmltext;
}

View File

@ -201,12 +201,9 @@ public class Q00775_RetrievingTheChaosFragment extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "31595-08.html";
}
htmltext = "31595-08.html";
}
return htmltext;
}

View File

@ -164,13 +164,10 @@ public class Q10447_TimingIsEverything extends Quest
showOnScreenMsg(qs.getPlayer(), NpcStringId.YOU_TOOK_DOWN_THE_NERVA_ORCS_AND_GOT_THEIR_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
qs.setCond(2, true);
}
else
else if (getRandom(100) < 0.03)
{
if (getRandom(100) < 0.03)
{
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
return super.onKill(npc, killer, isSummon);
}

View File

@ -126,48 +126,45 @@ public final class Q10771_VolatilePower extends Quest
break;
}
}
else
else if (qs.isStarted())
{
if (qs.isStarted())
if (qs.isCond(1))
{
if (qs.isCond(1))
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
reduceCount = itemCount;
}
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
reduceCount = itemCount;
}
else
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
htmltext = "33990-02.html";
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
}
else
{
htmltext = "33990-01.html";
htmltext = "33990-02.html";
}
}
else
{
htmltext = "33990-01.html";
}
return htmltext;
}

View File

@ -54,7 +54,7 @@ public class IPSubnet
_mask = getMask(mask, _addr.length);
if (!applyMask(_addr))
{
throw new UnknownHostException(addr.toString() + "/" + mask);
throw new UnknownHostException(addr + "/" + mask);
}
}
@ -117,7 +117,7 @@ public class IPSubnet
try
{
return InetAddress.getByAddress(_addr).toString() + "/" + size;
return InetAddress.getByAddress(_addr) + "/" + size;
}
catch (UnknownHostException e)
{
@ -144,7 +144,7 @@ public class IPSubnet
return false;
}
private static final byte[] getMask(int n, int maxLength) throws UnknownHostException
private static byte[] getMask(int n, int maxLength) throws UnknownHostException
{
if ((n > (maxLength << 3)) || (n < 0))
{

View File

@ -61,7 +61,7 @@ public class GeoEngine
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static final GeoEngine getInstance()
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
@ -226,7 +226,7 @@ public class GeoEngine
* @param worldX
* @return int : Geo X
*/
public static final int getGeoX(int worldX)
public static int getGeoX(int worldX)
{
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
}
@ -236,7 +236,7 @@ public class GeoEngine
* @param worldY
* @return int : Geo Y
*/
public static final int getGeoY(int worldY)
public static int getGeoY(int worldY)
{
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
}
@ -246,7 +246,7 @@ public class GeoEngine
* @param geoX
* @return int : World X
*/
public static final int getWorldX(int geoX)
public static int getWorldX(int geoX)
{
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
}
@ -256,7 +256,7 @@ public class GeoEngine
* @param geoY
* @return int : World Y
*/
public static final int getWorldY(int geoY)
public static int getWorldY(int geoY)
{
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
}
@ -364,7 +364,7 @@ public class GeoEngine
* @param inside : 2D description of {@link IGeoObject}
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
*/
public static final byte[][] calculateGeoObject(boolean inside[][])
public static byte[][] calculateGeoObject(boolean inside[][])
{
// get dimensions
final int width = inside.length;
@ -1260,7 +1260,7 @@ public class GeoEngine
* @param dirY : Y direction NSWE flag
* @return byte : NSWE flag of combined direction
*/
private static final byte getDirXY(byte dirX, byte dirY)
private static byte getDirXY(byte dirX, byte dirY)
{
// check axis directions
if (dirY == GeoStructure.CELL_FLAG_N)

View File

@ -171,7 +171,7 @@ final class GeoEnginePathfinding extends GeoEngine
* @param target : the entry point
* @return List<NodeLoc> : list of node location
*/
private static final List<Location> constructPath(Node target)
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();

View File

@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
/**
* Initializes the temporarily buffer.
*/
public static final void initialize()
public static void initialize()
{
// initialize temporarily buffer and sorting mechanism
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
/**
* Releases temporarily buffer.
*/
public static final void release()
public static void release()
{
_temp = null;
}

View File

@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -25,11 +25,11 @@ public interface IBlockDynamic
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be added.
*/
public void addGeoObject(IGeoObject object);
void addGeoObject(IGeoObject object);
/**
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be removed.
*/
public void removeGeoObject(IGeoObject object);
void removeGeoObject(IGeoObject object);
}

View File

@ -25,29 +25,29 @@ public interface IGeoObject
* Returns geodata X coordinate of the {@link IGeoObject}.
* @return int : Geodata X coordinate.
*/
public int getGeoX();
int getGeoX();
/**
* Returns geodata Y coordinate of the {@link IGeoObject}.
* @return int : Geodata Y coordinate.
*/
public int getGeoY();
int getGeoY();
/**
* Returns geodata Z coordinate of the {@link IGeoObject}.
* @return int : Geodata Z coordinate.
*/
public int getGeoZ();
int getGeoZ();
/**
* Returns height of the {@link IGeoObject}.
* @return int : Height.
*/
public int getHeight();
int getHeight();
/**
* Returns {@link IGeoObject} data.
* @return byte[][] : {@link IGeoObject} data.
*/
public byte[][] getObjectGeoData();
byte[][] getObjectGeoData();
}

View File

@ -44,12 +44,12 @@ import com.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState;
*/
public class PremiumManager
{
private final static Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
// SQL Statement
private final static String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private final static String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private final static String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private static final String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private static final String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
class PremiumExpireTask implements Runnable
{

View File

@ -58,7 +58,7 @@ public class PcStat extends PlayableStat
public static final int MAX_VITALITY_POINTS = 140000;
public static final int MIN_VITALITY_POINTS = 0;
private final static int FANCY_FISHING_ROD_SKILL = 21484;
private static final int FANCY_FISHING_ROD_SKILL = 21484;
public PcStat(L2PcInstance activeChar)
{

View File

@ -242,29 +242,26 @@ public class PlayerVariables extends AbstractVariables
final String data = getString(EXTEND_DROP, "");
if (data.isEmpty())
{
result = Integer.toString(id) + "," + Long.toString(count);
result = id + "," + count;
}
else if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + count;
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + Long.toString(count);
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
result = Integer.toString(id) + "," + Long.toString(count);
}
result = id + "," + count;
}
set(EXTEND_DROP, result);
}

View File

@ -31,18 +31,18 @@ public interface SchedulerListener
* This one is called by the scheduler when a task execution is starting.
* @param executor The task executor.
*/
public void taskLaunching(TaskExecutor executor);
void taskLaunching(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has been successfully completed.
* @param executor The task executor.
*/
public void taskSucceeded(TaskExecutor executor);
void taskSucceeded(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has failed.
* @param executor The task executor.
* @param exception The exception representing the failure notification.
*/
public void taskFailed(TaskExecutor executor, Throwable exception);
void taskFailed(TaskExecutor executor, Throwable exception);
}

View File

@ -519,19 +519,19 @@ public class SchedulingPattern
* @return The parsed value.
* @throws Exception If the value can't be parsed.
*/
public int parse(String value) throws Exception;
int parse(String value) throws Exception;
/**
* Returns the minimum value accepred by the parser.
* @return The minimum value accepred by the parser.
*/
public int getMinValue();
int getMinValue();
/**
* Returns the maximum value accepred by the parser.
* @return The maximum value accepred by the parser.
*/
public int getMaxValue();
int getMaxValue();
}
/**

View File

@ -33,5 +33,5 @@ public interface TaskCollector
* returned table elements, executing any task whose scheduling pattern is matching the current system time.
* @return The task table that will be automatically injected in the scheduler.
*/
public TaskTable getTasks();
TaskTable getTasks();
}

View File

@ -32,36 +32,36 @@ public interface TaskExecutionContext
* Returns the scheduler.
* @return The scheduler.
*/
public Scheduler getScheduler();
Scheduler getScheduler();
/**
* Returns the task executor.
* @return The task executor.
*/
public TaskExecutor getTaskExecutor();
TaskExecutor getTaskExecutor();
/**
* Sets the current status tracking message, that has to be something about what the task is doing at the moment.
* @param message A message representing the current execution status. Null messages will be blanked.
*/
public void setStatusMessage(String message);
void setStatusMessage(String message);
/**
* Sets the completeness tracking value, that has to be between 0 and 1.
* @param completeness A completeness value, between 0 and 1. Values out of range will be ignored.
*/
public void setCompleteness(double completeness);
void setCompleteness(double completeness);
/**
* If the task execution has been paused, stops until the operation is resumed. It can also returns because of a stop operation without any previous resuming. Due to this the task developer should always check the {@link TaskExecutionContext#isStopped()} value after any
* <em>pauseIfRequested()</em> call. Note that a task execution can be paused only if the task {@link Task#canBePaused()} method returns <em>true</em>.
*/
public void pauseIfRequested();
void pauseIfRequested();
/**
* Checks whether the task execution has been demanded to be stopped. If the returned value is <em>true</em>, the task developer must shut down gracefully its task execution, as soon as possible. Note that a task execution can be stopped only if the task {@link Task#canBePaused()} method returns
* <em>true</em>.
* @return <em>true</em> if the current task execution has been demanded to be stopped; <em>false</em> otherwise.
*/
public boolean isStopped();
boolean isStopped();
}

View File

@ -30,38 +30,38 @@ public interface TaskExecutorListener
* Called when the execution has been requested to be paused.
* @param executor The source executor.
*/
public void executionPausing(TaskExecutor executor);
void executionPausing(TaskExecutor executor);
/**
* Called when the execution has been requested to be resumed.
* @param executor The source executor.
*/
public void executionResuming(TaskExecutor executor);
void executionResuming(TaskExecutor executor);
/**
* Called when the executor has been requested to be stopped.
* @param executor The source executor.
*/
public void executionStopping(TaskExecutor executor);
void executionStopping(TaskExecutor executor);
/**
* Called at execution end. If the execution has failed due to an error, the encountered exception is reported.
* @param executor The source executor.
* @param exception If the execution has been terminated due to an error, this is the encountered exception; otherwise the parameter is null.
*/
public void executionTerminated(TaskExecutor executor, Throwable exception);
void executionTerminated(TaskExecutor executor, Throwable exception);
/**
* Called every time the execution status message changes.
* @param executor The source executor.
* @param statusMessage The new status message.
*/
public void statusMessageChanged(TaskExecutor executor, String statusMessage);
void statusMessageChanged(TaskExecutor executor, String statusMessage);
/**
* Called every time the execution completeness value changes.
* @param executor The source executor.
* @param completenessValue The new completeness value.
*/
public void completenessValueChanged(TaskExecutor executor, double completenessValue);
void completenessValueChanged(TaskExecutor executor, double completenessValue);
}

View File

@ -31,5 +31,5 @@ interface ValueMatcher
* @param value The value.
* @return true if the given value matches the rules of the ValueMatcher, false otherwise.
*/
public boolean match(int value);
boolean match(int value);
}

View File

@ -165,7 +165,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}
@ -179,7 +179,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}

View File

@ -228,7 +228,7 @@ public class Tokenizer
while (symbol.length() > 0)
{
Operator op = this.getOperator(symbol.toString());
Operator op = getOperator(symbol.toString());
if (op == null)
{
symbol.setLength(symbol.length() - 1);

View File

@ -49,7 +49,7 @@ public class IPv4Filter implements IAcceptFilter, Runnable
* @param ip
* @return
*/
private static final int hash(byte[] ip)
private static int hash(byte[] ip)
{
return (ip[0] & 0xFF) | ((ip[1] << 8) & 0xFF00) | ((ip[2] << 16) & 0xFF0000) | ((ip[3] << 24) & 0xFF000000);
}

View File

@ -70,7 +70,7 @@ public final class GeoDataConverter
_format = type.equalsIgnoreCase("J") ? GeoFormat.L2J : GeoFormat.L2OFF;
// start conversion
System.out.println("GeoDataConverter: Converting all " + _format.toString() + " files.");
System.out.println("GeoDataConverter: Converting all " + _format + " files.");
// initialize geodata container
_blocks = new ABlock[GeoStructure.REGION_BLOCKS_X][GeoStructure.REGION_BLOCKS_Y];
@ -116,7 +116,7 @@ public final class GeoDataConverter
}
}
}
System.out.println("GeoDataConverter: Converted " + converted + " " + _format.toString() + " to L2D region file(s).");
System.out.println("GeoDataConverter: Converted " + converted + " " + _format + " to L2D region file(s).");
// release multilayer block temporarily buffer
BlockMultilayer.release();
@ -127,7 +127,7 @@ public final class GeoDataConverter
* @param filename : The name of the to load.
* @return boolean : True when successful.
*/
private static final boolean loadGeoBlocks(String filename)
private static boolean loadGeoBlocks(String filename)
{
// region file is load-able, try to load it
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
@ -217,7 +217,7 @@ public final class GeoDataConverter
* Recalculate diagonal flags for the region file.
* @return boolean : True when successful.
*/
private static final boolean recalculateNswe()
private static boolean recalculateNswe()
{
try
{
@ -268,7 +268,7 @@ public final class GeoDataConverter
* @param nswe : NSWE flag to be updated.
* @return byte : Updated NSWE flag.
*/
private static final byte updateNsweBelow(int x, int y, short z, byte nswe)
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
{
// calculate virtual layer height
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
@ -306,7 +306,7 @@ public final class GeoDataConverter
return nswe;
}
private static final byte getNsweBelow(int geoX, int geoY, short worldZ)
private static byte getNsweBelow(int geoX, int geoY, short worldZ)
{
// out of geo coordinates
if ((geoX < 0) || (geoX >= GeoStructure.REGION_CELLS_X))
@ -333,7 +333,7 @@ public final class GeoDataConverter
* @param filename : The name of file to save.
* @return boolean : True when successful.
*/
private static final boolean saveGeoBlocks(String filename)
private static boolean saveGeoBlocks(String filename)
{
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(Config.GEODATA_PATH + filename), GeoStructure.REGION_BLOCKS * GeoStructure.BLOCK_CELLS * 3))
{
@ -357,7 +357,7 @@ public final class GeoDataConverter
}
}
private static final void loadGeoengineConfigs()
private static void loadGeoengineConfigs()
{
final PropertiesParser geoData = new PropertiesParser(Config.GEODATA_FILE);
Config.GEODATA_PATH = geoData.getString("GeoDataPath", "./data/geodata/");

View File

@ -48,7 +48,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
private static final int[] NORMAL_MOBS = {22931, 22932, 22933, 22934, 22935, 22936, 22937, 22938, 23349};
//@formatter:on
static Map<L2ZoneType, zoneInfo> _roomInfo = new HashMap<>(24);
final static Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
static final Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
public HarnakUndergroundRuinsZone()
{

View File

@ -43,16 +43,16 @@ public class NornilsGarden extends AbstractInstance
private static final int BOZ_CORE = 33781;
private static final int SPICULA_ZERO = 25901;
// Monsters
private final static int BOZ_STAGE1 = 19298;
private final static int BOZ_STAGE2 = 19305;
private final static int BOZ_STAGE3 = 19403;
private final static int BOZ_STAGE4 = BOZ_STAGE2;
private final static int SPICULA_ELITE_CAPTAIN = 19299;
private final static int SPICULA_ELITE_LIEUTNANT = 19300;
private final static int ELITE_SOLDIER_CLONE_1 = 19301;
private final static int SPICULA_ELITE_GUARD_1 = 19302;
private final static int ELITE_SOLDIER_CLONE_2 = 19303;
private final static int SPICULA_ELITE_GUARD_2 = 19304;
private static final int BOZ_STAGE1 = 19298;
private static final int BOZ_STAGE2 = 19305;
private static final int BOZ_STAGE3 = 19403;
private static final int BOZ_STAGE4 = BOZ_STAGE2;
private static final int SPICULA_ELITE_CAPTAIN = 19299;
private static final int SPICULA_ELITE_LIEUTNANT = 19300;
private static final int ELITE_SOLDIER_CLONE_1 = 19301;
private static final int SPICULA_ELITE_GUARD_1 = 19302;
private static final int ELITE_SOLDIER_CLONE_2 = 19303;
private static final int SPICULA_ELITE_GUARD_2 = 19304;
private static final int[] ATTACABLE_MONSTERS =
{
SPICULA_ELITE_CAPTAIN,
@ -70,11 +70,11 @@ public class NornilsGarden extends AbstractInstance
private static final SkillHolder DARK_BUSTER = new SkillHolder(15237, 1);
private static final SkillHolder DARK_BREATH = new SkillHolder(15238, 1);
// Chance
private final static int CHANCE_DARK_SPHERES = 15;
private final static int CHANCE_DARK_WIND = 30;
private final static int CHANCE_DARK_THRUST = 15;
private final static int CHANCE_DARK_BUSTER = 15;
private final static int CHANCE_DARK_BREATH = 30;
private static final int CHANCE_DARK_SPHERES = 15;
private static final int CHANCE_DARK_WIND = 30;
private static final int CHANCE_DARK_THRUST = 15;
private static final int CHANCE_DARK_BUSTER = 15;
private static final int CHANCE_DARK_BREATH = 30;
// Misc
private static final int TEMPLATE_ID = 231;

View File

@ -41,12 +41,12 @@ public class Q00245_ComeToMe extends Quest
// NPC
private static final int FERRIS = 30847;
// Monsters
private final static int[] BLAZING_MOBS_1 = new int[]
private static final int[] BLAZING_MOBS_1 = new int[]
{
21110, // Swamp Predator
21111 // Lava Wyrm
};
private final static int[] BLAZING_MOBS_2 = new int[]
private static final int[] BLAZING_MOBS_2 = new int[]
{
21112, // Hames Orc Foot Soldier
21113, // Hames Orc Sniper
@ -54,12 +54,12 @@ public class Q00245_ComeToMe extends Quest
21116 // Hames Orc Prefect
};
// Items
private final static int FLAME_ASHES = 30322;
private final static int CRYSTALS_OF_EXPERIENCE = 30323;
private final static int CRYSTAL_A = 1461;
private final static int MENTOR_RING = 30383;
private final static int ACADEMY_DYE_STR = 47205;
private final static int ACADEMY_DYE_WIT = 47210;
private static final int FLAME_ASHES = 30322;
private static final int CRYSTALS_OF_EXPERIENCE = 30323;
private static final int CRYSTAL_A = 1461;
private static final int MENTOR_RING = 30383;
private static final int ACADEMY_DYE_STR = 47205;
private static final int ACADEMY_DYE_WIT = 47210;
// Misc
private static final int MIN_LEVEL = 70;
private static final int MAX_LEVEL = 75;
@ -152,25 +152,22 @@ public class Q00245_ComeToMe extends Quest
{
htmltext = "30847-06.html";
}
else
else if (player.isMentee())
{
if (player.isMentee())
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-08.html";
}
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-09.html";
htmltext = "30847-08.html";
}
}
else
{
htmltext = "30847-09.html";
}
break;
}
case 3:

View File

@ -151,12 +151,9 @@ public class Q00483_IntendedTactic extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "33357-03.html";
}
htmltext = "33357-03.html";
}
return htmltext;
}

View File

@ -201,12 +201,9 @@ public class Q00775_RetrievingTheChaosFragment extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "31595-08.html";
}
htmltext = "31595-08.html";
}
return htmltext;
}

View File

@ -164,13 +164,10 @@ public class Q10447_TimingIsEverything extends Quest
showOnScreenMsg(qs.getPlayer(), NpcStringId.YOU_TOOK_DOWN_THE_NERVA_ORCS_AND_GOT_THEIR_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
qs.setCond(2, true);
}
else
else if (getRandom(100) < 0.03)
{
if (getRandom(100) < 0.03)
{
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
return super.onKill(npc, killer, isSummon);
}

View File

@ -126,48 +126,45 @@ public final class Q10771_VolatilePower extends Quest
break;
}
}
else
else if (qs.isStarted())
{
if (qs.isStarted())
if (qs.isCond(1))
{
if (qs.isCond(1))
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
reduceCount = itemCount;
}
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
reduceCount = itemCount;
}
else
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
htmltext = "33990-02.html";
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
}
else
{
htmltext = "33990-01.html";
htmltext = "33990-02.html";
}
}
else
{
htmltext = "33990-01.html";
}
return htmltext;
}

View File

@ -54,7 +54,7 @@ public class IPSubnet
_mask = getMask(mask, _addr.length);
if (!applyMask(_addr))
{
throw new UnknownHostException(addr.toString() + "/" + mask);
throw new UnknownHostException(addr + "/" + mask);
}
}
@ -117,7 +117,7 @@ public class IPSubnet
try
{
return InetAddress.getByAddress(_addr).toString() + "/" + size;
return InetAddress.getByAddress(_addr) + "/" + size;
}
catch (UnknownHostException e)
{
@ -144,7 +144,7 @@ public class IPSubnet
return false;
}
private static final byte[] getMask(int n, int maxLength) throws UnknownHostException
private static byte[] getMask(int n, int maxLength) throws UnknownHostException
{
if ((n > (maxLength << 3)) || (n < 0))
{

View File

@ -61,7 +61,7 @@ public class GeoEngine
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static final GeoEngine getInstance()
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
@ -226,7 +226,7 @@ public class GeoEngine
* @param worldX
* @return int : Geo X
*/
public static final int getGeoX(int worldX)
public static int getGeoX(int worldX)
{
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
}
@ -236,7 +236,7 @@ public class GeoEngine
* @param worldY
* @return int : Geo Y
*/
public static final int getGeoY(int worldY)
public static int getGeoY(int worldY)
{
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
}
@ -246,7 +246,7 @@ public class GeoEngine
* @param geoX
* @return int : World X
*/
public static final int getWorldX(int geoX)
public static int getWorldX(int geoX)
{
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
}
@ -256,7 +256,7 @@ public class GeoEngine
* @param geoY
* @return int : World Y
*/
public static final int getWorldY(int geoY)
public static int getWorldY(int geoY)
{
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
}
@ -364,7 +364,7 @@ public class GeoEngine
* @param inside : 2D description of {@link IGeoObject}
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
*/
public static final byte[][] calculateGeoObject(boolean inside[][])
public static byte[][] calculateGeoObject(boolean inside[][])
{
// get dimensions
final int width = inside.length;
@ -1260,7 +1260,7 @@ public class GeoEngine
* @param dirY : Y direction NSWE flag
* @return byte : NSWE flag of combined direction
*/
private static final byte getDirXY(byte dirX, byte dirY)
private static byte getDirXY(byte dirX, byte dirY)
{
// check axis directions
if (dirY == GeoStructure.CELL_FLAG_N)

View File

@ -171,7 +171,7 @@ final class GeoEnginePathfinding extends GeoEngine
* @param target : the entry point
* @return List<NodeLoc> : list of node location
*/
private static final List<Location> constructPath(Node target)
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();

View File

@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
/**
* Initializes the temporarily buffer.
*/
public static final void initialize()
public static void initialize()
{
// initialize temporarily buffer and sorting mechanism
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
/**
* Releases temporarily buffer.
*/
public static final void release()
public static void release()
{
_temp = null;
}

View File

@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -25,11 +25,11 @@ public interface IBlockDynamic
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be added.
*/
public void addGeoObject(IGeoObject object);
void addGeoObject(IGeoObject object);
/**
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be removed.
*/
public void removeGeoObject(IGeoObject object);
void removeGeoObject(IGeoObject object);
}

View File

@ -25,29 +25,29 @@ public interface IGeoObject
* Returns geodata X coordinate of the {@link IGeoObject}.
* @return int : Geodata X coordinate.
*/
public int getGeoX();
int getGeoX();
/**
* Returns geodata Y coordinate of the {@link IGeoObject}.
* @return int : Geodata Y coordinate.
*/
public int getGeoY();
int getGeoY();
/**
* Returns geodata Z coordinate of the {@link IGeoObject}.
* @return int : Geodata Z coordinate.
*/
public int getGeoZ();
int getGeoZ();
/**
* Returns height of the {@link IGeoObject}.
* @return int : Height.
*/
public int getHeight();
int getHeight();
/**
* Returns {@link IGeoObject} data.
* @return byte[][] : {@link IGeoObject} data.
*/
public byte[][] getObjectGeoData();
byte[][] getObjectGeoData();
}

View File

@ -44,12 +44,12 @@ import com.l2jmobius.gameserver.network.serverpackets.ExBrPremiumState;
*/
public class PremiumManager
{
private final static Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
// SQL Statement
private final static String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private final static String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private final static String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private static final String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private static final String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
class PremiumExpireTask implements Runnable
{

View File

@ -59,7 +59,7 @@ public class PcStat extends PlayableStat
public static final int MAX_VITALITY_POINTS = 140000;
public static final int MIN_VITALITY_POINTS = 0;
private final static int FANCY_FISHING_ROD_SKILL = 21484;
private static final int FANCY_FISHING_ROD_SKILL = 21484;
public PcStat(L2PcInstance activeChar)
{

View File

@ -242,29 +242,26 @@ public class PlayerVariables extends AbstractVariables
final String data = getString(EXTEND_DROP, "");
if (data.isEmpty())
{
result = Integer.toString(id) + "," + Long.toString(count);
result = id + "," + count;
}
else if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + count;
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
if (data.contains(";"))
{
for (String s : data.split(";"))
{
final String[] drop = s.split(",");
if (drop[0].equals(Integer.toString(id)))
{
s += ";" + drop[0] + "," + Long.toString(count);
continue;
}
result += ";" + s;
}
result = result.substring(1);
}
else
{
result = Integer.toString(id) + "," + Long.toString(count);
}
result = id + "," + count;
}
set(EXTEND_DROP, result);
}

View File

@ -31,18 +31,18 @@ public interface SchedulerListener
* This one is called by the scheduler when a task execution is starting.
* @param executor The task executor.
*/
public void taskLaunching(TaskExecutor executor);
void taskLaunching(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has been successfully completed.
* @param executor The task executor.
*/
public void taskSucceeded(TaskExecutor executor);
void taskSucceeded(TaskExecutor executor);
/**
* This one is called by the scheduler to notify that a task execution has failed.
* @param executor The task executor.
* @param exception The exception representing the failure notification.
*/
public void taskFailed(TaskExecutor executor, Throwable exception);
void taskFailed(TaskExecutor executor, Throwable exception);
}

View File

@ -519,19 +519,19 @@ public class SchedulingPattern
* @return The parsed value.
* @throws Exception If the value can't be parsed.
*/
public int parse(String value) throws Exception;
int parse(String value) throws Exception;
/**
* Returns the minimum value accepred by the parser.
* @return The minimum value accepred by the parser.
*/
public int getMinValue();
int getMinValue();
/**
* Returns the maximum value accepred by the parser.
* @return The maximum value accepred by the parser.
*/
public int getMaxValue();
int getMaxValue();
}
/**

View File

@ -33,5 +33,5 @@ public interface TaskCollector
* returned table elements, executing any task whose scheduling pattern is matching the current system time.
* @return The task table that will be automatically injected in the scheduler.
*/
public TaskTable getTasks();
TaskTable getTasks();
}

View File

@ -32,36 +32,36 @@ public interface TaskExecutionContext
* Returns the scheduler.
* @return The scheduler.
*/
public Scheduler getScheduler();
Scheduler getScheduler();
/**
* Returns the task executor.
* @return The task executor.
*/
public TaskExecutor getTaskExecutor();
TaskExecutor getTaskExecutor();
/**
* Sets the current status tracking message, that has to be something about what the task is doing at the moment.
* @param message A message representing the current execution status. Null messages will be blanked.
*/
public void setStatusMessage(String message);
void setStatusMessage(String message);
/**
* Sets the completeness tracking value, that has to be between 0 and 1.
* @param completeness A completeness value, between 0 and 1. Values out of range will be ignored.
*/
public void setCompleteness(double completeness);
void setCompleteness(double completeness);
/**
* If the task execution has been paused, stops until the operation is resumed. It can also returns because of a stop operation without any previous resuming. Due to this the task developer should always check the {@link TaskExecutionContext#isStopped()} value after any
* <em>pauseIfRequested()</em> call. Note that a task execution can be paused only if the task {@link Task#canBePaused()} method returns <em>true</em>.
*/
public void pauseIfRequested();
void pauseIfRequested();
/**
* Checks whether the task execution has been demanded to be stopped. If the returned value is <em>true</em>, the task developer must shut down gracefully its task execution, as soon as possible. Note that a task execution can be stopped only if the task {@link Task#canBePaused()} method returns
* <em>true</em>.
* @return <em>true</em> if the current task execution has been demanded to be stopped; <em>false</em> otherwise.
*/
public boolean isStopped();
boolean isStopped();
}

View File

@ -30,38 +30,38 @@ public interface TaskExecutorListener
* Called when the execution has been requested to be paused.
* @param executor The source executor.
*/
public void executionPausing(TaskExecutor executor);
void executionPausing(TaskExecutor executor);
/**
* Called when the execution has been requested to be resumed.
* @param executor The source executor.
*/
public void executionResuming(TaskExecutor executor);
void executionResuming(TaskExecutor executor);
/**
* Called when the executor has been requested to be stopped.
* @param executor The source executor.
*/
public void executionStopping(TaskExecutor executor);
void executionStopping(TaskExecutor executor);
/**
* Called at execution end. If the execution has failed due to an error, the encountered exception is reported.
* @param executor The source executor.
* @param exception If the execution has been terminated due to an error, this is the encountered exception; otherwise the parameter is null.
*/
public void executionTerminated(TaskExecutor executor, Throwable exception);
void executionTerminated(TaskExecutor executor, Throwable exception);
/**
* Called every time the execution status message changes.
* @param executor The source executor.
* @param statusMessage The new status message.
*/
public void statusMessageChanged(TaskExecutor executor, String statusMessage);
void statusMessageChanged(TaskExecutor executor, String statusMessage);
/**
* Called every time the execution completeness value changes.
* @param executor The source executor.
* @param completenessValue The new completeness value.
*/
public void completenessValueChanged(TaskExecutor executor, double completenessValue);
void completenessValueChanged(TaskExecutor executor, double completenessValue);
}

View File

@ -31,5 +31,5 @@ interface ValueMatcher
* @param value The value.
* @return true if the given value matches the rules of the ValueMatcher, false otherwise.
*/
public boolean match(int value);
boolean match(int value);
}

View File

@ -165,7 +165,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}
@ -179,7 +179,7 @@ public class ExpressionBuilder
{
for (Operator o : operators)
{
this.operator(o);
operator(o);
}
return this;
}

View File

@ -228,7 +228,7 @@ public class Tokenizer
while (symbol.length() > 0)
{
Operator op = this.getOperator(symbol.toString());
Operator op = getOperator(symbol.toString());
if (op == null)
{
symbol.setLength(symbol.length() - 1);

View File

@ -49,7 +49,7 @@ public class IPv4Filter implements IAcceptFilter, Runnable
* @param ip
* @return
*/
private static final int hash(byte[] ip)
private static int hash(byte[] ip)
{
return (ip[0] & 0xFF) | ((ip[1] << 8) & 0xFF00) | ((ip[2] << 16) & 0xFF0000) | ((ip[3] << 24) & 0xFF000000);
}

View File

@ -70,7 +70,7 @@ public final class GeoDataConverter
_format = type.equalsIgnoreCase("J") ? GeoFormat.L2J : GeoFormat.L2OFF;
// start conversion
System.out.println("GeoDataConverter: Converting all " + _format.toString() + " files.");
System.out.println("GeoDataConverter: Converting all " + _format + " files.");
// initialize geodata container
_blocks = new ABlock[GeoStructure.REGION_BLOCKS_X][GeoStructure.REGION_BLOCKS_Y];
@ -116,7 +116,7 @@ public final class GeoDataConverter
}
}
}
System.out.println("GeoDataConverter: Converted " + converted + " " + _format.toString() + " to L2D region file(s).");
System.out.println("GeoDataConverter: Converted " + converted + " " + _format + " to L2D region file(s).");
// release multilayer block temporarily buffer
BlockMultilayer.release();
@ -127,7 +127,7 @@ public final class GeoDataConverter
* @param filename : The name of the to load.
* @return boolean : True when successful.
*/
private static final boolean loadGeoBlocks(String filename)
private static boolean loadGeoBlocks(String filename)
{
// region file is load-able, try to load it
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
@ -217,7 +217,7 @@ public final class GeoDataConverter
* Recalculate diagonal flags for the region file.
* @return boolean : True when successful.
*/
private static final boolean recalculateNswe()
private static boolean recalculateNswe()
{
try
{
@ -268,7 +268,7 @@ public final class GeoDataConverter
* @param nswe : NSWE flag to be updated.
* @return byte : Updated NSWE flag.
*/
private static final byte updateNsweBelow(int x, int y, short z, byte nswe)
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
{
// calculate virtual layer height
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
@ -306,7 +306,7 @@ public final class GeoDataConverter
return nswe;
}
private static final byte getNsweBelow(int geoX, int geoY, short worldZ)
private static byte getNsweBelow(int geoX, int geoY, short worldZ)
{
// out of geo coordinates
if ((geoX < 0) || (geoX >= GeoStructure.REGION_CELLS_X))
@ -333,7 +333,7 @@ public final class GeoDataConverter
* @param filename : The name of file to save.
* @return boolean : True when successful.
*/
private static final boolean saveGeoBlocks(String filename)
private static boolean saveGeoBlocks(String filename)
{
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(Config.GEODATA_PATH + filename), GeoStructure.REGION_BLOCKS * GeoStructure.BLOCK_CELLS * 3))
{
@ -357,7 +357,7 @@ public final class GeoDataConverter
}
}
private static final void loadGeoengineConfigs()
private static void loadGeoengineConfigs()
{
final PropertiesParser geoData = new PropertiesParser(Config.GEODATA_FILE);
Config.GEODATA_PATH = geoData.getString("GeoDataPath", "./data/geodata/");

View File

@ -59,7 +59,7 @@ public class GeoEngine
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static final GeoEngine getInstance()
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
@ -224,7 +224,7 @@ public class GeoEngine
* @param worldX
* @return int : Geo X
*/
public static final int getGeoX(int worldX)
public static int getGeoX(int worldX)
{
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
}
@ -234,7 +234,7 @@ public class GeoEngine
* @param worldY
* @return int : Geo Y
*/
public static final int getGeoY(int worldY)
public static int getGeoY(int worldY)
{
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
}
@ -244,7 +244,7 @@ public class GeoEngine
* @param geoX
* @return int : World X
*/
public static final int getWorldX(int geoX)
public static int getWorldX(int geoX)
{
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
}
@ -254,7 +254,7 @@ public class GeoEngine
* @param geoY
* @return int : World Y
*/
public static final int getWorldY(int geoY)
public static int getWorldY(int geoY)
{
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
}
@ -362,7 +362,7 @@ public class GeoEngine
* @param inside : 2D description of {@link IGeoObject}
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
*/
public static final byte[][] calculateGeoObject(boolean inside[][])
public static byte[][] calculateGeoObject(boolean inside[][])
{
// get dimensions
final int width = inside.length;
@ -1243,7 +1243,7 @@ public class GeoEngine
* @param dirY : Y direction NSWE flag
* @return byte : NSWE flag of combined direction
*/
private static final byte getDirXY(byte dirX, byte dirY)
private static byte getDirXY(byte dirX, byte dirY)
{
// check axis directions
if (dirY == GeoStructure.CELL_FLAG_N)

View File

@ -170,7 +170,7 @@ final class GeoEnginePathfinding extends GeoEngine
* @param target : the entry point
* @return List<NodeLoc> : list of node location
*/
private static final List<Location> constructPath(Node target)
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();

View File

@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
/**
* Initializes the temporarily buffer.
*/
public static final void initialize()
public static void initialize()
{
// initialize temporarily buffer and sorting mechanism
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
/**
* Releases temporarily buffer.
*/
public static final void release()
public static void release()
{
_temp = null;
}

View File

@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -25,11 +25,11 @@ public interface IBlockDynamic
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be added.
*/
public void addGeoObject(IGeoObject object);
void addGeoObject(IGeoObject object);
/**
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be removed.
*/
public void removeGeoObject(IGeoObject object);
void removeGeoObject(IGeoObject object);
}

View File

@ -25,29 +25,29 @@ public interface IGeoObject
* Returns geodata X coordinate of the {@link IGeoObject}.
* @return int : Geodata X coordinate.
*/
public int getGeoX();
int getGeoX();
/**
* Returns geodata Y coordinate of the {@link IGeoObject}.
* @return int : Geodata Y coordinate.
*/
public int getGeoY();
int getGeoY();
/**
* Returns geodata Z coordinate of the {@link IGeoObject}.
* @return int : Geodata Z coordinate.
*/
public int getGeoZ();
int getGeoZ();
/**
* Returns height of the {@link IGeoObject}.
* @return int : Height.
*/
public int getHeight();
int getHeight();
/**
* Returns {@link IGeoObject} data.
* @return byte[][] : {@link IGeoObject} data.
*/
public byte[][] getObjectGeoData();
byte[][] getObjectGeoData();
}

View File

@ -43,12 +43,12 @@ import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
*/
public class PremiumManager
{
private final static Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
// SQL Statement
private final static String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private final static String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private final static String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
private static final String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
private static final String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
class PremiumExpireTask implements Runnable
{

View File

@ -70,7 +70,7 @@ public final class GeoDataConverter
_format = type.equalsIgnoreCase("J") ? GeoFormat.L2J : GeoFormat.L2OFF;
// start conversion
System.out.println("GeoDataConverter: Converting all " + _format.toString() + " files.");
System.out.println("GeoDataConverter: Converting all " + _format + " files.");
// initialize geodata container
_blocks = new ABlock[GeoStructure.REGION_BLOCKS_X][GeoStructure.REGION_BLOCKS_Y];
@ -116,7 +116,7 @@ public final class GeoDataConverter
}
}
}
System.out.println("GeoDataConverter: Converted " + converted + " " + _format.toString() + " to L2D region file(s).");
System.out.println("GeoDataConverter: Converted " + converted + " " + _format + " to L2D region file(s).");
// release multilayer block temporarily buffer
BlockMultilayer.release();
@ -127,7 +127,7 @@ public final class GeoDataConverter
* @param filename : The name of the to load.
* @return boolean : True when successful.
*/
private static final boolean loadGeoBlocks(String filename)
private static boolean loadGeoBlocks(String filename)
{
// region file is load-able, try to load it
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
@ -217,7 +217,7 @@ public final class GeoDataConverter
* Recalculate diagonal flags for the region file.
* @return boolean : True when successful.
*/
private static final boolean recalculateNswe()
private static boolean recalculateNswe()
{
try
{
@ -268,7 +268,7 @@ public final class GeoDataConverter
* @param nswe : NSWE flag to be updated.
* @return byte : Updated NSWE flag.
*/
private static final byte updateNsweBelow(int x, int y, short z, byte nswe)
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
{
// calculate virtual layer height
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
@ -306,7 +306,7 @@ public final class GeoDataConverter
return nswe;
}
private static final byte getNsweBelow(int geoX, int geoY, short worldZ)
private static byte getNsweBelow(int geoX, int geoY, short worldZ)
{
// out of geo coordinates
if ((geoX < 0) || (geoX >= GeoStructure.REGION_CELLS_X))
@ -333,7 +333,7 @@ public final class GeoDataConverter
* @param filename : The name of file to save.
* @return boolean : True when successful.
*/
private static final boolean saveGeoBlocks(String filename)
private static boolean saveGeoBlocks(String filename)
{
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(Config.GEODATA_PATH + filename), GeoStructure.REGION_BLOCKS * GeoStructure.BLOCK_CELLS * 3))
{
@ -357,7 +357,7 @@ public final class GeoDataConverter
}
}
private static final void loadGeoengineConfigs()
private static void loadGeoengineConfigs()
{
final PropertiesParser geoData = new PropertiesParser(Config.GEODATA_FILE);
Config.GEODATA_PATH = geoData.getString("GeoDataPath", "./data/geodata/");

View File

@ -48,7 +48,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
private static final int[] NORMAL_MOBS = {22931, 22932, 22933, 22934, 22935, 22936, 22937, 22938, 23349};
//@formatter:on
static Map<L2ZoneType, zoneInfo> _roomInfo = new HashMap<>(24);
final static Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
static final Set<SpawnTemplate> _templates = ConcurrentHashMap.newKeySet();
public HarnakUndergroundRuinsZone()
{

View File

@ -43,16 +43,16 @@ public class NornilsGarden extends AbstractInstance
private static final int BOZ_CORE = 33781;
private static final int SPICULA_ZERO = 25901;
// Monsters
private final static int BOZ_STAGE1 = 19298;
private final static int BOZ_STAGE2 = 19305;
private final static int BOZ_STAGE3 = 19403;
private final static int BOZ_STAGE4 = BOZ_STAGE2;
private final static int SPICULA_ELITE_CAPTAIN = 19299;
private final static int SPICULA_ELITE_LIEUTNANT = 19300;
private final static int ELITE_SOLDIER_CLONE_1 = 19301;
private final static int SPICULA_ELITE_GUARD_1 = 19302;
private final static int ELITE_SOLDIER_CLONE_2 = 19303;
private final static int SPICULA_ELITE_GUARD_2 = 19304;
private static final int BOZ_STAGE1 = 19298;
private static final int BOZ_STAGE2 = 19305;
private static final int BOZ_STAGE3 = 19403;
private static final int BOZ_STAGE4 = BOZ_STAGE2;
private static final int SPICULA_ELITE_CAPTAIN = 19299;
private static final int SPICULA_ELITE_LIEUTNANT = 19300;
private static final int ELITE_SOLDIER_CLONE_1 = 19301;
private static final int SPICULA_ELITE_GUARD_1 = 19302;
private static final int ELITE_SOLDIER_CLONE_2 = 19303;
private static final int SPICULA_ELITE_GUARD_2 = 19304;
private static final int[] ATTACABLE_MONSTERS =
{
SPICULA_ELITE_CAPTAIN,
@ -70,11 +70,11 @@ public class NornilsGarden extends AbstractInstance
private static final SkillHolder DARK_BUSTER = new SkillHolder(15237, 1);
private static final SkillHolder DARK_BREATH = new SkillHolder(15238, 1);
// Chance
private final static int CHANCE_DARK_SPHERES = 15;
private final static int CHANCE_DARK_WIND = 30;
private final static int CHANCE_DARK_THRUST = 15;
private final static int CHANCE_DARK_BUSTER = 15;
private final static int CHANCE_DARK_BREATH = 30;
private static final int CHANCE_DARK_SPHERES = 15;
private static final int CHANCE_DARK_WIND = 30;
private static final int CHANCE_DARK_THRUST = 15;
private static final int CHANCE_DARK_BUSTER = 15;
private static final int CHANCE_DARK_BREATH = 30;
// Misc
private static final int TEMPLATE_ID = 231;

View File

@ -41,12 +41,12 @@ public class Q00245_ComeToMe extends Quest
// NPC
private static final int FERRIS = 30847;
// Monsters
private final static int[] BLAZING_MOBS_1 = new int[]
private static final int[] BLAZING_MOBS_1 = new int[]
{
21110, // Swamp Predator
21111 // Lava Wyrm
};
private final static int[] BLAZING_MOBS_2 = new int[]
private static final int[] BLAZING_MOBS_2 = new int[]
{
21112, // Hames Orc Foot Soldier
21113, // Hames Orc Sniper
@ -54,12 +54,12 @@ public class Q00245_ComeToMe extends Quest
21116 // Hames Orc Prefect
};
// Items
private final static int FLAME_ASHES = 30322;
private final static int CRYSTALS_OF_EXPERIENCE = 30323;
private final static int CRYSTAL_A = 1461;
private final static int MENTOR_RING = 30383;
private final static int ACADEMY_DYE_STR = 47205;
private final static int ACADEMY_DYE_WIT = 47210;
private static final int FLAME_ASHES = 30322;
private static final int CRYSTALS_OF_EXPERIENCE = 30323;
private static final int CRYSTAL_A = 1461;
private static final int MENTOR_RING = 30383;
private static final int ACADEMY_DYE_STR = 47205;
private static final int ACADEMY_DYE_WIT = 47210;
// Misc
private static final int MIN_LEVEL = 70;
private static final int MAX_LEVEL = 75;
@ -152,25 +152,22 @@ public class Q00245_ComeToMe extends Quest
{
htmltext = "30847-06.html";
}
else
else if (player.isMentee())
{
if (player.isMentee())
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
L2PcInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-08.html";
}
htmltext = "30847-10.html";
}
else
{
htmltext = "30847-09.html";
htmltext = "30847-08.html";
}
}
else
{
htmltext = "30847-09.html";
}
break;
}
case 3:

View File

@ -151,12 +151,9 @@ public class Q00483_IntendedTactic extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "33357-03.html";
}
htmltext = "33357-03.html";
}
return htmltext;
}

View File

@ -201,12 +201,9 @@ public class Q00775_RetrievingTheChaosFragment extends Quest
}
}
}
else
else if (qs.isCompleted() && !qs.isNowAvailable())
{
if (qs.isCompleted() && !qs.isNowAvailable())
{
htmltext = "31595-08.html";
}
htmltext = "31595-08.html";
}
return htmltext;
}

View File

@ -164,13 +164,10 @@ public class Q10447_TimingIsEverything extends Quest
showOnScreenMsg(qs.getPlayer(), NpcStringId.YOU_TOOK_DOWN_THE_NERVA_ORCS_AND_GOT_THEIR_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
qs.setCond(2, true);
}
else
else if (getRandom(100) < 0.03)
{
if (getRandom(100) < 0.03)
{
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
showOnScreenMsg(killer, NpcStringId.YOU_HAVE_OBTAINED_NERVA_S_TEMPORARY_PRISON_KEY, ExShowScreenMessage.BOTTOM_RIGHT, 5000);
giveItems(killer, NARVAS_PRISON_KEY, 1);
}
return super.onKill(npc, killer, isSummon);
}

View File

@ -126,48 +126,45 @@ public final class Q10771_VolatilePower extends Quest
break;
}
}
else
else if (qs.isStarted())
{
if (qs.isStarted())
if (qs.isCond(1))
{
if (qs.isCond(1))
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
final int itemCount = (int) getQuestItemsCount(player, SHINING_MYSTERIOUS_FRAGMENT);
int reduceCount = getRandom(1, 3);
if (reduceCount > itemCount)
{
reduceCount = itemCount;
}
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
reduceCount = itemCount;
}
else
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_CRUSHER_IS_ACTIVATED);
npc.setScriptValue(reduceCount);
for (int i = 0; i < 3; i++)
{
htmltext = "33990-02.html";
final L2Npc mob = addSpawn(FRAGMENT_EATER, player, true, 70000);
mob.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.KILL_THEM_DON_T_LET_THEM_GET_AWAY_WITH_THE_FRAGMENT);
addAttackPlayerDesire(mob, player);
}
takeItems(player, SHINING_MYSTERIOUS_FRAGMENT, reduceCount);
giveItems(player, NORMAL_FRAGMENT_DUST, reduceCount);
getTimers().addTimer("DESTROY_COUNT", 2000, npc, player);
if (getQuestItemsCount(player, NORMAL_FRAGMENT_DUST) >= 20)
{
qs.setCond(3, true); // Looks like cond 2 is skipped.
}
htmltext = null;
}
else
{
htmltext = "33990-01.html";
htmltext = "33990-02.html";
}
}
else
{
htmltext = "33990-01.html";
}
return htmltext;
}

View File

@ -54,7 +54,7 @@ public class IPSubnet
_mask = getMask(mask, _addr.length);
if (!applyMask(_addr))
{
throw new UnknownHostException(addr.toString() + "/" + mask);
throw new UnknownHostException(addr + "/" + mask);
}
}
@ -117,7 +117,7 @@ public class IPSubnet
try
{
return InetAddress.getByAddress(_addr).toString() + "/" + size;
return InetAddress.getByAddress(_addr) + "/" + size;
}
catch (UnknownHostException e)
{
@ -144,7 +144,7 @@ public class IPSubnet
return false;
}
private static final byte[] getMask(int n, int maxLength) throws UnknownHostException
private static byte[] getMask(int n, int maxLength) throws UnknownHostException
{
if ((n > (maxLength << 3)) || (n < 0))
{

View File

@ -61,7 +61,7 @@ public class GeoEngine
* Returns the instance of the {@link GeoEngine}.
* @return {@link GeoEngine} : The instance.
*/
public static final GeoEngine getInstance()
public static GeoEngine getInstance()
{
return SingletonHolder._instance;
}
@ -226,7 +226,7 @@ public class GeoEngine
* @param worldX
* @return int : Geo X
*/
public static final int getGeoX(int worldX)
public static int getGeoX(int worldX)
{
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
}
@ -236,7 +236,7 @@ public class GeoEngine
* @param worldY
* @return int : Geo Y
*/
public static final int getGeoY(int worldY)
public static int getGeoY(int worldY)
{
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
}
@ -246,7 +246,7 @@ public class GeoEngine
* @param geoX
* @return int : World X
*/
public static final int getWorldX(int geoX)
public static int getWorldX(int geoX)
{
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
}
@ -256,7 +256,7 @@ public class GeoEngine
* @param geoY
* @return int : World Y
*/
public static final int getWorldY(int geoY)
public static int getWorldY(int geoY)
{
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
}
@ -364,7 +364,7 @@ public class GeoEngine
* @param inside : 2D description of {@link IGeoObject}
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
*/
public static final byte[][] calculateGeoObject(boolean inside[][])
public static byte[][] calculateGeoObject(boolean inside[][])
{
// get dimensions
final int width = inside.length;
@ -1260,7 +1260,7 @@ public class GeoEngine
* @param dirY : Y direction NSWE flag
* @return byte : NSWE flag of combined direction
*/
private static final byte getDirXY(byte dirX, byte dirY)
private static byte getDirXY(byte dirX, byte dirY)
{
// check axis directions
if (dirY == GeoStructure.CELL_FLAG_N)

View File

@ -171,7 +171,7 @@ final class GeoEnginePathfinding extends GeoEngine
* @param target : the entry point
* @return List<NodeLoc> : list of node location
*/
private static final List<Location> constructPath(Node target)
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();

View File

@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
/**
* Initializes the temporarily buffer.
*/
public static final void initialize()
public static void initialize()
{
// initialize temporarily buffer and sorting mechanism
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
/**
* Releases temporarily buffer.
*/
public static final void release()
public static void release()
{
_temp = null;
}

View File

@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void addGeoObject(IGeoObject object)
final synchronized public void addGeoObject(IGeoObject object)
{
// add geo object, update block geodata when added
if (_objects.add(object))
@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
}
@Override
public synchronized final void removeGeoObject(IGeoObject object)
final synchronized public void removeGeoObject(IGeoObject object)
{
// remove geo object, update block geodata when removed
if (_objects.remove(object))

View File

@ -25,11 +25,11 @@ public interface IBlockDynamic
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be added.
*/
public void addGeoObject(IGeoObject object);
void addGeoObject(IGeoObject object);
/**
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
* @param object : {@link IGeoObject} to be removed.
*/
public void removeGeoObject(IGeoObject object);
void removeGeoObject(IGeoObject object);
}

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