Code review Part 4.

This commit is contained in:
MobiusDevelopment
2019-12-21 21:39:37 +00:00
parent cd1f62cc68
commit 4a563b8832
8097 changed files with 41111 additions and 57926 deletions

View File

@ -51,10 +51,7 @@ public class ThreadPool
INSTANT_POOL.prestartAllCoreThreads();
// Launch purge task.
scheduleAtFixedRate(() ->
{
purge();
}, 60000, 60000);
scheduleAtFixedRate(ThreadPool::purge, 60000, 60000);
LOGGER.info("ThreadPool: Initialized");
LOGGER.info("...scheduled pool executor with " + Config.SCHEDULED_THREAD_POOL_COUNT + " total threads.");
@ -165,7 +162,7 @@ public class ThreadPool
}
catch (Throwable t)
{
t.printStackTrace();
LOGGER.info("ThreadPool: Problem at Shutting down. " + t.getMessage());
}
}
}

View File

@ -60,11 +60,13 @@ public class DatabaseBackup
}
catch (Exception ex)
{
// Ignore.
}
});
}
catch (Exception e)
{
// Ignore.
}
}
@ -77,6 +79,7 @@ public class DatabaseBackup
}
catch (Exception e)
{
// Ignore.
}
}
}

View File

@ -50,7 +50,7 @@ public class DatabaseFactory
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.info("Database: Problem on initialize. " + e);
}
}

View File

@ -16,6 +16,7 @@
*/
package org.l2jmobius.commons.network;
import java.nio.charset.StandardCharsets;
import java.util.logging.Logger;
/**
@ -71,7 +72,7 @@ public abstract class BaseRecievePacket
String result = null;
try
{
result = new String(_decrypt, _off, _decrypt.length - _off, "UTF-16LE");
result = new String(_decrypt, _off, _decrypt.length - _off, StandardCharsets.UTF_16LE);
result = result.substring(0, result.indexOf(0x00));
_off += (result.length() * 2) + 2;
}

View File

@ -18,6 +18,7 @@ package org.l2jmobius.commons.network;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.logging.Logger;
/**
@ -72,7 +73,7 @@ public abstract class BaseSendablePacket
{
if (text != null)
{
_bao.write(text.getBytes("UTF-16LE"));
_bao.write(text.getBytes(StandardCharsets.UTF_16LE));
}
}
catch (Exception e)

View File

@ -164,9 +164,8 @@ public class CommonUtil
* @param hour the hour
* @param min the min
* @return the next or same date from the days of week at specified time
* @throws IllegalArgumentException if the {@code daysOfWeek Array} is empty.
*/
public static LocalDateTime getNextClosestDateTime(DayOfWeek[] daysOfWeek, int hour, int min) throws IllegalArgumentException
public static LocalDateTime getNextClosestDateTime(DayOfWeek[] daysOfWeek, int hour, int min)
{
return getNextClosestDateTime(Arrays.asList(daysOfWeek), hour, min);
}
@ -177,9 +176,8 @@ public class CommonUtil
* @param hour the hour
* @param min the min
* @return the next or same date from the days of week at specified time
* @throws IllegalArgumentException if the {@code daysOfWeek List} is empty.
*/
public static LocalDateTime getNextClosestDateTime(List<DayOfWeek> daysOfWeek, int hour, int min) throws IllegalArgumentException
public static LocalDateTime getNextClosestDateTime(List<DayOfWeek> daysOfWeek, int hour, int min)
{
if (daysOfWeek.isEmpty())
{

View File

@ -180,15 +180,15 @@ public class HexUtils
return dstAsciiChars;
}
private static final int _HEX_ED_BPL = 16;
private static final int _HEX_ED_CPB = 2;
private static final int HEX_ED_BPL = 16;
private static final int HEX_ED_CPB = 2;
/**
* Method to generate the hexadecimal character representation of a byte array like in a hex editor<br>
* Line Format: {OFFSET} {HEXADECIMAL} {ASCII}({NEWLINE})<br>
* {OFFSET} = offset of the first byte in line(8 chars)<br>
* {HEXADECIMAL} = hexadecimal character representation({@link #_HEX_ED_BPL}*2 chars)<br>
* {ASCII} = ascii character presentation({@link #_HEX_ED_BPL} chars)
* {HEXADECIMAL} = hexadecimal character representation({@link #HEX_ED_BPL}*2 chars)<br>
* {ASCII} = ascii character presentation({@link #HEX_ED_BPL} chars)
* @param data byte array to generate the hexadecimal character representation
* @param len the number of bytes to generate the hexadecimal character representation from
* @return byte array which contains the hexadecimal character representation of the given byte array
@ -196,8 +196,8 @@ public class HexUtils
public static char[] bArr2HexEdChars(byte[] data, int len)
{
// {OFFSET} {HEXADECIMAL} {ASCII}{NEWLINE}
final int lineLength = 9 + (_HEX_ED_BPL * _HEX_ED_CPB) + 1 + _HEX_ED_BPL + _NEW_LINE_CHARS.length;
final int lenBplMod = len % _HEX_ED_BPL;
final int lineLength = 9 + (HEX_ED_BPL * HEX_ED_CPB) + 1 + HEX_ED_BPL + _NEW_LINE_CHARS.length;
final int lenBplMod = len % HEX_ED_BPL;
// create text buffer
// 1. don't allocate a full last line if not _HEX_ED_BPL bytes are shown in last line
// 2. no new line at end of buffer
@ -208,13 +208,13 @@ public class HexUtils
char[] textData;
if (lenBplMod == 0)
{
numLines = len / _HEX_ED_BPL;
numLines = len / HEX_ED_BPL;
textData = new char[(lineLength * numLines) - _NEW_LINE_CHARS.length];
}
else
{
numLines = (len / _HEX_ED_BPL) + 1;
textData = new char[(lineLength * numLines) - (_HEX_ED_BPL - (lenBplMod)) - _NEW_LINE_CHARS.length];
numLines = (len / HEX_ED_BPL) + 1;
textData = new char[(lineLength * numLines) - (HEX_ED_BPL - (lenBplMod)) - _NEW_LINE_CHARS.length];
}
// performance penalty, only doing space filling in the loop is faster
@ -227,11 +227,11 @@ public class HexUtils
int lineAsciiDataStart;
for (int i = 0; i < numLines; ++i)
{
dataOffset = i * _HEX_ED_BPL;
dataLen = Math.min(len - dataOffset, _HEX_ED_BPL);
dataOffset = i * HEX_ED_BPL;
dataLen = Math.min(len - dataOffset, HEX_ED_BPL);
lineStart = i * lineLength;
lineHexDataStart = lineStart + 9;
lineAsciiDataStart = lineHexDataStart + (_HEX_ED_BPL * _HEX_ED_CPB) + 1;
lineAsciiDataStart = lineHexDataStart + (HEX_ED_BPL * HEX_ED_CPB) + 1;
int2HexChars(dataOffset, textData, lineStart); // the offset of this line
textData[lineHexDataStart - 1] = ' '; // separate
@ -241,13 +241,13 @@ public class HexUtils
if (i < (numLines - 1))
{
textData[lineAsciiDataStart - 1] = ' '; // separate
System.arraycopy(_NEW_LINE_CHARS, 0, textData, lineAsciiDataStart + _HEX_ED_BPL, _NEW_LINE_CHARS.length); // the new line
System.arraycopy(_NEW_LINE_CHARS, 0, textData, lineAsciiDataStart + HEX_ED_BPL, _NEW_LINE_CHARS.length); // the new line
}
else if (dataLen < _HEX_ED_BPL)
else if (dataLen < HEX_ED_BPL)
{
// last line which shows less than _HEX_ED_BPL bytes
final int lineHexDataEnd = lineHexDataStart + (dataLen * _HEX_ED_CPB);
Arrays.fill(textData, lineHexDataEnd, lineHexDataEnd + ((_HEX_ED_BPL - dataLen) * _HEX_ED_CPB) + 1, ' '); // spaces, for the last line if there are not _HEX_ED_BPL bytes
final int lineHexDataEnd = lineHexDataStart + (dataLen * HEX_ED_CPB);
Arrays.fill(textData, lineHexDataEnd, lineHexDataEnd + ((HEX_ED_BPL - dataLen) * HEX_ED_CPB) + 1, ' '); // spaces, for the last line if there are not _HEX_ED_BPL bytes
}
else
{

View File

@ -25,9 +25,9 @@ public class IPSubnet
private final byte[] _mask;
private final boolean _isIPv4;
public IPSubnet(String input) throws UnknownHostException, NumberFormatException, ArrayIndexOutOfBoundsException
public IPSubnet(String input) throws UnknownHostException
{
final int idx = input.indexOf("/");
final int idx = input.indexOf('/');
if (idx > 0)
{
_addr = InetAddress.getByName(input.substring(0, idx)).getAddress();

View File

@ -91,11 +91,13 @@ public class LimitLinesDocumentListener implements DocumentListener
@Override
public void removeUpdate(DocumentEvent e)
{
// Ignore.
}
@Override
public void changedUpdate(DocumentEvent e)
{
// Ignore.
}
/*

View File

@ -1440,7 +1440,7 @@ public class BlowfishEngine
*/
private int bytesTo32bits(byte[] src, int srcIndex)
{
return ((src[srcIndex + 3] & 0xff) << 24) | ((src[srcIndex + 2] & 0xff) << 16) | ((src[srcIndex + 1] & 0xff) << 8) | ((src[srcIndex] & 0xff));
return ((src[srcIndex + 3] & 0xff) << 24) | ((src[srcIndex + 2] & 0xff) << 16) | ((src[srcIndex + 1] & 0xff) << 8) | (src[srcIndex] & 0xff);
}
/**

View File

@ -42,7 +42,7 @@ public class GameTimeController extends Thread
public static final int MILLIS_PER_IG_DAY = (3600000 * 24) / IG_DAYS_PER_DAY;
public static final int SECONDS_PER_IG_DAY = MILLIS_PER_IG_DAY / 1000;
public static final int TICKS_PER_IG_DAY = SECONDS_PER_IG_DAY * TICKS_PER_SECOND;
private final static int SHADOW_SENSE_ID = 294;
private static final int SHADOW_SENSE_ID = 294;
private static GameTimeController _instance;

View File

@ -376,6 +376,7 @@ public class LoginServerThread extends Thread
}
catch (Exception e)
{
// Ignore.
}
}
@ -383,9 +384,9 @@ public class LoginServerThread extends Thread
{
Thread.sleep(5000); // 5 seconds tempo.
}
catch (InterruptedException e)
catch (Exception e)
{
return; // never swallow an interrupt!
// Ignore.
}
}
}
@ -487,6 +488,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -504,6 +506,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -522,6 +525,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -540,6 +544,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -616,6 +621,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -679,6 +685,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -695,6 +702,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}
@ -714,6 +722,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
// Ignore.
}
}

View File

@ -210,6 +210,7 @@ public class Shutdown extends Thread
}
catch (Throwable t)
{
// ignore
}
// Backup database.
@ -401,7 +402,7 @@ public class Shutdown extends Thread
Thread.sleep(delay);
}
}
catch (InterruptedException e)
catch (Exception e)
{
// this will never happen
}
@ -493,9 +494,9 @@ public class Shutdown extends Thread
{
Thread.sleep(5000);
}
catch (InterruptedException e)
catch (Exception e)
{
// never happens :p
// this will never happen
}
}

View File

@ -406,7 +406,7 @@ public abstract class AbstractAI implements Ctrl
protected abstract void onEvtArrivedRevalidate();
protected abstract void onEvtArrivedBlocked(Location blocked_at_pos);
protected abstract void onEvtArrivedBlocked(Location location);
protected abstract void onEvtForgetObject(WorldObject object);
@ -456,13 +456,10 @@ public abstract class AbstractAI implements Ctrl
return;
}
}
else if (_actor.isOnGeodataPath())
// minimum time to calculate new route is 2 seconds
else if (_actor.isOnGeodataPath() && (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
{
// minimum time to calculate new route is 2 seconds
if (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10))
{
return;
}
return;
}
}
@ -688,20 +685,17 @@ public abstract class AbstractAI implements Ctrl
*/
public void describeStateToPlayer(PlayerInstance player)
{
if (_actor.isVisibleFor(player))
if (_actor.isVisibleFor(player) && _clientMoving)
{
if (_clientMoving)
if ((_clientMovingToPawnOffset != 0) && isFollowing())
{
if ((_clientMovingToPawnOffset != 0) && isFollowing())
{
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, _target, _clientMovingToPawnOffset));
}
else
{
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToLocation(_actor));
}
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToPawn(_actor, _target, _clientMovingToPawnOffset));
}
else
{
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToLocation(_actor));
}
}
}

View File

@ -128,14 +128,10 @@ public class AttackableAI extends CreatureAI
return false;
}
// Check if the target is a Playable
if (target.isPlayable())
// Check if the target is a Playable and if the AI isn't a Raid Boss, can See Silent Moving players and the target isn't in silent move mode
if (target.isPlayable() && !(me.isRaid()) && !(me.canSeeThroughSilentMove()) && ((Playable) target).isSilentMovingAffected())
{
// Check if the AI isn't a Raid Boss, can See Silent Moving players and the target isn't in silent move mode
if (!(me.isRaid()) && !(me.canSeeThroughSilentMove()) && ((Playable) target).isSilentMovingAffected())
{
return false;
}
return false;
}
// Gets the player if there is any.
@ -453,10 +449,7 @@ public class AttackableAI extends CreatureAI
}
if (npc instanceof GuardInstance)
{
World.getInstance().forEachVisibleObjectInRange(npc, GuardInstance.class, 500, guard ->
{
guard.addDamageHate(t, 0, 10);
});
World.getInstance().forEachVisibleObjectInRange(npc, GuardInstance.class, 500, guard -> guard.addDamageHate(t, 0, 10));
}
}
}
@ -565,7 +558,6 @@ public class AttackableAI extends CreatureAI
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, leader.getZ());
return;
}
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
{
@ -576,7 +568,6 @@ public class AttackableAI extends CreatureAI
{
setTarget(target);
npc.doCast(sk);
return;
}
}
}
@ -696,22 +687,19 @@ public class AttackableAI extends CreatureAI
}
// Check if the WorldObject is inside the Faction Range of the actor
if (called.hasAI())
if (called.hasAI() && (Math.abs(finalTarget.getZ() - called.getZ()) < 600) && npc.getAttackByList().stream().anyMatch(o -> o.get() == finalTarget) && ((called.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE) || (called.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE)))
{
if ((Math.abs(finalTarget.getZ() - called.getZ()) < 600) && npc.getAttackByList().stream().anyMatch(o -> o.get() == finalTarget) && ((called.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE) || (called.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE)))
if (finalTarget.isPlayable())
{
if (finalTarget.isPlayable())
{
// By default, when a faction member calls for help, attack the caller's attacker.
// Notify the AI with EVT_AGGRESSION
called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, finalTarget, 1);
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableFactionCall(called, getActiveChar(), finalTarget.getActingPlayer(), finalTarget.isSummon()), called);
}
else if (called.isAttackable() && (called.getAI()._intention != CtrlIntention.AI_INTENTION_ATTACK))
{
((Attackable) called).addDamageHate(finalTarget, 0, npc.getHating(finalTarget));
called.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, finalTarget);
}
// By default, when a faction member calls for help, attack the caller's attacker.
// Notify the AI with EVT_AGGRESSION
called.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, finalTarget, 1);
EventDispatcher.getInstance().notifyEventAsync(new OnAttackableFactionCall(called, getActiveChar(), finalTarget.getActingPlayer(), finalTarget.isSummon()), called);
}
else if (called.isAttackable() && (called.getAI()._intention != CtrlIntention.AI_INTENTION_ATTACK))
{
((Attackable) called).addDamageHate(finalTarget, 0, npc.getHating(finalTarget));
called.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, finalTarget);
}
}
});
@ -782,42 +770,39 @@ public class AttackableAI extends CreatureAI
}
}
// Dodge if its needed
if (!npc.isMovementDisabled() && (npc.getTemplate().getDodge() > 0))
if (!npc.isMovementDisabled() && (npc.getTemplate().getDodge() > 0) && (Rnd.get(100) <= npc.getTemplate().getDodge()))
{
if (Rnd.get(100) <= npc.getTemplate().getDodge())
// Micht: kepping this one otherwise we should do 2 sqrt
final double distance2 = npc.calculateDistanceSq2D(target);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
{
// Micht: kepping this one otherwise we should do 2 sqrt
final double distance2 = npc.calculateDistanceSq2D(target);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
int posX = npc.getX();
int posY = npc.getY();
final int posZ = npc.getZ() + 30;
if (target.getX() < posX)
{
int posX = npc.getX();
int posY = npc.getY();
final int posZ = npc.getZ() + 30;
if (target.getX() < posX)
{
posX += 300;
}
else
{
posX -= 300;
}
if (target.getY() < posY)
{
posY += 300;
}
else
{
posY -= 300;
}
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ, 0));
}
return;
posX += 300;
}
else
{
posX -= 300;
}
if (target.getY() < posY)
{
posY += 300;
}
else
{
posY -= 300;
}
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ, 0));
}
return;
}
}

View File

@ -152,7 +152,7 @@ public class ControllableMobAI extends AttackableAI
if (!_actor.isMuted())
{
int max_range = 0;
int maxRange = 0;
// check distant skills
for (Skill sk : _actor.getAllSkills())
@ -162,16 +162,13 @@ public class ControllableMobAI extends AttackableAI
_actor.doCast(sk);
return;
}
max_range = Math.max(max_range, sk.getCastRange());
maxRange = Math.max(maxRange, sk.getCastRange());
}
if (!_isNotMoving)
{
moveToPawn(target, max_range);
moveToPawn(target, maxRange);
}
return;
}
}
@ -198,7 +195,7 @@ public class ControllableMobAI extends AttackableAI
final double dist2 = _actor.calculateDistanceSq2D(target);
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@ -213,7 +210,7 @@ public class ControllableMobAI extends AttackableAI
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
if (!_isNotMoving)
@ -238,7 +235,7 @@ public class ControllableMobAI extends AttackableAI
setTarget(getForcedTarget());
final double dist2 = _actor.calculateDistanceSq2D(getForcedTarget());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@ -253,7 +250,7 @@ public class ControllableMobAI extends AttackableAI
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
if (!_isNotMoving)
@ -305,7 +302,7 @@ public class ControllableMobAI extends AttackableAI
setTarget(target);
final double dist2 = _actor.calculateDistanceSq2D(target);
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@ -320,7 +317,7 @@ public class ControllableMobAI extends AttackableAI
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
moveToPawn(target, range);
@ -420,14 +417,10 @@ public class ControllableMobAI extends AttackableAI
return false;
}
// Check if the target is a Playable
if (target.isPlayable())
// Check if the target is a Playable and if the target isn't in silent move mode
if (target.isPlayable() && ((Playable) target).isSilentMovingAffected())
{
// Check if the target isn't in silent move mode
if (((Playable) target).isSilentMovingAffected())
{
return false;
}
return false;
}
if (target.isNpc())
@ -468,9 +461,9 @@ public class ControllableMobAI extends AttackableAI
return _alternateAI;
}
public void setAlternateAI(int _alternateai)
public void setAlternateAI(int alternateAi)
{
_alternateAI = _alternateai;
_alternateAI = alternateAi;
}
public void forceAttack(Creature target)

View File

@ -709,7 +709,7 @@ public class CreatureAI extends AbstractAI
* </ul>
*/
@Override
protected void onEvtArrivedBlocked(Location blocked_at_loc)
protected void onEvtArrivedBlocked(Location location)
{
// If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE
if ((getIntention() == AI_INTENTION_MOVE_TO) || (getIntention() == AI_INTENTION_CAST))
@ -718,7 +718,7 @@ public class CreatureAI extends AbstractAI
}
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
clientStopMoving(blocked_at_loc);
clientStopMoving(location);
// Launch actions corresponding to the Event Think
onEvtThink();

View File

@ -124,7 +124,7 @@ public class DoorAI extends CreatureAI
}
@Override
protected void onEvtArrivedBlocked(Location blocked_at_loc)
protected void onEvtArrivedBlocked(Location location)
{
}

View File

@ -154,41 +154,38 @@ public class FriendlyNpcAI extends AttackableAI
}
}
// Dodge if its needed
if (!npc.isMovementDisabled() && (npc.getTemplate().getDodge() > 0))
if (!npc.isMovementDisabled() && (npc.getTemplate().getDodge() > 0) && (Rnd.get(100) <= npc.getTemplate().getDodge()))
{
if (Rnd.get(100) <= npc.getTemplate().getDodge())
final double distance2 = npc.calculateDistanceSq2D(originalAttackTarget);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
{
final double distance2 = npc.calculateDistanceSq2D(originalAttackTarget);
if (Math.sqrt(distance2) <= (60 + combinedCollision))
int posX = npc.getX();
int posY = npc.getY();
final int posZ = npc.getZ() + 30;
if (originalAttackTarget.getX() < posX)
{
int posX = npc.getX();
int posY = npc.getY();
final int posZ = npc.getZ() + 30;
if (originalAttackTarget.getX() < posX)
{
posX += 300;
}
else
{
posX -= 300;
}
if (originalAttackTarget.getY() < posY)
{
posY += 300;
}
else
{
posY -= 300;
}
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ, 0));
}
return;
posX += 300;
}
else
{
posX -= 300;
}
if (originalAttackTarget.getY() < posY)
{
posY += 300;
}
else
{
posY -= 300;
}
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(posX, posY, posZ, 0));
}
return;
}
}

View File

@ -105,7 +105,7 @@ public class NextAction
/**
* @param event the event to set.
*/
public void setEvents(ArrayList<CtrlEvent> event)
public void setEvents(List<CtrlEvent> event)
{
_events = event;
}
@ -170,7 +170,7 @@ public class NextAction
/**
* @param intentions the intention to set.
*/
public void setIntentions(ArrayList<CtrlIntention> intentions)
public void setIntentions(List<CtrlIntention> intentions)
{
_intentions = intentions;
}

View File

@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.cache;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -122,7 +123,7 @@ public class HtmCache
byte[] raw = new byte[bytes];
bis.read(raw);
content = new String(raw, "UTF-8");
content = new String(raw, StandardCharsets.UTF_8);
content = content.replaceAll("(?s)<!--.*?-->", ""); // Remove html comments
final String oldContent = HTML_CACHE.put(file.toURI().getPath().substring(Config.DATAPACK_ROOT.toURI().getPath().length()), content);

View File

@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.cache;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
@ -28,8 +29,8 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
*/
public class WarehouseCacheManager
{
final Map<PlayerInstance, Long> _cachedWh = new ConcurrentHashMap<>();
final long _cacheTime = Config.WAREHOUSE_CACHE_TIME * 60000;
private static final Map<PlayerInstance, Long> CACHED_WH = new ConcurrentHashMap<>();
private static final long CACHE_TIME = Config.WAREHOUSE_CACHE_TIME * 60000;
protected WarehouseCacheManager()
{
@ -38,30 +39,27 @@ public class WarehouseCacheManager
public void addCacheTask(PlayerInstance pc)
{
_cachedWh.put(pc, System.currentTimeMillis());
CACHED_WH.put(pc, System.currentTimeMillis());
}
public void remCacheTask(PlayerInstance pc)
{
_cachedWh.remove(pc);
CACHED_WH.remove(pc);
}
private class CacheScheduler implements Runnable
{
public CacheScheduler()
{
}
@Override
public void run()
{
final long cTime = System.currentTimeMillis();
for (PlayerInstance pc : _cachedWh.keySet())
for (Entry<PlayerInstance, Long> entry : CACHED_WH.entrySet())
{
if ((cTime - _cachedWh.get(pc)) > _cacheTime)
if ((cTime - entry.getValue()) > CACHE_TIME)
{
pc.clearWarehouse();
_cachedWh.remove(pc);
final PlayerInstance player = entry.getKey();
player.clearWarehouse();
CACHED_WH.remove(player);
}
}
}

View File

@ -58,13 +58,13 @@ public class Forum
/**
* Creates new instance of Forum. When you create new forum, use {@link org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager# addForum(org.l2jmobius.gameserver.communitybbs.BB.Forum)} to add forum to the forums manager.
* @param Forumid
* @param FParent
* @param forumId
* @param fParent
*/
public Forum(int Forumid, Forum FParent)
public Forum(int forumId, Forum fParent)
{
_forumId = Forumid;
_fParent = FParent;
_forumId = forumId;
_fParent = fParent;
_children = ConcurrentHashMap.newKeySet();
}
@ -73,9 +73,9 @@ public class Forum
* @param parent
* @param type
* @param perm
* @param OwnerID
* @param ownerId
*/
public Forum(String name, Forum parent, int type, int perm, int OwnerID)
public Forum(String name, Forum parent, int type, int perm, int ownerId)
{
_forumName = name;
_forumId = ForumsBBSManager.getInstance().getANewID();
@ -83,7 +83,7 @@ public class Forum
_forumPost = 0;
_forumPerm = perm;
_fParent = parent;
_ownerID = OwnerID;
_ownerID = ownerId;
_children = ConcurrentHashMap.newKeySet();
parent._children.add(this);
ForumsBBSManager.getInstance().addForum(this);

View File

@ -48,23 +48,23 @@ public class Post
private final Collection<CPost> _post;
/**
* @param _PostOwner
* @param _PostOwnerID
* @param postOwner
* @param postOwnerId
* @param date
* @param tid
* @param _PostForumID
* @param postForumId
* @param txt
*/
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
public Post(String postOwner, int postOwnerId, long date, int tid, int postForumId, String txt)
{
_post = ConcurrentHashMap.newKeySet();
final CPost cp = new CPost();
cp.postId = 0;
cp.postOwner = _PostOwner;
cp.postOwnerId = _PostOwnerID;
cp.postOwner = postOwner;
cp.postOwnerId = postOwnerId;
cp.postDate = date;
cp.postTopicId = tid;
cp.postForumId = _PostForumID;
cp.postForumId = postForumId;
cp.postTxt = txt;
_post.add(cp);
insertindb(cp);

View File

@ -49,9 +49,9 @@ public class Topic
* @param oname
* @param oid
* @param type
* @param Creply
* @param cReply
*/
public Topic(ConstructorType ct, int id, int fid, String name, long date, String oname, int oid, int type, int Creply)
public Topic(ConstructorType ct, int id, int fid, String name, long date, String oname, int oid, int type, int cReply)
{
_id = id;
_forumId = fid;
@ -60,7 +60,7 @@ public class Topic
_ownerName = oname;
_ownerId = oid;
_type = type;
_cReply = Creply;
_cReply = cReply;
TopicBBSManager.getInstance().addTopic(this);
if (ct == ConstructorType.CREATE)

View File

@ -56,24 +56,24 @@ public abstract class BaseBBSManager
*/
protected void send1002(PlayerInstance player, String string, String string2, String string3)
{
final List<String> _arg = new ArrayList<>(20);
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add(player.getName());
_arg.add(Integer.toString(player.getObjectId()));
_arg.add(player.getAccountName());
_arg.add("9");
_arg.add(string2); // subject?
_arg.add(string2); // subject?
_arg.add(string); // text
_arg.add(string3); // date?
_arg.add(string3); // date?
_arg.add("0");
_arg.add("0");
player.sendPacket(new ShowBoard(_arg));
final List<String> arg = new ArrayList<>(20);
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add(player.getName());
arg.add(Integer.toString(player.getObjectId()));
arg.add(player.getAccountName());
arg.add("9");
arg.add(string2); // subject?
arg.add(string2); // subject?
arg.add(string); // text
arg.add(string3); // date?
arg.add(string3); // date?
arg.add("0");
arg.add("0");
player.sendPacket(new ShowBoard(arg));
}
}

View File

@ -60,7 +60,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public void initRoot()
{
_table.forEach(f -> f.vload());
_table.forEach(Forum::vload);
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
}

View File

@ -244,12 +244,9 @@ public class TopicBBSManager extends BaseBBSManager
break;
}
final Topic t = forum.getTopic(j);
if (t != null)
if ((t != null) && (i++ >= (12 * (index - 1))))
{
if (i++ >= (12 * (index - 1)))
{
html.append("<table border=0 cellspacing=0 cellpadding=5 WIDTH=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=415><a action=\"bypass _bbsposts;read;" + forum.getID() + ";" + t.getID() + "\">" + t.getName() + "</a></td><td FIXWIDTH=120 align=center></td><td FIXWIDTH=70 align=center>" + dateFormat.format(new Date(t.getDate())) + "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
}
html.append("<table border=0 cellspacing=0 cellpadding=5 WIDTH=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=415><a action=\"bypass _bbsposts;read;" + forum.getID() + ";" + t.getID() + "\">" + t.getName() + "</a></td><td FIXWIDTH=120 align=center></td><td FIXWIDTH=70 align=center>" + dateFormat.format(new Date(t.getDate())) + "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
}
}

View File

@ -61,12 +61,9 @@ public class CharNameTable
private final void addName(int objectId, String name)
{
if (name != null)
if ((name != null) && !name.equals(_chars.get(objectId)))
{
if (!name.equals(_chars.get(objectId)))
{
_chars.put(objectId, name);
}
_chars.put(objectId, name);
}
}

View File

@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import org.w3c.dom.Document;
@ -36,8 +36,8 @@ import org.l2jmobius.gameserver.model.beautyshop.BeautyItem;
*/
public class BeautyShopData implements IXmlReader
{
private final Map<Race, Map<Sex, BeautyData>> _beautyList = new HashMap<>();
private final Map<Sex, BeautyData> _beautyData = new HashMap<>();
private final Map<Race, Map<Sex, BeautyData>> _beautyList = new EnumMap<>(Race.class);
private final Map<Sex, BeautyData> _beautyData = new EnumMap<>(Sex.class);
protected BeautyShopData()
{

View File

@ -108,7 +108,7 @@ public class BuyListData implements IXmlReader
try
{
final int buyListId = Integer.parseInt(f.getName().replaceAll(".xml", ""));
forEach(doc, "list", (list) ->
forEach(doc, "list", list ->
{
final int defaultBaseTax = parseInteger(list.getAttributes(), "baseTax", 0);
final ProductList buyList = new ProductList(buyListId);
@ -146,7 +146,7 @@ public class BuyListData implements IXmlReader
}
case "npcs":
{
forEach(node, "npc", (npcNode) -> buyList.addAllowedNpc(Integer.parseInt(npcNode.getTextContent())));
forEach(node, "npc", npcNode -> buyList.addAllowedNpc(Integer.parseInt(npcNode.getTextContent())));
break;
}
}

View File

@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@ -38,7 +38,7 @@ public class CategoryData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(CategoryData.class.getName());
private final Map<CategoryType, Set<Integer>> _categories = new HashMap<>();
private final Map<CategoryType, Set<Integer>> _categories = new EnumMap<>(CategoryType.class);
protected CategoryData()
{

View File

@ -61,10 +61,7 @@ public class CubicData implements IXmlReader
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", listNode -> forEach(listNode, "cubic", cubicNode ->
{
parseTemplate(cubicNode, new CubicTemplate(new StatsSet(parseAttributes(cubicNode))));
}));
forEach(doc, "list", listNode -> forEach(listNode, "cubic", cubicNode -> parseTemplate(cubicNode, new CubicTemplate(new StatsSet(parseAttributes(cubicNode))))));
}
/**

View File

@ -75,10 +75,7 @@ public class DailyMissionData implements IXmlReader
set.set("items", items);
final List<ClassId> classRestriction = new ArrayList<>(1);
forEach(rewardNode, "classId", classRestrictionNode ->
{
classRestriction.add(ClassId.getClassId(Integer.parseInt(classRestrictionNode.getTextContent())));
});
forEach(rewardNode, "classId", classRestrictionNode -> classRestriction.add(ClassId.getClassId(Integer.parseInt(classRestrictionNode.getTextContent()))));
set.set("classRestriction", classRestriction);
// Initial values in case handler doesn't exists

View File

@ -118,7 +118,7 @@ public class DoorData implements IXmlReader
private void applyCollisions(StatsSet set)
{
// Insert Collision data
if (set.contains("nodeX_0") && set.contains("nodeY_0") && set.contains("nodeX_1") && set.contains("nodeX_1"))
if (set.contains("nodeX_0") && set.contains("nodeY_0") && set.contains("nodeX_1") && set.contains("nodeY_1"))
{
final int height = set.getInt("height", 150);
final int nodeX = set.getInt("nodeX_0");

View File

@ -70,22 +70,9 @@ public class EnchantSkillGroupsData implements IXmlReader
forEach(doc, "list", listNode -> forEach(listNode, "enchant", enchantNode ->
{
final EnchantSkillHolder enchantSkillHolder = new EnchantSkillHolder(new StatsSet(parseAttributes(enchantNode)));
forEach(enchantNode, "sps", spsNode -> forEach(spsNode, "sp", spNode ->
{
enchantSkillHolder.addSp(parseEnum(spNode.getAttributes(), SkillEnchantType.class, "type"), parseInteger(spNode.getAttributes(), "amount"));
}));
forEach(enchantNode, "chances", chancesNode -> forEach(chancesNode, "chance", chanceNode ->
{
enchantSkillHolder.addChance(parseEnum(chanceNode.getAttributes(), SkillEnchantType.class, "type"), parseInteger(chanceNode.getAttributes(), "value"));
}));
forEach(enchantNode, "items", itemsNode -> forEach(itemsNode, "item", itemNode ->
{
enchantSkillHolder.addRequiredItem(parseEnum(itemNode.getAttributes(), SkillEnchantType.class, "type"), new ItemHolder(new StatsSet(parseAttributes(itemNode))));
}));
forEach(enchantNode, "sps", spsNode -> forEach(spsNode, "sp", spNode -> enchantSkillHolder.addSp(parseEnum(spNode.getAttributes(), SkillEnchantType.class, "type"), parseInteger(spNode.getAttributes(), "amount"))));
forEach(enchantNode, "chances", chancesNode -> forEach(chancesNode, "chance", chanceNode -> enchantSkillHolder.addChance(parseEnum(chanceNode.getAttributes(), SkillEnchantType.class, "type"), parseInteger(chanceNode.getAttributes(), "value"))));
forEach(enchantNode, "items", itemsNode -> forEach(itemsNode, "item", itemNode -> enchantSkillHolder.addRequiredItem(parseEnum(itemNode.getAttributes(), SkillEnchantType.class, "type"), new ItemHolder(new StatsSet(parseAttributes(itemNode))))));
_enchantSkillHolders.put(parseInteger(enchantNode.getAttributes(), "level"), enchantSkillHolder);
}));
}

View File

@ -103,7 +103,7 @@ public class FakePlayerData implements IXmlReader
return _fakePlayerNames.get(name.toLowerCase());
}
public Boolean isTalkable(String name)
public boolean isTalkable(String name)
{
return _talkableFakePlayerNames.contains(name.toLowerCase());
}

View File

@ -165,27 +165,20 @@ public class FenceData implements IXmlReader
{
return false;
}
if ((x > xMin) && (tx > xMin) && (x < xMax) && (tx < xMax))
if ((x > xMin) && (tx > xMin) && (x < xMax) && (tx < xMax) && (y > yMin) && (ty > yMin) && (y < yMax) && (ty < yMax))
{
if ((y > yMin) && (ty > yMin) && (y < yMax) && (ty < yMax))
{
return false;
}
return false;
}
if (crossLinePart(xMin, yMin, xMax, yMin, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMax, yMin, xMax, yMax, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMax, yMax, xMin, yMax, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMin, yMax, xMin, yMin, x, y, tx, ty, xMin, yMin, xMax, yMax))
if ((crossLinePart(xMin, yMin, xMax, yMin, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMax, yMin, xMax, yMax, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMax, yMax, xMin, yMax, x, y, tx, ty, xMin, yMin, xMax, yMax) || crossLinePart(xMin, yMax, xMin, yMin, x, y, tx, ty, xMin, yMin, xMax, yMax)) && (z > (fence.getZ() - MAX_Z_DIFF)) && (z < (fence.getZ() + MAX_Z_DIFF)))
{
if ((z > (fence.getZ() - MAX_Z_DIFF)) && (z < (fence.getZ() + MAX_Z_DIFF)))
{
return true;
}
return true;
}
return false;
};
final WorldRegion region = World.getInstance().getRegion(x, y); // Should never be null.
return region == null ? false : _regions.getOrDefault(region, Collections.emptyList()).stream().anyMatch(filter);
return (region != null) && _regions.getOrDefault(region, Collections.emptyList()).stream().anyMatch(filter);
}
private boolean crossLinePart(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, double xMin, double yMin, double xMax, double yMax)

View File

@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@ -42,7 +42,7 @@ public class InitialEquipmentData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(InitialEquipmentData.class.getName());
private final Map<ClassId, List<PlayerItemTemplate>> _initialEquipmentList = new HashMap<>();
private final Map<ClassId, List<PlayerItemTemplate>> _initialEquipmentList = new EnumMap<>(ClassId.class);
private static final String NORMAL = "data/stats/initialEquipment.xml";
private static final String EVENT = "data/stats/initialEquipmentEvent.xml";

View File

@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -47,7 +48,7 @@ public class InitialShortcutData implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(InitialShortcutData.class.getName());
private final Map<ClassId, List<Shortcut>> _initialShortcutData = new HashMap<>();
private final Map<ClassId, List<Shortcut>> _initialShortcutData = new EnumMap<>(ClassId.class);
private final List<Shortcut> _initialGlobalShortcutList = new ArrayList<>();
private final Map<Integer, Macro> _macroPresets = new HashMap<>();

View File

@ -33,9 +33,9 @@ import org.l2jmobius.gameserver.model.StatsSet;
*/
public class NpcNameLocalisationData implements IXmlReader
{
private final static Logger LOGGER = Logger.getLogger(NpcNameLocalisationData.class.getName());
private static final Logger LOGGER = Logger.getLogger(NpcNameLocalisationData.class.getName());
private final static Map<String, Map<Integer, String[]>> NPC_NAME_LOCALISATIONS = new ConcurrentHashMap<>();
private static final Map<String, Map<Integer, String[]>> NPC_NAME_LOCALISATIONS = new ConcurrentHashMap<>();
private static String _lang;
protected NpcNameLocalisationData()

View File

@ -72,10 +72,7 @@ public class OptionData implements IXmlReader
{
final String name = parseString(effectNode.getAttributes(), "name");
final StatsSet params = new StatsSet();
forEach(effectNode, IXmlReader::isNode, paramNode ->
{
params.set(paramNode.getNodeName(), SkillData.getInstance().parseValue(paramNode, true, false, Collections.emptyMap()));
});
forEach(effectNode, IXmlReader::isNode, paramNode -> params.set(paramNode.getNodeName(), SkillData.getInstance().parseValue(paramNode, true, false, Collections.emptyMap())));
option.addEffect(EffectHandler.getInstance().getHandlerFactory(name).apply(params));
});
break;

View File

@ -128,12 +128,9 @@ public class PetSkillData implements IXmlReader
}
break;
}
else if (1 <= pet.getLevel())
else if ((1 <= pet.getLevel()) && (skillHolder.getSkillLevel() > lvl))
{
if (skillHolder.getSkillLevel() > lvl)
{
lvl = skillHolder.getSkillLevel();
}
lvl = skillHolder.getSkillLevel();
}
}

View File

@ -34,10 +34,10 @@ import org.l2jmobius.gameserver.model.StatsSet;
*/
public class SendMessageLocalisationData implements IXmlReader
{
private final static Logger LOGGER = Logger.getLogger(SendMessageLocalisationData.class.getName());
private static final Logger LOGGER = Logger.getLogger(SendMessageLocalisationData.class.getName());
private final static String SPLIT_STRING = "XXX";
private final static Map<String, Map<String[], String[]>> SEND_MESSAGE_LOCALISATIONS = new ConcurrentHashMap<>();
private static final String SPLIT_STRING = "XXX";
private static final Map<String, Map<String[], String[]>> SEND_MESSAGE_LOCALISATIONS = new ConcurrentHashMap<>();
private static String _lang;
protected SendMessageLocalisationData()

View File

@ -79,12 +79,9 @@ public class SiegeScheduleData implements IXmlReader
final Node node = attrs.item(i);
final String key = node.getNodeName();
String val = node.getNodeValue();
if ("day".equals(key))
if ("day".equals(key) && !Util.isDigit(val))
{
if (!Util.isDigit(val))
{
val = Integer.toString(getValueForField(val));
}
val = Integer.toString(getValueForField(val));
}
set.set(key, val);
}

View File

@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@ -246,8 +247,8 @@ public class SkillData implements IXmlReader
parseAttributes(attributes, "", generalSkillInfo);
final Map<String, Map<Integer, Map<Integer, Object>>> variableValues = new HashMap<>();
final Map<EffectScope, List<NamedParamInfo>> effectParamInfo = new HashMap<>();
final Map<SkillConditionScope, List<NamedParamInfo>> conditionParamInfo = new HashMap<>();
final Map<EffectScope, List<NamedParamInfo>> effectParamInfo = new EnumMap<>(EffectScope.class);
final Map<SkillConditionScope, List<NamedParamInfo>> conditionParamInfo = new EnumMap<>(SkillConditionScope.class);
for (Node skillNode = listNode.getFirstChild(); skillNode != null; skillNode = skillNode.getNextSibling())
{
final String skillNodeName = skillNode.getNodeName();
@ -330,109 +331,103 @@ public class SkillData implements IXmlReader
});
});
Stream.concat(effectParamInfo.values().stream(), conditionParamInfo.values().stream()).forEach(namedParamInfos ->
Stream.concat(effectParamInfo.values().stream(), conditionParamInfo.values().stream()).forEach(namedParamInfos -> namedParamInfos.forEach(namedParamInfo ->
{
namedParamInfos.forEach(namedParamInfo ->
namedParamInfo.getInfo().forEach((level, subLevelMap) ->
{
namedParamInfo.getInfo().forEach((level, subLevelMap) ->
if (level == -1)
{
if (level == -1)
return;
}
subLevelMap.forEach((subLevel, statsSet) ->
{
if (subLevel == -1)
{
return;
}
subLevelMap.forEach((subLevel, statsSet) ->
{
if (subLevel == -1)
{
return;
}
levels.computeIfAbsent(level, k -> new HashSet<>()).add(subLevel);
});
levels.computeIfAbsent(level, k -> new HashSet<>()).add(subLevel);
});
if ((namedParamInfo.getFromLevel() != null) && (namedParamInfo.getToLevel() != null))
{
for (int i = namedParamInfo.getFromLevel(); i <= namedParamInfo.getToLevel(); i++)
{
if ((namedParamInfo.getFromSubLevel() != null) && (namedParamInfo.getToSubLevel() != null))
{
for (int j = namedParamInfo.getFromSubLevel(); j <= namedParamInfo.getToSubLevel(); j++)
{
levels.computeIfAbsent(i, k -> new HashSet<>()).add(j);
}
}
else
{
levels.computeIfAbsent(i, k -> new HashSet<>()).add(0);
}
}
}
});
});
levels.forEach((level, subLevels) ->
{
subLevels.forEach(subLevel ->
if ((namedParamInfo.getFromLevel() != null) && (namedParamInfo.getToLevel() != null))
{
final StatsSet statsSet = Optional.ofNullable(skillInfo.getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new);
skillInfo.getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent);
skillInfo.getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent);
statsSet.set(".level", level);
statsSet.set(".subLevel", subLevel);
final Skill skill = new Skill(statsSet);
forEachNamedParamInfoParam(effectParamInfo, level, subLevel, ((effectScope, params) ->
for (int i = namedParamInfo.getFromLevel(); i <= namedParamInfo.getToLevel(); i++)
{
final String effectName = params.getString(".name");
params.remove(".name");
try
if ((namedParamInfo.getFromSubLevel() != null) && (namedParamInfo.getToSubLevel() != null))
{
final Function<StatsSet, AbstractEffect> effectFunction = EffectHandler.getInstance().getHandlerFactory(effectName);
if (effectFunction != null)
for (int j = namedParamInfo.getFromSubLevel(); j <= namedParamInfo.getToSubLevel(); j++)
{
skill.addEffect(effectScope, effectFunction.apply(params));
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Missing effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]");
levels.computeIfAbsent(i, k -> new HashSet<>()).add(j);
}
}
catch (Exception e)
else
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]", e);
levels.computeIfAbsent(i, k -> new HashSet<>()).add(0);
}
}));
forEachNamedParamInfoParam(conditionParamInfo, level, subLevel, ((skillConditionScope, params) ->
{
final String conditionName = params.getString(".name");
params.remove(".name");
try
{
final Function<StatsSet, ISkillCondition> conditionFunction = SkillConditionHandler.getInstance().getHandlerFactory(conditionName);
if (conditionFunction != null)
{
skill.addCondition(skillConditionScope, conditionFunction.apply(params));
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Missing condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + skillConditionScope + "] Effect Name[" + conditionName + "]");
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Condition Scope[" + skillConditionScope + "] Condition Name[" + conditionName + "]", e);
}
}));
_skills.put(getSkillHashCode(skill), skill);
_skillsMaxLevel.merge(skill.getId(), skill.getLevel(), Integer::max);
if ((skill.getSubLevel() % 1000) == 1)
{
EnchantSkillGroupsData.getInstance().addRouteForSkill(skill.getId(), skill.getLevel(), skill.getSubLevel());
}
});
});
}
}));
levels.forEach((level, subLevels) -> subLevels.forEach(subLevel ->
{
final StatsSet statsSet = Optional.ofNullable(skillInfo.getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new);
skillInfo.getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent);
skillInfo.getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(statsSet.getSet()::putIfAbsent);
statsSet.set(".level", level);
statsSet.set(".subLevel", subLevel);
final Skill skill = new Skill(statsSet);
forEachNamedParamInfoParam(effectParamInfo, level, subLevel, ((effectScope, params) ->
{
final String effectName = params.getString(".name");
params.remove(".name");
try
{
final Function<StatsSet, AbstractEffect> effectFunction = EffectHandler.getInstance().getHandlerFactory(effectName);
if (effectFunction != null)
{
skill.addEffect(effectScope, effectFunction.apply(params));
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Missing effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]");
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading effect for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + effectScope + "] Effect Name[" + effectName + "]", e);
}
}));
forEachNamedParamInfoParam(conditionParamInfo, level, subLevel, ((skillConditionScope, params) ->
{
final String conditionName = params.getString(".name");
params.remove(".name");
try
{
final Function<StatsSet, ISkillCondition> conditionFunction = SkillConditionHandler.getInstance().getHandlerFactory(conditionName);
if (conditionFunction != null)
{
skill.addCondition(skillConditionScope, conditionFunction.apply(params));
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Missing condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Effect Scope[" + skillConditionScope + "] Effect Name[" + conditionName + "]");
}
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed loading condition for Skill Id[" + statsSet.getInt(".id") + "] Level[" + level + "] SubLevel[" + subLevel + "] Condition Scope[" + skillConditionScope + "] Condition Name[" + conditionName + "]", e);
}
}));
_skills.put(getSkillHashCode(skill), skill);
_skillsMaxLevel.merge(skill.getId(), skill.getLevel(), Integer::max);
if ((skill.getSubLevel() % 1000) == 1)
{
EnchantSkillGroupsData.getInstance().addRouteForSkill(skill.getId(), skill.getLevel(), skill.getSubLevel());
}
}));
}
}
}
@ -441,23 +436,18 @@ public class SkillData implements IXmlReader
private <T> void forEachNamedParamInfoParam(Map<T, List<NamedParamInfo>> paramInfo, int level, int subLevel, BiConsumer<T, StatsSet> consumer)
{
paramInfo.forEach((scope, namedParamInfos) ->
paramInfo.forEach((scope, namedParamInfos) -> namedParamInfos.forEach(namedParamInfo ->
{
namedParamInfos.forEach(namedParamInfo ->
if ((((namedParamInfo.getFromLevel() == null) && (namedParamInfo.getToLevel() == null)) || ((namedParamInfo.getFromLevel() <= level) && (namedParamInfo.getToLevel() >= level))) //
&& (((namedParamInfo.getFromSubLevel() == null) && (namedParamInfo.getToSubLevel() == null)) || ((namedParamInfo.getFromSubLevel() <= subLevel) && (namedParamInfo.getToSubLevel() >= subLevel))))
{
if (((namedParamInfo.getFromLevel() == null) && (namedParamInfo.getToLevel() == null)) || ((namedParamInfo.getFromLevel() <= level) && (namedParamInfo.getToLevel() >= level)))
{
if (((namedParamInfo.getFromSubLevel() == null) && (namedParamInfo.getToSubLevel() == null)) || ((namedParamInfo.getFromSubLevel() <= subLevel) && (namedParamInfo.getToSubLevel() >= subLevel)))
{
final StatsSet params = Optional.ofNullable(namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new);
namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent);
namedParamInfo.getInfo().getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent);
params.set(".name", namedParamInfo.getName());
consumer.accept(scope, params);
}
}
});
});
final StatsSet params = Optional.ofNullable(namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).get(subLevel)).orElseGet(StatsSet::new);
namedParamInfo.getInfo().getOrDefault(level, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent);
namedParamInfo.getInfo().getOrDefault(-1, Collections.emptyMap()).getOrDefault(-1, StatsSet.EMPTY_STATSET).getSet().forEach(params.getSet()::putIfAbsent);
params.set(".name", namedParamInfo.getName());
consumer.accept(scope, params);
}
}));
}
private NamedParamInfo parseNamedParamInfo(Node node, Map<String, Map<Integer, Map<Integer, Object>>> variableValues)
@ -502,13 +492,7 @@ public class SkillData implements IXmlReader
}
}
values.forEach((level, subLevelMap) ->
{
subLevelMap.forEach((subLevel, value) ->
{
info.computeIfAbsent(level, k -> new HashMap<>()).computeIfAbsent(subLevel, k -> new StatsSet()).set(node.getNodeName(), value);
});
});
values.forEach((level, subLevelMap) -> subLevelMap.forEach((subLevel, value) -> info.computeIfAbsent(level, k -> new HashMap<>()).computeIfAbsent(subLevel, k -> new StatsSet()).set(node.getNodeName(), value)));
}
private Map<Integer, Map<Integer, Object>> parseValues(Node node)
@ -613,6 +597,7 @@ public class SkillData implements IXmlReader
{
break;
}
// fallthrough
}
default:
{

View File

@ -1396,12 +1396,9 @@ public class SkillTreesData implements IXmlReader
{
for (SkillLearn s : skillTree.values())
{
if (player.getLevel() < s.getGetLevel())
if ((player.getLevel() < s.getGetLevel()) && ((minLevel == 0) || (minLevel > s.getGetLevel())))
{
if ((minLevel == 0) || (minLevel > s.getGetLevel()))
{
minLevel = s.getGetLevel();
}
minLevel = s.getGetLevel();
}
}
}

View File

@ -344,10 +344,7 @@ public class SpawnsData implements IXmlReader
*/
private void parseMinions(Node n, NpcSpawnTemplate npcTemplate)
{
forEach(n, "minion", minionNode ->
{
npcTemplate.addMinion(new MinionHolder(new StatsSet(parseAttributes(minionNode))));
});
forEach(n, "minion", minionNode -> npcTemplate.addMinion(new MinionHolder(new StatsSet(parseAttributes(minionNode)))));
}
/**

View File

@ -57,47 +57,44 @@ public class TeleportersData implements IXmlReader
@Override
public void parseDocument(Document doc, File f)
{
forEach(doc, "list", (list) ->
forEach(doc, "list", list -> forEach(list, "npc", npc ->
{
forEach(list, "npc", (npc) ->
final Map<String, TeleportHolder> teleList = new HashMap<>();
// Parse npc node child
final int npcId = parseInteger(npc.getAttributes(), "id");
forEach(npc, node ->
{
final Map<String, TeleportHolder> teleList = new HashMap<>();
// Parse npc node child
final int npcId = parseInteger(npc.getAttributes(), "id");
forEach(npc, (node) ->
switch (node.getNodeName())
{
switch (node.getNodeName())
case "teleport":
{
case "teleport":
final NamedNodeMap nodeAttrs = node.getAttributes();
// Parse attributes
final TeleportType type = parseEnum(nodeAttrs, TeleportType.class, "type");
final String name = parseString(nodeAttrs, "name", type.name());
// Parse locations
final TeleportHolder holder = new TeleportHolder(name, type);
forEach(node, "location", location -> holder.registerLocation(new StatsSet(parseAttributes(location))));
// Register holder
if (teleList.putIfAbsent(name, holder) != null)
{
final NamedNodeMap nodeAttrs = node.getAttributes();
// Parse attributes
final TeleportType type = parseEnum(nodeAttrs, TeleportType.class, "type");
final String name = parseString(nodeAttrs, "name", type.name());
// Parse locations
final TeleportHolder holder = new TeleportHolder(name, type);
forEach(node, "location", (location) -> holder.registerLocation(new StatsSet(parseAttributes(location))));
// Register holder
if (teleList.putIfAbsent(name, holder) != null)
{
LOGGER.warning("Duplicate teleport list (" + name + ") has been found for NPC: " + npcId);
}
break;
}
case "npcs":
{
forEach(node, "npc", (npcNode) ->
{
final int id = parseInteger(npcNode.getAttributes(), "id");
registerTeleportList(id, teleList);
});
break;
LOGGER.warning("Duplicate teleport list (" + name + ") has been found for NPC: " + npcId);
}
break;
}
});
registerTeleportList(npcId, teleList);
case "npcs":
{
forEach(node, "npc", npcNode ->
{
final int id = parseInteger(npcNode.getAttributes(), "id");
registerTeleportList(id, teleList);
});
break;
}
}
});
});
registerTeleportList(npcId, teleList);
}));
}
public int getTeleporterCount()

View File

@ -68,126 +68,117 @@ public class VariationData implements IXmlReader
{
forEach(doc, "list", listNode ->
{
forEach(listNode, "variations", variationsNode ->
forEach(listNode, "variations", variationsNode -> forEach(variationsNode, "variation", variationNode ->
{
forEach(variationsNode, "variation", variationNode ->
final int mineralId = parseInteger(variationNode.getAttributes(), "mineralId");
if (ItemTable.getInstance().getTemplate(mineralId) == null)
{
final int mineralId = parseInteger(variationNode.getAttributes(), "mineralId");
if (ItemTable.getInstance().getTemplate(mineralId) == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Mineral with item id " + mineralId + " was not found.");
}
final Variation variation = new Variation(mineralId);
LOGGER.warning(getClass().getSimpleName() + ": Mineral with item id " + mineralId + " was not found.");
}
final Variation variation = new Variation(mineralId);
forEach(variationNode, "optionGroup", groupNode ->
{
final String weaponTypeString = parseString(groupNode.getAttributes(), "weaponType").toUpperCase();
final VariationWeaponType weaponType = VariationWeaponType.valueOf(weaponTypeString);
final int order = parseInteger(groupNode.getAttributes(), "order");
forEach(variationNode, "optionGroup", groupNode ->
final List<OptionDataCategory> sets = new ArrayList<>();
forEach(groupNode, "optionCategory", categoryNode ->
{
final String weaponTypeString = parseString(groupNode.getAttributes(), "weaponType").toUpperCase();
final VariationWeaponType weaponType = VariationWeaponType.valueOf(weaponTypeString);
final int order = parseInteger(groupNode.getAttributes(), "order");
final List<OptionDataCategory> sets = new ArrayList<>();
forEach(groupNode, "optionCategory", categoryNode ->
final double chance = parseDouble(categoryNode.getAttributes(), "chance");
final Map<Options, Double> options = new HashMap<>();
forEach(categoryNode, "option", optionNode ->
{
final double chance = parseDouble(categoryNode.getAttributes(), "chance");
final Map<Options, Double> options = new HashMap<>();
forEach(categoryNode, "option", optionNode ->
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
final int optionId = parseInteger(optionNode.getAttributes(), "id");
final Options opt = OptionData.getInstance().getOptions(optionId);
if (opt == null)
{
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
final int optionId = parseInteger(optionNode.getAttributes(), "id");
final Options opt = OptionData.getInstance().getOptions(optionId);
if (opt == null)
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + optionId);
return;
}
options.put(opt, optionChance);
});
forEach(categoryNode, "optionRange", optionNode ->
{
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
final int fromId = parseInteger(optionNode.getAttributes(), "from");
final int toId = parseInteger(optionNode.getAttributes(), "to");
for (int id = fromId; id <= toId; id++)
{
final Options op = OptionData.getInstance().getOptions(id);
if (op == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + optionId);
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + id);
return;
}
options.put(opt, optionChance);
});
forEach(categoryNode, "optionRange", optionNode ->
{
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
final int fromId = parseInteger(optionNode.getAttributes(), "from");
final int toId = parseInteger(optionNode.getAttributes(), "to");
for (int id = fromId; id <= toId; id++)
{
final Options op = OptionData.getInstance().getOptions(id);
if (op == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + id);
return;
}
options.put(op, optionChance);
}
});
sets.add(new OptionDataCategory(options, chance));
options.put(op, optionChance);
}
});
variation.setEffectGroup(weaponType, order, new OptionDataGroup(sets));
sets.add(new OptionDataCategory(options, chance));
});
_variations.put(mineralId, variation);
variation.setEffectGroup(weaponType, order, new OptionDataGroup(sets));
});
});
_variations.put(mineralId, variation);
}));
final Map<Integer, List<Integer>> itemGroups = new HashMap<>();
forEach(listNode, "itemGroups", variationsNode ->
forEach(listNode, "itemGroups", variationsNode -> forEach(variationsNode, "itemGroup", variationNode ->
{
forEach(variationsNode, "itemGroup", variationNode ->
final int id = parseInteger(variationNode.getAttributes(), "id");
final List<Integer> items = new ArrayList<>();
forEach(variationNode, "item", itemNode ->
{
final int id = parseInteger(variationNode.getAttributes(), "id");
final List<Integer> items = new ArrayList<>();
forEach(variationNode, "item", itemNode ->
{
final int itemId = parseInteger(itemNode.getAttributes(), "id");
if (ItemTable.getInstance().getTemplate(itemId) == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Item with id " + itemId + " was not found.");
}
items.add(itemId);
});
itemGroups.put(id, items);
});
});
forEach(listNode, "fees", variationNode ->
{
forEach(variationNode, "fee", feeNode ->
{
final int itemGroupId = parseInteger(feeNode.getAttributes(), "itemGroup");
final List<Integer> itemGroup = itemGroups.get(itemGroupId);
final int itemId = parseInteger(feeNode.getAttributes(), "itemId");
final int itemCount = parseInteger(feeNode.getAttributes(), "itemCount");
final int cancelFee = parseInteger(feeNode.getAttributes(), "cancelFee");
final int itemId = parseInteger(itemNode.getAttributes(), "id");
if (ItemTable.getInstance().getTemplate(itemId) == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Item with id " + itemId + " was not found.");
}
final VariationFee fee = new VariationFee(itemId, itemCount, cancelFee);
final Map<Integer, VariationFee> feeByMinerals = new HashMap<>();
forEach(feeNode, "mineral", mineralNode ->
items.add(itemId);
});
itemGroups.put(id, items);
}));
forEach(listNode, "fees", variationNode -> forEach(variationNode, "fee", feeNode ->
{
final int itemGroupId = parseInteger(feeNode.getAttributes(), "itemGroup");
final List<Integer> itemGroup = itemGroups.get(itemGroupId);
final int itemId = parseInteger(feeNode.getAttributes(), "itemId");
final int itemCount = parseInteger(feeNode.getAttributes(), "itemCount");
final int cancelFee = parseInteger(feeNode.getAttributes(), "cancelFee");
if (ItemTable.getInstance().getTemplate(itemId) == null)
{
LOGGER.warning(getClass().getSimpleName() + ": Item with id " + itemId + " was not found.");
}
final VariationFee fee = new VariationFee(itemId, itemCount, cancelFee);
final Map<Integer, VariationFee> feeByMinerals = new HashMap<>();
forEach(feeNode, "mineral", mineralNode ->
{
final int mId = parseInteger(mineralNode.getAttributes(), "id");
feeByMinerals.put(mId, fee);
});
forEach(feeNode, "mineralRange", mineralNode ->
{
final int fromId = parseInteger(mineralNode.getAttributes(), "from");
final int toId = parseInteger(mineralNode.getAttributes(), "to");
for (int id = fromId; id <= toId; id++)
{
final int mId = parseInteger(mineralNode.getAttributes(), "id");
feeByMinerals.put(mId, fee);
});
forEach(feeNode, "mineralRange", mineralNode ->
{
final int fromId = parseInteger(mineralNode.getAttributes(), "from");
final int toId = parseInteger(mineralNode.getAttributes(), "to");
for (int id = fromId; id <= toId; id++)
{
feeByMinerals.put(id, fee);
}
});
for (int item : itemGroup)
{
Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
fees.putAll(feeByMinerals);
feeByMinerals.put(id, fee);
}
});
});
for (int item : itemGroup)
{
Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
fees.putAll(feeByMinerals);
}
}));
});
}

View File

@ -25,6 +25,7 @@ import java.sql.Statement;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -133,6 +134,7 @@ public class BotReportTable
}
catch (Exception e)
{
// Ignore.
}
while (rset.next())
@ -348,11 +350,12 @@ public class BotReportTable
punishBot(bot, _punishments.get(rcd.getReportCount()));
// Range punishments
for (int key : _punishments.keySet())
for (Entry<Integer, PunishHolder> entry : _punishments.entrySet())
{
final int key = entry.getKey();
if ((key < 0) && (Math.abs(key) <= rcd.getReportCount()))
{
punishBot(bot, _punishments.get(key));
punishBot(bot, entry.getValue());
}
}
}
@ -590,7 +593,7 @@ public class BotReportTable
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem with BotReportTable: " + e.getMessage());
}
addPunishment(reportCount, skillId, skillLevel, sysMessage);
@ -612,10 +615,6 @@ public class BotReportTable
private class ResetPointTask implements Runnable
{
public ResetPointTask()
{
}
@Override
public void run()
{

View File

@ -139,7 +139,6 @@ import org.l2jmobius.gameserver.model.items.Item;
import org.l2jmobius.gameserver.model.items.type.ArmorType;
import org.l2jmobius.gameserver.model.items.type.WeaponType;
import org.l2jmobius.gameserver.model.skills.AbnormalType;
import org.l2jmobius.gameserver.model.skills.EffectScope;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.model.stats.Stats;
import org.l2jmobius.gameserver.model.stats.functions.FuncTemplate;
@ -196,11 +195,6 @@ public abstract class DocumentBase
}
protected void parseTemplate(Node n, Object template)
{
parseTemplate(n, template, null);
}
protected void parseTemplate(Node n, Object template, EffectScope effectScope)
{
Condition condition = null;
n = n.getFirstChild();

View File

@ -43,7 +43,7 @@ import org.l2jmobius.gameserver.model.stats.functions.FuncTemplate;
*/
public class DocumentItem extends DocumentBase implements IXmlReader
{
Logger LOGGER = Logger.getLogger(DocumentItem.class.getName());
private static final Logger LOGGER = Logger.getLogger(DocumentItem.class.getName());
private ItemDataHolder _currentItem = null;
private final List<Item> _itemsInFile = new ArrayList<>();

View File

@ -189,7 +189,6 @@ public class GeoEngine
// an error occured while loading, load null blocks
LOGGER.warning("GeoEngine: Error while loading " + filename + " region file.");
LOGGER.warning(e.getMessage());
e.printStackTrace();
// replace whole region file with null blocks
loadNullBlocks(regionX, regionY);

View File

@ -16,7 +16,7 @@
*/
package org.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import org.l2jmobius.gameserver.enums.InstanceType;
@ -35,7 +35,7 @@ public class ActionHandler implements IHandler<IActionHandler, InstanceType>
protected ActionHandler()
{
_actions = new HashMap<>();
_actions = new EnumMap<>(InstanceType.class);
}
@Override

View File

@ -16,7 +16,7 @@
*/
package org.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import org.l2jmobius.gameserver.enums.InstanceType;
@ -30,7 +30,7 @@ public class ActionShiftHandler implements IHandler<IActionShiftHandler, Instanc
protected ActionShiftHandler()
{
_actionsShift = new HashMap<>();
_actionsShift = new EnumMap<>(InstanceType.class);
}
@Override

View File

@ -73,7 +73,7 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
String command = adminCommand;
if (adminCommand.contains(" "))
{
command = adminCommand.substring(0, adminCommand.indexOf(" "));
command = adminCommand.substring(0, adminCommand.indexOf(' '));
}
return _datatable.get(command);
}
@ -135,13 +135,10 @@ public class AdminCommandHandler implements IHandler<IAdminCommandHandler, Strin
finally
{
final long runtime = System.currentTimeMillis() - begin;
if (runtime < 5000)
if (runtime > 5000)
{
return;
player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
}
player.sendMessage("The execution of '" + fullCommand + "' took " + TimeAmountInterpreter.consolidateMillis(runtime) + ".");
}
});
}

View File

@ -54,7 +54,7 @@ public class BypassHandler implements IHandler<IBypassHandler, String>
{
if (command.contains(" "))
{
command = command.substring(0, command.indexOf(" "));
command = command.substring(0, command.indexOf(' '));
}
return _datatable.get(command.toLowerCase());
}

View File

@ -16,7 +16,7 @@
*/
package org.l2jmobius.gameserver.handler;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Map;
import org.l2jmobius.gameserver.model.punishment.PunishmentType;
@ -27,7 +27,7 @@ import org.l2jmobius.gameserver.model.punishment.PunishmentType;
*/
public class PunishmentHandler implements IHandler<IPunishmentHandler, PunishmentType>
{
private final Map<PunishmentType, IPunishmentHandler> _handlers = new HashMap<>();
private final Map<PunishmentType, IPunishmentHandler> _handlers = new EnumMap<>(PunishmentType.class);
protected PunishmentHandler()
{

View File

@ -52,7 +52,7 @@ public class VoicedCommandHandler implements IHandler<IVoicedCommandHandler, Str
@Override
public IVoicedCommandHandler getHandler(String voicedCommand)
{
return _datatable.get(voicedCommand.contains(" ") ? voicedCommand.substring(0, voicedCommand.indexOf(" ")) : voicedCommand);
return _datatable.get(voicedCommand.contains(" ") ? voicedCommand.substring(0, voicedCommand.indexOf(' ')) : voicedCommand);
}
@Override

View File

@ -267,6 +267,7 @@ public abstract class IdFactory
}
catch (SQLException e)
{
// Ignore.
}
}

View File

@ -45,17 +45,17 @@ public class StackIDFactory extends IdFactory
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
final Integer[] tmp_obj_ids = extractUsedObjectIDTable();
if (tmp_obj_ids.length > 0)
final Integer[] tmpObjIds = extractUsedObjectIDTable();
if (tmpObjIds.length > 0)
{
_curOID = tmp_obj_ids[tmp_obj_ids.length - 1];
_curOID = tmpObjIds[tmpObjIds.length - 1];
}
LOGGER.info("Max Id = " + _curOID);
int N = tmp_obj_ids.length;
for (int idx = 0; idx < N; idx++)
int n = tmpObjIds.length;
for (int idx = 0; idx < n; idx++)
{
N = insertUntil(tmp_obj_ids, idx, N, con);
n = insertUntil(tmpObjIds, idx, n, con);
}
_curOID++;
@ -68,13 +68,13 @@ public class StackIDFactory extends IdFactory
}
}
private int insertUntil(Integer[] tmp_obj_ids, int idx, int N, Connection con) throws SQLException
private int insertUntil(Integer[] tmpObjIds, int idx, int n, Connection con) throws SQLException
{
final int id = tmp_obj_ids[idx];
final int id = tmpObjIds[idx];
if (id == _tempOID)
{
_tempOID++;
return N;
return n;
}
// check these IDs not present in DB
if (Config.BAD_ID_CHECKING)
@ -100,17 +100,17 @@ public class StackIDFactory extends IdFactory
}
// int hole = id - _curOID;
final int hole = (id - _tempOID) > (N - idx) ? N - idx : id - _tempOID;
final int hole = (id - _tempOID) > (n - idx) ? n - idx : id - _tempOID;
for (int i = 1; i <= hole; i++)
{
_freeOIDStack.push(_tempOID);
_tempOID++;
}
if (hole < (N - idx))
if (hole < (n - idx))
{
_tempOID++;
}
return N - hole;
return n - hole;
}
public static IdFactory getInstance()

View File

@ -190,12 +190,7 @@ public class AirShipManager
public boolean hasAirShip(int ownerId)
{
final AirShipInstance ship = _airShips.get(ownerId);
if ((ship == null) || !(ship.isSpawned() || ship.isTeleporting()))
{
return false;
}
return true;
return (ship != null) && (ship.isSpawned() || ship.isTeleporting());
}
public void registerAirShipTeleportList(int dockId, int locationId, VehiclePathPoint[][] tp, int[] fuelConsumption)

View File

@ -79,12 +79,9 @@ public class AntiFeedManager
return false;
}
if ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()))
if ((Config.ANTIFEED_INTERVAL > 0) && _lastDeathTimes.containsKey(targetPlayer.getObjectId()) && ((System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL))
{
if ((System.currentTimeMillis() - _lastDeathTimes.get(targetPlayer.getObjectId())) < Config.ANTIFEED_INTERVAL)
{
return false;
}
return false;
}
if (Config.ANTIFEED_DUALBOX && (attacker != null))
@ -234,10 +231,7 @@ public class AntiFeedManager
return;
}
_eventIPs.forEach((k, v) ->
{
removeClient(k, client);
});
_eventIPs.forEach((k, v) -> removeClient(k, client));
}
/**

View File

@ -131,6 +131,7 @@ public class BoatManager
}
catch (ArrayIndexOutOfBoundsException e)
{
// Ignore.
}
}

View File

@ -43,7 +43,7 @@ public class CastleManager implements InstanceListManager
private final Map<Integer, Castle> _castles = new ConcurrentSkipListMap<>();
private final Map<Integer, Long> _castleSiegeDate = new ConcurrentHashMap<>();
private static final int _castleCirclets[] =
private static final int[] _castleCirclets =
{
0,
6838,

View File

@ -327,11 +327,11 @@ public class CastleManorManager implements IXmlReader, IStorable
}
// Change next period to current and prepare next period data
final List<SeedProduction> _nextProduction = _productionNext.get(castleId);
final List<CropProcure> _nextProcure = _procureNext.get(castleId);
final List<SeedProduction> nextProduction = _productionNext.get(castleId);
final List<CropProcure> nextProcure = _procureNext.get(castleId);
_production.put(castleId, _nextProduction);
_procure.put(castleId, _nextProcure);
_production.put(castleId, nextProduction);
_procure.put(castleId, nextProcure);
if (castle.getTreasury() < getManorCost(castleId, false))
{
@ -340,14 +340,14 @@ public class CastleManorManager implements IXmlReader, IStorable
}
else
{
final List<SeedProduction> production = new ArrayList<>(_nextProduction);
final List<SeedProduction> production = new ArrayList<>(nextProduction);
for (SeedProduction s : production)
{
s.setAmount(s.getStartAmount());
}
_productionNext.put(castleId, production);
final List<CropProcure> procure = new ArrayList<>(_nextProcure);
final List<CropProcure> procure = new ArrayList<>(nextProcure);
for (CropProcure cr : procure)
{
cr.setAmount(cr.getStartAmount());

View File

@ -397,18 +397,12 @@ public class ClanEntryManager
private void lockPlayer(int playerId)
{
_playerLocked.put(playerId, ThreadPool.schedule(() ->
{
_playerLocked.remove(playerId);
}, LOCK_TIME));
_playerLocked.put(playerId, ThreadPool.schedule(() -> _playerLocked.remove(playerId), LOCK_TIME));
}
private void lockClan(int clanId)
{
_clanLocked.put(clanId, ThreadPool.schedule(() ->
{
_clanLocked.remove(clanId);
}, LOCK_TIME));
_clanLocked.put(clanId, ThreadPool.schedule(() -> _clanLocked.remove(clanId), LOCK_TIME));
}
public static ClanEntryManager getInstance()

View File

@ -23,6 +23,7 @@ import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
@ -400,8 +401,9 @@ public class DBSpawnManager
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
for (Entry<Integer, StatsSet> entry : _storedInfo.entrySet())
{
Integer npcId = entry.getKey();
if (npcId == null)
{
continue;
@ -418,7 +420,7 @@ public class DBSpawnManager
updateStatus(npc, false);
}
final StatsSet info = _storedInfo.get(npcId);
final StatsSet info = entry.getValue();
if (info == null)
{
continue;
@ -452,7 +454,6 @@ public class DBSpawnManager
public String[] getAllNpcsStatus()
{
final String[] msg = new String[(_npcs == null) ? 0 : _npcs.size()];
if (_npcs == null)
{
msg[0] = "None";
@ -460,10 +461,8 @@ public class DBSpawnManager
}
int index = 0;
for (int i : _npcs.keySet())
for (Npc npc : _npcs.values())
{
final Npc npc = _npcs.get(i);
msg[index++] = npc.getName() + ": " + npc.getDBStatus().name();
}
@ -478,7 +477,6 @@ public class DBSpawnManager
public String getNpcsStatus(int npcId)
{
String msg = "NPC Status..." + Config.EOL;
if (_npcs == null)
{
msg += "None";
@ -488,7 +486,6 @@ public class DBSpawnManager
if (_npcs.containsKey(npcId))
{
final Npc npc = _npcs.get(npcId);
msg += npc.getName() + ": " + npc.getDBStatus().name();
}
@ -589,15 +586,11 @@ public class DBSpawnManager
_npcs.clear();
if (_schedules != null)
for (ScheduledFuture<?> shedule : _schedules.values())
{
for (Integer npcId : _schedules.keySet())
{
final ScheduledFuture<?> f = _schedules.get(npcId);
f.cancel(true);
}
_schedules.clear();
shedule.cancel(true);
}
_schedules.clear();
_storedInfo.clear();
_spawns.clear();

View File

@ -179,7 +179,7 @@ public class FakePlayerChatManager implements IXmlReader
final Npc npc = spawn.getLastSpawn();
if (npc != null)
{
player.sendPacket(new CreatureSay(npc, player, fpcName, ChatType.WHISPER, message));
player.sendPacket(new CreatureSay(npc, fpcName, ChatType.WHISPER, message));
}
}
}

View File

@ -140,8 +140,8 @@ public class FortSiegeManager
for (Fort fort : FortManager.getInstance().getForts())
{
final List<FortSiegeSpawn> _commanderSpawns = new CopyOnWriteArrayList<>();
final List<CombatFlag> _flagSpawns = new CopyOnWriteArrayList<>();
final List<FortSiegeSpawn> commanderSpawns = new CopyOnWriteArrayList<>();
final List<CombatFlag> flagSpawns = new CopyOnWriteArrayList<>();
for (int i = 1; i < 5; i++)
{
final String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
@ -159,7 +159,7 @@ public class FortSiegeManager
final int heading = Integer.parseInt(st.nextToken());
final int npc_id = Integer.parseInt(st.nextToken());
_commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
}
catch (Exception e)
{
@ -167,7 +167,7 @@ public class FortSiegeManager
}
}
_commanderSpawnList.put(fort.getResidenceId(), _commanderSpawns);
_commanderSpawnList.put(fort.getResidenceId(), commanderSpawns);
for (int i = 1; i < 4; i++)
{
@ -185,25 +185,25 @@ public class FortSiegeManager
final int z = Integer.parseInt(st.nextToken());
final int flag_id = Integer.parseInt(st.nextToken());
_flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
}
catch (Exception e)
{
LOGGER.warning("Error while loading flag(s) for " + fort.getName() + " fort.");
}
}
_flagList.put(fort.getResidenceId(), _flagSpawns);
_flagList.put(fort.getResidenceId(), flagSpawns);
}
}
public List<FortSiegeSpawn> getCommanderSpawnList(int _fortId)
public List<FortSiegeSpawn> getCommanderSpawnList(int fortId)
{
return _commanderSpawnList.get(_fortId);
return _commanderSpawnList.get(fortId);
}
public List<CombatFlag> getFlagList(int _fortId)
public List<CombatFlag> getFlagList(int fortId)
{
return _flagList.get(_fortId);
return _flagList.get(fortId);
}
public int getAttackerMaxClans()

View File

@ -28,7 +28,7 @@ public class GraciaSeedsManager
{
private static final Logger LOGGER = Logger.getLogger(GraciaSeedsManager.class.getName());
public static String ENERGY_SEEDS = "EnergySeeds";
public static final String ENERGY_SEEDS = "EnergySeeds";
private static final byte SOITYPE = 2;
private static final byte SOATYPE = 3;

View File

@ -246,9 +246,8 @@ public class HandysBlockCheckerManager
* Will change the player from one team to other (if possible) and will send the needed packets
* @param player
* @param arena
* @param team
*/
public void changePlayerToTeam(PlayerInstance player, int arena, int team)
public void changePlayerToTeam(PlayerInstance player, int arena)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arena];

View File

@ -125,15 +125,9 @@ public class ItemsOnGroundManager implements Runnable
_items.add(item);
count++;
// add to ItemsAutoDestroy only items not protected
if (!Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
if (!Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && (dropTime > -1) && (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect())))
{
if (dropTime > -1)
{
if (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect()))
{
ItemsAutoDestroy.getInstance().addItem(item);
}
}
ItemsAutoDestroy.getInstance().addItem(item);
}
}
}

View File

@ -51,8 +51,8 @@ public class MapRegionManager implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(MapRegionManager.class.getName());
private final Map<String, MapRegion> _regions = new HashMap<>();
private final String defaultRespawn = "talking_island_town";
private static final Map<String, MapRegion> REGIONS = new HashMap<>();
private static final String DEFAULT_RESPAWN = "talking_island_town";
protected MapRegionManager()
{
@ -62,9 +62,9 @@ public class MapRegionManager implements IXmlReader
@Override
public void load()
{
_regions.clear();
REGIONS.clear();
parseDatapackDirectory("data/mapregion", false);
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _regions.size() + " map regions.");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + REGIONS.size() + " map regions.");
}
@Override
@ -130,7 +130,7 @@ public class MapRegionManager implements IXmlReader
region.addBannedRace(attrs.getNamedItem("race").getNodeValue(), attrs.getNamedItem("point").getNodeValue());
}
}
_regions.put(name, region);
REGIONS.put(name, region);
}
}
}
@ -144,7 +144,7 @@ public class MapRegionManager implements IXmlReader
*/
public MapRegion getMapRegion(int locX, int locY)
{
for (MapRegion region : _regions.values())
for (MapRegion region : REGIONS.values())
{
if (region.isZoneInRegion(getMapRegionX(locX), getMapRegionY(locY)))
{
@ -340,7 +340,7 @@ public class MapRegionManager implements IXmlReader
// Opposing race check.
if (getMapRegion(creature).getBannedRace().containsKey(creature.getRace()))
{
return _regions.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
return REGIONS.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
}
return getMapRegion(creature).getChaoticSpawnLoc();
}
@ -348,24 +348,18 @@ public class MapRegionManager implements IXmlReader
{
if (player.isFlyingMounted())
{
return _regions.get("union_base_of_kserth").getChaoticSpawnLoc();
return REGIONS.get("union_base_of_kserth").getChaoticSpawnLoc();
}
return _regions.get(defaultRespawn).getChaoticSpawnLoc();
return REGIONS.get(DEFAULT_RESPAWN).getChaoticSpawnLoc();
}
}
// Checking if needed to be respawned in "far" town from the castle;
// Check if player's clan is participating
castle = CastleManager.getInstance().getCastle(player);
if (castle != null)
if ((castle != null) && castle.getSiege().isInProgress() && (castle.getSiege().checkIsDefender(player.getClan()) || castle.getSiege().checkIsAttacker(player.getClan())))
{
if (castle.getSiege().isInProgress())
{
// Check if player's clan is participating
if ((castle.getSiege().checkIsDefender(player.getClan()) || castle.getSiege().checkIsAttacker(player.getClan())))
{
return castle.getResidenceZone().getOtherSpawnLoc();
}
}
return castle.getResidenceZone().getOtherSpawnLoc();
}
// Checking if in an instance
@ -403,14 +397,14 @@ public class MapRegionManager implements IXmlReader
// Opposing race check.
if (getMapRegion(creature).getBannedRace().containsKey(creature.getRace()))
{
return _regions.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
return REGIONS.get(getMapRegion(creature).getBannedRace().get(creature.getRace())).getChaoticSpawnLoc();
}
return getMapRegion(creature).getSpawnLoc();
}
catch (Exception e)
{
// Port to the default respawn if no closest town found.
return _regions.get(defaultRespawn).getSpawnLoc();
return REGIONS.get(DEFAULT_RESPAWN).getSpawnLoc();
}
}
@ -424,7 +418,7 @@ public class MapRegionManager implements IXmlReader
try
{
final PlayerInstance player = (PlayerInstance) creature;
final MapRegion region = _regions.get(point);
final MapRegion region = REGIONS.get(point);
if (region.getBannedRace().containsKey(player.getRace()))
{
@ -434,7 +428,7 @@ public class MapRegionManager implements IXmlReader
}
catch (Exception e)
{
return _regions.get(defaultRespawn);
return REGIONS.get(DEFAULT_RESPAWN);
}
}
@ -444,13 +438,13 @@ public class MapRegionManager implements IXmlReader
*/
public MapRegion getMapRegionByName(String regionName)
{
return _regions.get(regionName);
return REGIONS.get(regionName);
}
public int getBBs(ILocational loc)
{
final MapRegion region = getMapRegion(loc.getX(), loc.getY());
return region != null ? region.getBbs() : _regions.get(defaultRespawn).getBbs();
return region != null ? region.getBbs() : REGIONS.get(DEFAULT_RESPAWN).getBbs();
}
/**

View File

@ -35,7 +35,7 @@ import org.l2jmobius.gameserver.model.matching.MatchingRoom;
*/
public class MatchingRoomManager
{
private volatile Set<PlayerInstance> _waitingList;
private Set<PlayerInstance> _waitingList;
private static final Map<MatchingRoomType, Map<Integer, MatchingRoom>> _rooms = new ConcurrentHashMap<>(2);

View File

@ -241,11 +241,8 @@ public class MentorManager
{
if (men.isOnline() && (men.getObjectId() != menteeId))
{
if (isAllMenteesOffline)
{
isAllMenteesOffline = false;
break;
}
isAllMenteesOffline = false;
break;
}
}
return isAllMenteesOffline;

View File

@ -25,6 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.logging.Logger;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.database.DatabaseFactory;
@ -42,7 +43,8 @@ import org.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
*/
public class PremiumManager
{
// SQL Statement
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium WHERE account_name = ?";
private static final String UPDATE_SQL = "REPLACE INTO account_premium (account_name,enddate) VALUE (?,?)";
private static final String DELETE_SQL = "DELETE FROM account_premium WHERE account_name = ?";
@ -72,7 +74,7 @@ public class PremiumManager
// Listeners
private final ListenersContainer listenerContainer = Containers.Players();
private final Consumer<OnPlayerLogin> playerLoginEvent = (event) ->
private final Consumer<OnPlayerLogin> playerLoginEvent = event ->
{
final PlayerInstance player = event.getPlayer();
final String accountName = player.getAccountName();
@ -91,7 +93,7 @@ public class PremiumManager
}
};
private final Consumer<OnPlayerLogout> playerLogoutEvent = (event) ->
private final Consumer<OnPlayerLogout> playerLogoutEvent = event ->
{
PlayerInstance player = event.getPlayer();
stopExpireTask(player);
@ -142,7 +144,7 @@ public class PremiumManager
}
catch (SQLException e)
{
e.printStackTrace();
LOGGER.warning("Problem with PremiumManager: " + e.getMessage());
}
}
@ -169,7 +171,7 @@ public class PremiumManager
}
catch (SQLException e)
{
e.printStackTrace();
LOGGER.warning("Problem with PremiumManager: " + e.getMessage());
}
// UPDATE CACHE
@ -213,7 +215,7 @@ public class PremiumManager
}
catch (SQLException e)
{
e.printStackTrace();
LOGGER.warning("Problem with PremiumManager: " + e.getMessage());
}
}

View File

@ -50,7 +50,7 @@ public class SellBuffsManager implements IXmlReader
{
private static final Logger LOGGER = Logger.getLogger(SellBuffsManager.class.getName());
private static final List<Integer> ALLOWED_BUFFS = new ArrayList<>();
private static final String htmlFolder = "data/html/mods/SellBuffs/";
private static final String HTML_FOLDER = "data/html/mods/SellBuffs/";
protected SellBuffsManager()
{
@ -86,20 +86,20 @@ public class SellBuffsManager implements IXmlReader
public void sendSellMenu(PlayerInstance player)
{
final String html = HtmCache.getInstance().getHtm(player, htmlFolder + (player.isSellingBuffs() ? "BuffMenu_already.html" : "BuffMenu.html"));
final String html = HtmCache.getInstance().getHtm(player, HTML_FOLDER + (player.isSellingBuffs() ? "BuffMenu_already.html" : "BuffMenu.html"));
CommunityBoardHandler.separateAndSend(html, player);
}
public void sendBuffChoiceMenu(PlayerInstance player, int index)
{
String html = HtmCache.getInstance().getHtm(player, htmlFolder + "BuffChoice.html");
String html = HtmCache.getInstance().getHtm(player, HTML_FOLDER + "BuffChoice.html");
html = html.replace("%list%", buildSkillMenu(player, index));
CommunityBoardHandler.separateAndSend(html, player);
}
public void sendBuffEditMenu(PlayerInstance player)
{
String html = HtmCache.getInstance().getHtm(player, htmlFolder + "BuffChoice.html");
String html = HtmCache.getInstance().getHtm(player, HTML_FOLDER + "BuffChoice.html");
html = html.replace("%list%", buildEditMenu(player));
CommunityBoardHandler.separateAndSend(html, player);
}
@ -111,8 +111,8 @@ public class SellBuffsManager implements IXmlReader
return;
}
String html = HtmCache.getInstance().getHtm(player, htmlFolder + "BuffBuyMenu.html");
html = html.replace("%list%", buildBuffMenu(player, seller, index));
String html = HtmCache.getInstance().getHtm(player, HTML_FOLDER + "BuffBuyMenu.html");
html = html.replace("%list%", buildBuffMenu(seller, index));
CommunityBoardHandler.separateAndSend(html, player);
}
@ -137,7 +137,7 @@ public class SellBuffsManager implements IXmlReader
sendSellMenu(player);
}
private String buildBuffMenu(PlayerInstance player, PlayerInstance seller, int index)
private String buildBuffMenu(PlayerInstance seller, int index)
{
final int ceiling = 10;
int nextIndex = -1;
@ -156,12 +156,9 @@ public class SellBuffsManager implements IXmlReader
}
}
if (count > 10)
if ((count > 10) && (count > (index + 10)))
{
if (count > (index + 10))
{
nextIndex = index + 10;
}
nextIndex = index + 10;
}
if (index >= 10)
@ -318,12 +315,9 @@ public class SellBuffsManager implements IXmlReader
}
}
if (count > 10)
if ((count > 10) && (count > (index + 10)))
{
if (count > (index + 10))
{
nextIndex = index + 10;
}
nextIndex = index + 10;
}
if (index >= 10)

View File

@ -208,7 +208,7 @@ public class WalkingManager implements IXmlReader
}
}
}
_routes.put(routeName, new WalkRoute(routeName, list, repeat, false, repeatType));
_routes.put(routeName, new WalkRoute(routeName, list, repeat, repeatType));
}
}
}

View File

@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.model.Location;
@ -29,7 +30,7 @@ import org.l2jmobius.gameserver.util.Util;
*/
public class WarpedSpaceManager
{
private volatile ConcurrentHashMap<Creature, WarpedSpaceHolder> _warpedSpace = null;
private Map<Creature, WarpedSpaceHolder> _warpedSpace = null;
public void addWarpedSpace(Creature creature, int radius)
{

View File

@ -199,15 +199,6 @@ public abstract class AbstractPlayerGroup
{
return true;
}
if (obj instanceof AbstractPlayerGroup)
{
if (getLeaderObjectId() == ((AbstractPlayerGroup) obj).getLeaderObjectId())
{
return true;
}
}
return false;
return (obj instanceof AbstractPlayerGroup) && (getLeaderObjectId() == ((AbstractPlayerGroup) obj).getLeaderObjectId());
}
}

View File

@ -155,7 +155,7 @@ public class ArenaParticipantsHolder
{
continue;
}
HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena, 1);
HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena);
}
}
else if (blueSize > (redSize + 1))
@ -169,7 +169,7 @@ public class ArenaParticipantsHolder
{
continue;
}
HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena, 0);
HandysBlockCheckerManager.getInstance().changePlayerToTeam(plr, _arena);
}
}
}

View File

@ -162,12 +162,12 @@ public class ArmorSet
}
/**
* @param shield_id
* @param shieldId
* @return {@code true} if player has the shield of this set equipped, {@code false} in case set doesn't have a shield or player doesn't
*/
public boolean containOptionalItem(int shield_id)
public boolean containOptionalItem(int shieldId)
{
return _optionalItems.contains(shield_id);
return _optionalItems.contains(shieldId);
}
/**
@ -187,12 +187,9 @@ public class ArmorSet
for (int armorSlot : ARMORSET_SLOTS)
{
final ItemInstance itemPart = inv.getPaperdollItem(armorSlot);
if ((itemPart != null) && _requiredItems.contains(itemPart.getId()))
if ((itemPart != null) && _requiredItems.contains(itemPart.getId()) && (enchantLevel > itemPart.getEnchantLevel()))
{
if (enchantLevel > itemPart.getEnchantLevel())
{
enchantLevel = itemPart.getEnchantLevel();
}
enchantLevel = itemPart.getEnchantLevel();
}
}
if (enchantLevel == Byte.MAX_VALUE)

View File

@ -68,20 +68,20 @@ public class BlockList
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
}
private static List<Integer> loadList(int ObjId)
private static List<Integer> loadList(int objId)
{
final List<Integer> list = new ArrayList<>();
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
statement.setInt(1, objId);
try (ResultSet rset = statement.executeQuery())
{
int friendId;
while (rset.next())
{
friendId = rset.getInt("friendId");
if (friendId == ObjId)
if (friendId == objId)
{
continue;
}
@ -91,7 +91,7 @@ public class BlockList
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Error found in " + ObjId + " FriendList while loading BlockList: " + e.getMessage(), e);
LOGGER.log(Level.WARNING, "Error found in " + objId + " FriendList while loading BlockList: " + e.getMessage(), e);
}
return list;
}

View File

@ -345,9 +345,9 @@ public class CharSelectInfoPackage
return _augmentation;
}
public void setPkKills(int PkKills)
public void setPkKills(int pkKills)
{
_pkKills = PkKills;
_pkKills = pkKills;
}
public int getPkKills()
@ -355,9 +355,9 @@ public class CharSelectInfoPackage
return _pkKills;
}
public void setPvPKills(int PvPKills)
public void setPvPKills(int pvpKills)
{
_pvpKills = PvPKills;
_pvpKills = pvpKills;
}
public int getPvPKills()

View File

@ -37,11 +37,11 @@ public class CombatFlag
@SuppressWarnings("unused")
private final int _fortId;
public CombatFlag(int fort_id, int x, int y, int z, int heading, int item_id)
public CombatFlag(int fortId, int x, int y, int z, int heading, int itemId)
{
_fortId = fort_id;
_fortId = fortId;
_location = new Location(x, y, z, heading);
_itemId = item_id;
_itemId = itemId;
}
public synchronized void spawnMe()

View File

@ -65,17 +65,17 @@ public class EffectList
{
private static final Logger LOGGER = Logger.getLogger(EffectList.class.getName());
/** Queue containing all effects from buffs for this effect list. */
private volatile Queue<BuffInfo> _actives = new ConcurrentLinkedQueue<>();
private final Queue<BuffInfo> _actives = new ConcurrentLinkedQueue<>();
/** List containing all passives for this effect list. They bypass most of the actions and they are not included in most operations. */
private volatile Set<BuffInfo> _passives = ConcurrentHashMap.newKeySet();
private final Set<BuffInfo> _passives = ConcurrentHashMap.newKeySet();
/** List containing all options for this effect list. They bypass most of the actions and they are not included in most operations. */
private volatile Set<BuffInfo> _options = ConcurrentHashMap.newKeySet();
private final Set<BuffInfo> _options = ConcurrentHashMap.newKeySet();
/** Map containing the all stacked effect in progress for each {@code AbnormalType}. */
private volatile Set<AbnormalType> _stackedEffects = EnumSet.noneOf(AbnormalType.class);
private Set<AbnormalType> _stackedEffects = EnumSet.noneOf(AbnormalType.class);
/** Set containing all {@code AbnormalType}s that shouldn't be added to this creature effect list. */
private volatile Set<AbnormalType> _blockedAbnormalTypes = EnumSet.noneOf(AbnormalType.class);
private final Set<AbnormalType> _blockedAbnormalTypes = EnumSet.noneOf(AbnormalType.class);
/** Set containing all abnormal visual effects this creature currently displays. */
private volatile Set<AbnormalVisualEffect> _abnormalVisualEffects = EnumSet.noneOf(AbnormalVisualEffect.class);
private Set<AbnormalVisualEffect> _abnormalVisualEffects = EnumSet.noneOf(AbnormalVisualEffect.class);
/** Short buff skill ID. */
private BuffInfo _shortBuff = null;
/** Count of specific types of buffs. */
@ -556,6 +556,7 @@ public class EffectList
{
return true;
}
break;
}
case DANCE:
{
@ -563,6 +564,7 @@ public class EffectList
{
return true;
}
break;
}
// case TOGGLE: Do toggles have limit?
case DEBUFF:
@ -571,6 +573,7 @@ public class EffectList
{
return true;
}
break;
}
case BUFF:
{
@ -578,6 +581,7 @@ public class EffectList
{
return true;
}
break;
}
}
}
@ -809,12 +813,9 @@ public class EffectList
if (skill.isTriggeredSkill())
{
final BuffInfo triggerInfo = info.getEffected().getEffectList().getBuffInfoBySkillId(skill.getId());
if (triggerInfo != null)
if ((triggerInfo != null) && (triggerInfo.getSkill().getLevel() >= skill.getLevel()))
{
if (triggerInfo.getSkill().getLevel() >= skill.getLevel())
{
return;
}
return;
}
}
@ -853,12 +854,10 @@ public class EffectList
if ((skill.getAbnormalType().isNone() && (existingSkill.getId() == skill.getId())) || (!skill.getAbnormalType().isNone() && (existingSkill.getAbnormalType() == skill.getAbnormalType())))
{
// Check if there is subordination abnormal. Skills with subordination abnormal stack with each other, unless the caster is the same.
if (!skill.getSubordinationAbnormalType().isNone() && (skill.getSubordinationAbnormalType() == existingSkill.getSubordinationAbnormalType()))
if (!skill.getSubordinationAbnormalType().isNone() && (skill.getSubordinationAbnormalType() == existingSkill.getSubordinationAbnormalType()) //
&& ((info.getEffectorObjectId() == 0) || (existingInfo.getEffectorObjectId() == 0) || (info.getEffectorObjectId() != existingInfo.getEffectorObjectId())))
{
if ((info.getEffectorObjectId() == 0) || (existingInfo.getEffectorObjectId() == 0) || (info.getEffectorObjectId() != existingInfo.getEffectorObjectId()))
{
continue;
}
continue;
}
// The effect we are adding overrides the existing effect. Delete or disable the existing effect.

View File

@ -28,11 +28,11 @@ public class FortSiegeSpawn extends Location implements IIdentifiable
private final int _fortId;
private final int _id;
public FortSiegeSpawn(int fort_id, int x, int y, int z, int heading, int npc_id, int id)
public FortSiegeSpawn(int fortId, int x, int y, int z, int heading, int npcId, int id)
{
super(x, y, z, heading);
_fortId = fort_id;
_npcId = npc_id;
_fortId = fortId;
_npcId = npcId;
_id = id;
}

View File

@ -30,7 +30,7 @@ public class GroupSpawn extends Spawn
{
private final NpcTemplate _template;
public GroupSpawn(NpcTemplate mobTemplate) throws SecurityException, ClassNotFoundException, NoSuchMethodException
public GroupSpawn(NpcTemplate mobTemplate) throws ClassNotFoundException, NoSuchMethodException
{
super(mobTemplate);
_template = mobTemplate;

View File

@ -149,7 +149,7 @@ public class Location implements IPositionable
@Override
public boolean equals(Object obj)
{
if ((obj != null) && (obj instanceof Location))
if (obj instanceof Location)
{
final Location loc = (Location) obj;
return (getX() == loc.getX()) && (getY() == loc.getY()) && (getZ() == loc.getZ()) && (getHeading() == loc.getHeading());

View File

@ -17,7 +17,7 @@
package org.l2jmobius.gameserver.model;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
@ -41,7 +41,7 @@ public class MapRegion
private List<Location> _chaoticSpawnLocs = null;
private List<Location> _banishSpawnLocs = null;
private final Map<Race, String> _bannedRace = new HashMap<>();
private final Map<Race, String> _bannedRace = new EnumMap<>(Race.class);
public MapRegion(String name, String town, int locId, int bbs)
{

View File

@ -88,24 +88,18 @@ public class Mentee
public int getClassId()
{
if (isOnline())
if (isOnline() && (getPlayerInstance().getClassId().getId() != _classId))
{
if (getPlayerInstance().getClassId().getId() != _classId)
{
_classId = getPlayerInstance().getClassId().getId();
}
_classId = getPlayerInstance().getClassId().getId();
}
return _classId;
}
public int getLevel()
{
if (isOnline())
if (isOnline() && (getPlayerInstance().getLevel() != _currentLevel))
{
if (getPlayerInstance().getLevel() != _currentLevel)
{
_currentLevel = getPlayerInstance().getLevel();
}
_currentLevel = getPlayerInstance().getLevel();
}
return _currentLevel;
}

View File

@ -136,7 +136,7 @@ public class MobGroup
public void spawnGroup(int x, int y, int z)
{
if (getMobs().size() > 0)
if (!getMobs().isEmpty())
{
return;
}
@ -198,7 +198,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return null;
}
@ -218,7 +218,7 @@ public class MobGroup
{
removeDead();
if (getMobs().size() == 0)
if (getMobs().isEmpty())
{
return;
}

View File

@ -89,10 +89,10 @@ public class Party extends AbstractPlayerGroup
private boolean _pendingInvitation = false;
private long _pendingInviteTimeout;
private int _partyLvl = 0;
private volatile PartyDistributionType _distributionType = PartyDistributionType.FINDERS_KEEPERS;
private volatile PartyDistributionType _changeRequestDistributionType;
private volatile Future<?> _changeDistributionTypeRequestTask = null;
private volatile Set<Integer> _changeDistributionTypeAnswers = null;
private PartyDistributionType _distributionType = PartyDistributionType.FINDERS_KEEPERS;
private PartyDistributionType _changeRequestDistributionType;
private Future<?> _changeDistributionTypeRequestTask = null;
private Set<Integer> _changeDistributionTypeAnswers = null;
private int _itemLastLoot = 0;
private CommandChannel _commandChannel = null;
private Future<?> _positionBroadcastTask = null;
@ -183,11 +183,11 @@ public class Party extends AbstractPlayerGroup
/**
* get next item looter
* @param ItemId
* @param itemId
* @param target
* @return
*/
private PlayerInstance getCheckedNextLooter(int ItemId, Creature target)
private PlayerInstance getCheckedNextLooter(int itemId, Creature target)
{
for (int i = 0; i < getMemberCount(); i++)
{
@ -199,7 +199,7 @@ public class Party extends AbstractPlayerGroup
try
{
member = _members.get(_itemLastLoot);
if (member.getInventory().validateCapacityByItemId(ItemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE, target, member, true))
if (member.getInventory().validateCapacityByItemId(itemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE, target, member, true))
{
return member;
}
@ -216,12 +216,12 @@ public class Party extends AbstractPlayerGroup
/**
* get next item looter
* @param player
* @param ItemId
* @param itemId
* @param spoil
* @param target
* @return
*/
private PlayerInstance getActualLooter(PlayerInstance player, int ItemId, boolean spoil, Creature target)
private PlayerInstance getActualLooter(PlayerInstance player, int itemId, boolean spoil, Creature target)
{
PlayerInstance looter = null;
@ -231,26 +231,26 @@ public class Party extends AbstractPlayerGroup
{
if (!spoil)
{
looter = getCheckedRandomMember(ItemId, target);
looter = getCheckedRandomMember(itemId, target);
}
break;
}
case RANDOM_INCLUDING_SPOIL:
{
looter = getCheckedRandomMember(ItemId, target);
looter = getCheckedRandomMember(itemId, target);
break;
}
case BY_TURN:
{
if (!spoil)
{
looter = getCheckedNextLooter(ItemId, target);
looter = getCheckedNextLooter(itemId, target);
}
break;
}
case BY_TURN_INCLUDING_SPOIL:
{
looter = getCheckedNextLooter(ItemId, target);
looter = getCheckedNextLooter(itemId, target);
break;
}
}
@ -516,13 +516,10 @@ public class Party extends AbstractPlayerGroup
if (_members.contains(player))
{
final boolean isLeader = isLeader(player);
if (!_disbanding)
if (!_disbanding && ((_members.size() == 2) || (isLeader && !Config.ALT_LEAVE_PARTY_LEADER && (type != MessageType.DISCONNECTED))))
{
if ((_members.size() == 2) || (isLeader && !Config.ALT_LEAVE_PARTY_LEADER && (type != MessageType.DISCONNECTED)))
{
disbandParty();
return;
}
disbandParty();
return;
}
_members.remove(player);
@ -636,15 +633,12 @@ public class Party extends AbstractPlayerGroup
public void disbandParty()
{
_disbanding = true;
if (_members != null)
broadcastPacket(new SystemMessage(SystemMessageId.THE_PARTY_HAS_DISPERSED));
for (PlayerInstance member : _members)
{
broadcastPacket(new SystemMessage(SystemMessageId.THE_PARTY_HAS_DISPERSED));
for (PlayerInstance member : _members)
if (member != null)
{
if (member != null)
{
removePartyMember(member, MessageType.NONE);
}
removePartyMember(member, MessageType.NONE);
}
}
World.getInstance().decrementParty();
@ -842,10 +836,9 @@ public class Party extends AbstractPlayerGroup
* @param spReward The SP reward to distribute
* @param rewardedMembers The list of PlayerInstance to reward
* @param topLvl
* @param partyDmg
* @param target
*/
public void distributeXpAndSp(double xpReward, double spReward, List<PlayerInstance> rewardedMembers, int topLvl, long partyDmg, Attackable target)
public void distributeXpAndSp(double xpReward, double spReward, List<PlayerInstance> rewardedMembers, int topLvl, Attackable target)
{
final List<PlayerInstance> validMembers = getValidMembers(rewardedMembers, topLvl);

View File

@ -222,12 +222,9 @@ public class PetData
}
break;
}
else if (temp.getMinLevel() <= petLvl)
else if ((temp.getMinLevel() <= petLvl) && (temp.getSkillLevel() > lvl))
{
if (temp.getSkillLevel() > lvl)
{
lvl = temp.getSkillLevel();
}
lvl = temp.getSkillLevel();
}
}
if (found && (lvl == 0))

View File

@ -125,11 +125,7 @@ public class Radar
return false;
}
final RadarMarker other = (RadarMarker) obj;
if ((_type != other._type) || (_x != other._x) || (_y != other._y) || (_z != other._z))
{
return false;
}
return true;
return (_type == other._type) && (_x == other._x) && (_y == other._y) && (_z == other._z);
}
}
}

View File

@ -123,7 +123,7 @@ public class Request
{
_isRequestor = isRequestor;
_isAnswerer = !isRequestor;
ThreadPool.schedule(() -> clear(), REQUEST_TIMEOUT * 1000);
ThreadPool.schedule(this::clear, REQUEST_TIMEOUT * 1000);
}
/**

View File

@ -119,13 +119,9 @@ public class ShortCuts implements IRestorable
if (old.getType() == ShortcutType.ITEM)
{
final ItemInstance item = _owner.getInventory().getItemByObjectId(old.getId());
if ((item != null) && (item.getItemType() == EtcItemType.SOULSHOT))
if ((item != null) && (item.getItemType() == EtcItemType.SOULSHOT) && _owner.removeAutoSoulShot(item.getId()))
{
if (_owner.removeAutoSoulShot(item.getId()))
{
_owner.sendPacket(new ExAutoSoulShot(item.getId(), false, 0));
}
_owner.sendPacket(new ExAutoSoulShot(item.getId(), false, 0));
}
}

View File

@ -91,12 +91,11 @@ public class Spawn extends Location implements IIdentifiable, INamable
* <li>Create the generic constructor of NpcInstance managed by this Spawn</li>
* </ul>
* @param template The NpcTemplate to link to this Spawn
* @throws SecurityException
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws ClassCastException when template type is not subclass of Npc
*/
public Spawn(NpcTemplate template) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
public Spawn(NpcTemplate template) throws ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, -10000);
// Set the _template of the Spawn
@ -116,12 +115,11 @@ public class Spawn extends Location implements IIdentifiable, INamable
/**
* Creates a new spawn.
* @param npcId the NPC ID
* @throws SecurityException
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws ClassCastException
*/
public Spawn(int npcId) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
public Spawn(int npcId) throws ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, -10000);
_template = Objects.requireNonNull(NpcData.getInstance().getTemplate(npcId), "NpcTemplate not found for NPC ID: " + npcId);

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