Code review Part 5.
This commit is contained in:
@@ -1784,7 +1784,7 @@ public class Config
|
||||
}
|
||||
Arrays.sort(ENCHANT_BLACKLIST);
|
||||
DISABLE_OVER_ENCHANTING = Character.getBoolean("DisableOverEnchanting", true);
|
||||
String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
|
||||
final String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
|
||||
AUGMENTATION_BLACKLIST = new int[array.length];
|
||||
|
||||
for (int i = 0; i < array.length; i++)
|
||||
@@ -3441,11 +3441,11 @@ public class Config
|
||||
NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", "");
|
||||
NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5);
|
||||
NETWORK_REWARD_CHECK_TIME = VoteReward.getInt("NetworkRewardCheckTime", 5);
|
||||
String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
|
||||
String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
|
||||
final String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
|
||||
final String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
|
||||
for (String i : NETWORK_small_reward_splitted_1)
|
||||
{
|
||||
String[] NETWORK_small_reward_splitted_2 = i.split(",");
|
||||
final String[] NETWORK_small_reward_splitted_2 = i.split(",");
|
||||
NETWORK_REWARD.put(Integer.parseInt(NETWORK_small_reward_splitted_2[0]), Integer.parseInt(NETWORK_small_reward_splitted_2[1]));
|
||||
}
|
||||
NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1);
|
||||
@@ -3454,11 +3454,11 @@ public class Config
|
||||
TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", "");
|
||||
TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5);
|
||||
TOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("TopzoneRewardCheckTime", 5);
|
||||
String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
|
||||
String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
|
||||
final String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
|
||||
final String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
|
||||
for (String i : topzone_small_reward_splitted_1)
|
||||
{
|
||||
String[] topzone_small_reward_splitted_2 = i.split(",");
|
||||
final String[] topzone_small_reward_splitted_2 = i.split(",");
|
||||
TOPZONE_REWARD.put(Integer.parseInt(topzone_small_reward_splitted_2[0]), Integer.parseInt(topzone_small_reward_splitted_2[1]));
|
||||
}
|
||||
TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1);
|
||||
@@ -3467,11 +3467,11 @@ public class Config
|
||||
HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", "");
|
||||
HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5);
|
||||
HOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("HopzoneRewardCheckTime", 5);
|
||||
String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
|
||||
String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
|
||||
final String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
|
||||
final String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
|
||||
for (String i : hopzone_small_reward_splitted_1)
|
||||
{
|
||||
String[] hopzone_small_reward_splitted_2 = i.split(",");
|
||||
final String[] hopzone_small_reward_splitted_2 = i.split(",");
|
||||
HOPZONE_REWARD.put(Integer.parseInt(hopzone_small_reward_splitted_2[0]), Integer.parseInt(hopzone_small_reward_splitted_2[1]));
|
||||
}
|
||||
HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1);
|
||||
|
@@ -71,7 +71,7 @@ public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
if (maximumLines < 1)
|
||||
{
|
||||
String message = "Maximum lines must be greater than 0";
|
||||
final String message = "Maximum lines must be greater than 0";
|
||||
throw new IllegalArgumentException(message);
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ public class LimitLinesDocumentListener implements DocumentListener
|
||||
private void removeLines(DocumentEvent e)
|
||||
{
|
||||
// The root Element of the Document will tell us the total number of line in the Document.
|
||||
Document document = e.getDocument();
|
||||
Element root = document.getDefaultRootElement();
|
||||
final Document document = e.getDocument();
|
||||
final Element root = document.getDefaultRootElement();
|
||||
|
||||
while (root.getElementCount() > _maximumLines)
|
||||
{
|
||||
@@ -127,8 +127,8 @@ public class LimitLinesDocumentListener implements DocumentListener
|
||||
*/
|
||||
private void removeFromStart(Document document, Element root)
|
||||
{
|
||||
Element line = root.getElement(0);
|
||||
int end = line.getEndOffset();
|
||||
final Element line = root.getElement(0);
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -147,9 +147,9 @@ public class LimitLinesDocumentListener implements DocumentListener
|
||||
{
|
||||
// We use start minus 1 to make sure we remove the newline character of the previous line.
|
||||
|
||||
Element line = root.getElement(root.getElementCount() - 1);
|
||||
int start = line.getStartOffset();
|
||||
int end = line.getEndOffset();
|
||||
final Element line = root.getElement(root.getElementCount() - 1);
|
||||
final int start = line.getStartOffset();
|
||||
final int end = line.getEndOffset();
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -44,7 +44,7 @@ public class SplashScreen extends JWindow
|
||||
{
|
||||
setBackground(new Color(0, 255, 0, 0)); // Transparency.
|
||||
image = Toolkit.getDefaultToolkit().getImage(path);
|
||||
ImageIcon imageIcon = new ImageIcon(image);
|
||||
final ImageIcon imageIcon = new ImageIcon(image);
|
||||
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
|
||||
setLocationRelativeTo(null);
|
||||
setAlwaysOnTop(true);
|
||||
|
@@ -366,8 +366,9 @@ public class RecipeController
|
||||
{
|
||||
Thread.sleep(_delay);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
catch (Exception e)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@@ -120,7 +120,7 @@ public class HtmCache
|
||||
BufferedInputStream bis = new BufferedInputStream(fis))
|
||||
{
|
||||
final int bytes = bis.available();
|
||||
byte[] raw = new byte[bytes];
|
||||
final byte[] raw = new byte[bytes];
|
||||
|
||||
bis.read(raw);
|
||||
content = new String(raw, StandardCharsets.UTF_8);
|
||||
|
@@ -60,7 +60,7 @@ public class OfflineTradersTable
|
||||
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
|
||||
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
|
||||
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
|
||||
PreparedStatement stm_items = con.prepareStatement(SAVE_ITEMS))
|
||||
PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS))
|
||||
{
|
||||
stm1.execute();
|
||||
stm2.execute();
|
||||
@@ -88,12 +88,12 @@ public class OfflineTradersTable
|
||||
title = pc.getBuyList().getTitle();
|
||||
for (TradeItem i : pc.getBuyList().getItems())
|
||||
{
|
||||
stm_items.setInt(1, pc.getObjectId());
|
||||
stm_items.setInt(2, i.getItem().getId());
|
||||
stm_items.setLong(3, i.getCount());
|
||||
stm_items.setLong(4, i.getPrice());
|
||||
stm_items.executeUpdate();
|
||||
stm_items.clearParameters();
|
||||
stmItems.setInt(1, pc.getObjectId());
|
||||
stmItems.setInt(2, i.getItem().getId());
|
||||
stmItems.setLong(3, i.getCount());
|
||||
stmItems.setLong(4, i.getPrice());
|
||||
stmItems.executeUpdate();
|
||||
stmItems.clearParameters();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -109,24 +109,24 @@ public class OfflineTradersTable
|
||||
{
|
||||
for (SellBuffHolder holder : pc.getSellingBuffs())
|
||||
{
|
||||
stm_items.setInt(1, pc.getObjectId());
|
||||
stm_items.setInt(2, holder.getSkillId());
|
||||
stm_items.setLong(3, 0);
|
||||
stm_items.setLong(4, holder.getPrice());
|
||||
stm_items.executeUpdate();
|
||||
stm_items.clearParameters();
|
||||
stmItems.setInt(1, pc.getObjectId());
|
||||
stmItems.setInt(2, holder.getSkillId());
|
||||
stmItems.setLong(3, 0);
|
||||
stmItems.setLong(4, holder.getPrice());
|
||||
stmItems.executeUpdate();
|
||||
stmItems.clearParameters();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TradeItem i : pc.getSellList().getItems())
|
||||
{
|
||||
stm_items.setInt(1, pc.getObjectId());
|
||||
stm_items.setInt(2, i.getObjectId());
|
||||
stm_items.setLong(3, i.getCount());
|
||||
stm_items.setLong(4, i.getPrice());
|
||||
stm_items.executeUpdate();
|
||||
stm_items.clearParameters();
|
||||
stmItems.setInt(1, pc.getObjectId());
|
||||
stmItems.setInt(2, i.getObjectId());
|
||||
stmItems.setLong(3, i.getCount());
|
||||
stmItems.setLong(4, i.getPrice());
|
||||
stmItems.executeUpdate();
|
||||
stmItems.clearParameters();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -140,12 +140,12 @@ public class OfflineTradersTable
|
||||
title = pc.getStoreName();
|
||||
for (ManufactureItem i : pc.getManufactureItems().values())
|
||||
{
|
||||
stm_items.setInt(1, pc.getObjectId());
|
||||
stm_items.setInt(2, i.getRecipeId());
|
||||
stm_items.setLong(3, 0);
|
||||
stm_items.setLong(4, i.getCost());
|
||||
stm_items.executeUpdate();
|
||||
stm_items.clearParameters();
|
||||
stmItems.setInt(1, pc.getObjectId());
|
||||
stmItems.setInt(2, i.getRecipeId());
|
||||
stmItems.setLong(3, 0);
|
||||
stmItems.setLong(4, i.getCost());
|
||||
stmItems.executeUpdate();
|
||||
stmItems.clearParameters();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -231,10 +231,10 @@ public class OfflineTradersTable
|
||||
}
|
||||
|
||||
player.spawnMe(player.getX(), player.getY(), player.getZ());
|
||||
try (PreparedStatement stm_items = con.prepareStatement(LOAD_OFFLINE_ITEMS))
|
||||
try (PreparedStatement stmItems = con.prepareStatement(LOAD_OFFLINE_ITEMS))
|
||||
{
|
||||
stm_items.setInt(1, player.getObjectId());
|
||||
try (ResultSet items = stm_items.executeQuery())
|
||||
stmItems.setInt(1, player.getObjectId());
|
||||
try (ResultSet items = stmItems.executeQuery())
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@@ -93,7 +93,7 @@ public class ItemCrystallizationData implements IXmlReader
|
||||
{
|
||||
if ("item".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
NamedNodeMap attrs = c.getAttributes();
|
||||
final NamedNodeMap attrs = c.getAttributes();
|
||||
final int itemId = parseInteger(attrs, "id");
|
||||
final long itemCount = parseLong(attrs, "count");
|
||||
final double itemChance = parseDouble(attrs, "chance");
|
||||
@@ -117,7 +117,7 @@ public class ItemCrystallizationData implements IXmlReader
|
||||
{
|
||||
if ("item".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
NamedNodeMap attrs = c.getAttributes();
|
||||
final NamedNodeMap attrs = c.getAttributes();
|
||||
final int itemId = parseInteger(attrs, "id");
|
||||
final long itemCount = parseLong(attrs, "count");
|
||||
final double itemChance = parseDouble(attrs, "chance");
|
||||
@@ -154,7 +154,7 @@ public class ItemCrystallizationData implements IXmlReader
|
||||
|
||||
if (chance > 100.)
|
||||
{
|
||||
double countMul = Math.ceil(chance / 100.);
|
||||
final double countMul = Math.ceil(chance / 100.);
|
||||
chance /= countMul;
|
||||
count *= countMul;
|
||||
}
|
||||
|
@@ -175,7 +175,7 @@ public class VariationData implements IXmlReader
|
||||
|
||||
for (int item : itemGroup)
|
||||
{
|
||||
Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
|
||||
final Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
|
||||
fees.putAll(feeByMinerals);
|
||||
}
|
||||
}));
|
||||
@@ -206,8 +206,8 @@ public class VariationData implements IXmlReader
|
||||
|
||||
private VariationInstance generateRandomVariation(Variation variation, VariationWeaponType weaponType)
|
||||
{
|
||||
Options option1 = variation.getRandomEffect(weaponType, 0);
|
||||
Options option2 = variation.getRandomEffect(weaponType, 1);
|
||||
final Options option1 = variation.getRandomEffect(weaponType, 0);
|
||||
final Options option2 = variation.getRandomEffect(weaponType, 1);
|
||||
return ((option1 != null) && (option2 != null)) ? new VariationInstance(variation.getMineralId(), option1, option2) : null;
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ public class VariationData implements IXmlReader
|
||||
|
||||
public boolean hasFeeData(int itemId)
|
||||
{
|
||||
Map<Integer, VariationFee> itemFees = _fees.get(itemId);
|
||||
final Map<Integer, VariationFee> itemFees = _fees.get(itemId);
|
||||
return (itemFees != null) && !itemFees.isEmpty();
|
||||
}
|
||||
|
||||
|
@@ -134,7 +134,7 @@ public class GeoEngine
|
||||
FileChannel fc = raf.getChannel())
|
||||
{
|
||||
// initialize file buffer
|
||||
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
|
||||
final MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
|
||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
// get block indexes
|
||||
@@ -563,7 +563,7 @@ public class GeoEngine
|
||||
dirt = 0;
|
||||
|
||||
// calculate next point coordinates
|
||||
int e2 = 2 * d;
|
||||
final int e2 = 2 * d;
|
||||
if ((e2 > -dy) && (e2 < dx))
|
||||
{
|
||||
// calculate next point XY coordinates
|
||||
@@ -713,7 +713,7 @@ public class GeoEngine
|
||||
}
|
||||
|
||||
// perform geodata check
|
||||
GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instance);
|
||||
final GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instance);
|
||||
return (loc.getGeoX() == gtx) && (loc.getGeoY() == gty);
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ public class GeoEngine
|
||||
direction = 0;
|
||||
|
||||
// calculate next point coordinates
|
||||
int e2 = 2 * d;
|
||||
final int e2 = 2 * d;
|
||||
if ((e2 > -dy) && (e2 < dx))
|
||||
{
|
||||
d -= dy;
|
||||
|
@@ -40,18 +40,18 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
{
|
||||
super();
|
||||
|
||||
String[] array = Config.PATHFIND_BUFFERS.split(";");
|
||||
final String[] array = Config.PATHFIND_BUFFERS.split(";");
|
||||
_buffers = new BufferHolder[array.length];
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < array.length; i++)
|
||||
{
|
||||
String buf = array[i];
|
||||
String[] args = buf.split("x");
|
||||
final String buf = array[i];
|
||||
final String[] args = buf.split("x");
|
||||
|
||||
try
|
||||
{
|
||||
int size = Integer.parseInt(args[1]);
|
||||
final int size = Integer.parseInt(args[1]);
|
||||
count += size;
|
||||
_buffers[i] = new BufferHolder(Integer.parseInt(args[0]), size);
|
||||
}
|
||||
@@ -68,24 +68,24 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
public List<Location> findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance)
|
||||
{
|
||||
// get origin and check existing geo coords
|
||||
int gox = getGeoX(ox);
|
||||
int goy = getGeoY(oy);
|
||||
final int gox = getGeoX(ox);
|
||||
final int goy = getGeoY(oy);
|
||||
if (!hasGeoPos(gox, goy))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
short goz = getHeightNearest(gox, goy, oz);
|
||||
final short goz = getHeightNearest(gox, goy, oz);
|
||||
|
||||
// get target and check existing geo coords
|
||||
int gtx = getGeoX(tx);
|
||||
int gty = getGeoY(ty);
|
||||
final int gtx = getGeoX(tx);
|
||||
final int gty = getGeoY(ty);
|
||||
if (!hasGeoPos(gtx, gty))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
short gtz = getHeightNearest(gtx, gty, tz);
|
||||
final short gtz = getHeightNearest(gtx, gty, tz);
|
||||
|
||||
// Prepare buffer for pathfinding calculations
|
||||
final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))));
|
||||
@@ -98,7 +98,7 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
List<Location> path = null;
|
||||
try
|
||||
{
|
||||
Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
|
||||
final Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
}
|
||||
|
||||
// get path list iterator
|
||||
ListIterator<Location> point = path.listIterator();
|
||||
final ListIterator<Location> point = path.listIterator();
|
||||
|
||||
// get node A (origin)
|
||||
int nodeAx = gox;
|
||||
@@ -139,10 +139,10 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
final GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
|
||||
// check movement from node A to node C
|
||||
GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
|
||||
final GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
|
||||
if ((loc.getGeoX() == nodeC.getGeoX()) && (loc.getGeoY() == nodeC.getGeoY()))
|
||||
{
|
||||
// can move from node A to node C
|
||||
@@ -175,7 +175,7 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
private static List<Location> constructPath(Node target)
|
||||
{
|
||||
// create empty list
|
||||
LinkedList<Location> list = new LinkedList<>();
|
||||
final LinkedList<Location> list = new LinkedList<>();
|
||||
|
||||
// set direction X/Y
|
||||
int dx = 0;
|
||||
|
@@ -86,7 +86,7 @@ public class BlockMultilayer extends ABlock
|
||||
if (format != GeoFormat.L2D)
|
||||
{
|
||||
// get data
|
||||
short data = bb.getShort();
|
||||
final short data = bb.getShort();
|
||||
|
||||
// add nswe and height
|
||||
_temp.put((byte) (data & 0x000F));
|
||||
@@ -453,7 +453,7 @@ public class BlockMultilayer extends ABlock
|
||||
for (int i = 0; i < GeoStructure.BLOCK_CELLS; i++)
|
||||
{
|
||||
// write layers count
|
||||
byte layers = _buffer[index++];
|
||||
final byte layers = _buffer[index++];
|
||||
stream.write(layers);
|
||||
|
||||
// write cell data
|
||||
|
@@ -133,7 +133,7 @@ public class NodeBuffer
|
||||
private final void expand()
|
||||
{
|
||||
// can't move anywhere, don't expand
|
||||
byte nswe = _current.getLoc().getNSWE();
|
||||
final byte nswe = _current.getLoc().getNSWE();
|
||||
if (nswe == 0)
|
||||
{
|
||||
return;
|
||||
@@ -217,7 +217,7 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
// get node
|
||||
Node result = _buffer[ix][iy];
|
||||
final Node result = _buffer[ix][iy];
|
||||
|
||||
// check and update
|
||||
if (result.getLoc() == null)
|
||||
@@ -239,7 +239,7 @@ public class NodeBuffer
|
||||
private final void addNode(int x, int y, short z, int weight)
|
||||
{
|
||||
// get node to be expanded
|
||||
Node node = getNode(x, y, z);
|
||||
final Node node = getNode(x, y, z);
|
||||
if (node == null)
|
||||
{
|
||||
return;
|
||||
|
@@ -403,7 +403,7 @@ public class DBSpawnManager
|
||||
{
|
||||
for (Entry<Integer, StatsSet> entry : _storedInfo.entrySet())
|
||||
{
|
||||
Integer npcId = entry.getKey();
|
||||
final Integer npcId = entry.getKey();
|
||||
if (npcId == null)
|
||||
{
|
||||
continue;
|
||||
|
@@ -95,7 +95,7 @@ public class PremiumManager
|
||||
|
||||
private final Consumer<OnPlayerLogout> playerLogoutEvent = event ->
|
||||
{
|
||||
PlayerInstance player = event.getPlayer();
|
||||
final PlayerInstance player = event.getPlayer();
|
||||
stopExpireTask(player);
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PremiumManager
|
||||
*/
|
||||
private void startExpireTask(PlayerInstance player, long delay)
|
||||
{
|
||||
ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
|
||||
final ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
|
||||
expiretasks.put(player.getAccountName(), task);
|
||||
}
|
||||
|
||||
@@ -155,11 +155,11 @@ public class PremiumManager
|
||||
|
||||
public void addPremiumTime(String accountName, int timeValue, TimeUnit timeUnit)
|
||||
{
|
||||
long addTime = timeUnit.toMillis(timeValue);
|
||||
long now = System.currentTimeMillis();
|
||||
final long addTime = timeUnit.toMillis(timeValue);
|
||||
final long now = System.currentTimeMillis();
|
||||
// new premium task at least from now
|
||||
long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
|
||||
long newPremiumExpiration = oldPremiumExpiration + addTime;
|
||||
final long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
|
||||
final long newPremiumExpiration = oldPremiumExpiration + addTime;
|
||||
|
||||
// UPDATE DATABASE
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
@@ -178,7 +178,7 @@ public class PremiumManager
|
||||
premiumData.put(accountName, newPremiumExpiration);
|
||||
|
||||
// UPDATE PlAYER PREMIUMSTATUS
|
||||
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
|
||||
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
|
||||
if (playerOnline != null)
|
||||
{
|
||||
stopExpireTask(playerOnline);
|
||||
@@ -195,7 +195,7 @@ public class PremiumManager
|
||||
{
|
||||
if (checkOnline)
|
||||
{
|
||||
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
|
||||
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
|
||||
if ((playerOnline != null) && playerOnline.hasPremiumStatus())
|
||||
{
|
||||
playerOnline.setPremiumStatus(false);
|
||||
|
@@ -875,7 +875,7 @@ public class Party extends AbstractPlayerGroup
|
||||
|
||||
// Add the XP/SP points to the requested party member
|
||||
double exp = member.getStat().getValue(Stats.EXPSP_RATE, xpReward * preCalculation);
|
||||
double sp = member.getStat().getValue(Stats.EXPSP_RATE, spReward * preCalculation);
|
||||
final double sp = member.getStat().getValue(Stats.EXPSP_RATE, spReward * preCalculation);
|
||||
|
||||
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
|
||||
if (exp > 0)
|
||||
|
@@ -170,7 +170,7 @@ public class Territory
|
||||
int zmin = _zMin;
|
||||
for (Point p1 : _points)
|
||||
{
|
||||
double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||
final double distance = Math.hypot(p1._x - x, p1._y - y);
|
||||
if ((curdistance == 0) || (distance < curdistance))
|
||||
{
|
||||
curdistance = distance;
|
||||
|
@@ -1249,13 +1249,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
int damage = 0;
|
||||
byte shld = 0;
|
||||
boolean crit = false;
|
||||
boolean miss = Formulas.calcHitMiss(this, target);
|
||||
final boolean miss = Formulas.calcHitMiss(this, target);
|
||||
if (!shotConsumed)
|
||||
{
|
||||
shotConsumed = !miss && unchargeShot(ShotType.SOULSHOTS);
|
||||
}
|
||||
|
||||
int ssGrade = (shotConsumed && (weapon != null)) ? weapon.getItemGrade().ordinal() : 0;
|
||||
final int ssGrade = (shotConsumed && (weapon != null)) ? weapon.getItemGrade().ordinal() : 0;
|
||||
|
||||
// Check if hit isn't missed
|
||||
if (!miss)
|
||||
@@ -2956,7 +2956,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
final int xPrev = getX();
|
||||
final int yPrev = getY();
|
||||
int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
|
||||
final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
|
||||
|
||||
double dx;
|
||||
double dy;
|
||||
@@ -4415,7 +4415,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
int reflectedDamage = 0;
|
||||
|
||||
// Reduce HP of the target and calculate reflection damage to reduce HP of attacker if necessary
|
||||
double reflectPercent = target.getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT, 0) - getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT_DEFENSE, 0);
|
||||
final double reflectPercent = target.getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT, 0) - getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT_DEFENSE, 0);
|
||||
if (reflectPercent > 0)
|
||||
{
|
||||
reflectedDamage = (int) ((reflectPercent / 100.) * damage);
|
||||
|
@@ -698,7 +698,7 @@ public class Npc extends Creature
|
||||
String html = HtmCache.getInstance().getHtm(player, "data/html/" + type + "/" + getId() + "-pk.htm");
|
||||
if (html != null)
|
||||
{
|
||||
html = html.replaceAll("%objectId%", String.valueOf(getObjectId()));
|
||||
html = html.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
player.sendPacket(new NpcHtmlMessage(getObjectId(), html));
|
||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return true;
|
||||
@@ -1551,12 +1551,9 @@ public class Npc extends Creature
|
||||
item.dropMe(this, newX, newY, newZ);
|
||||
|
||||
// Add drop to auto destroy item task.
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId))
|
||||
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId) && (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect())))
|
||||
{
|
||||
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);
|
||||
}
|
||||
item.setProtected(false);
|
||||
|
||||
|
@@ -59,7 +59,7 @@ public class GuardInstance extends Attackable
|
||||
}
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayable())
|
||||
{
|
||||
PlayerInstance player = attacker.getActingPlayer();
|
||||
final PlayerInstance player = attacker.getActingPlayer();
|
||||
if ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)))
|
||||
{
|
||||
return true;
|
||||
|
@@ -465,7 +465,7 @@ public class PlayerInstance extends Playable
|
||||
/** The Raidboss points of this PlayerInstance */
|
||||
private int _raidbossPoints;
|
||||
|
||||
private volatile ScheduledFuture<?> _teleportWatchdog;
|
||||
private ScheduledFuture<?> _teleportWatchdog;
|
||||
|
||||
/** The Siege state of the PlayerInstance */
|
||||
private byte _siegeState = 0;
|
||||
@@ -554,7 +554,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
private TradeList _activeTradeList;
|
||||
private ItemContainer _activeWarehouse;
|
||||
private volatile Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private Map<Integer, ManufactureItem> _manufactureItems;
|
||||
private String _storeName = "";
|
||||
private TradeList _sellList;
|
||||
private TradeList _buyList;
|
||||
@@ -632,7 +632,7 @@ public class PlayerInstance extends Playable
|
||||
private long _clanCreateExpiryTime;
|
||||
|
||||
private int _powerGrade = 0;
|
||||
private volatile EnumIntBitmask<ClanPrivilege> _clanPrivileges = new EnumIntBitmask<>(ClanPrivilege.class, false);
|
||||
private EnumIntBitmask<ClanPrivilege> _clanPrivileges = new EnumIntBitmask<>(ClanPrivilege.class, false);
|
||||
|
||||
/** PlayerInstance's pledge class (knight, Baron, etc.) */
|
||||
private int _pledgeClass = 0;
|
||||
@@ -715,7 +715,7 @@ public class PlayerInstance extends Playable
|
||||
private byte _handysBlockCheckerEventArena = -1;
|
||||
|
||||
/** new race ticket **/
|
||||
private final int _race[] = new int[2];
|
||||
private final int[] _race = new int[2];
|
||||
|
||||
private final BlockList _blockList = new BlockList(this);
|
||||
|
||||
@@ -1029,27 +1029,24 @@ public class PlayerInstance extends Playable
|
||||
result |= RelationChanged.RELATION_ATTACKER;
|
||||
}
|
||||
}
|
||||
if ((clan != null) && (targetClan != null))
|
||||
if ((clan != null) && (targetClan != null) && (target.getPledgeType() != Clan.SUBUNIT_ACADEMY) && (getPledgeType() != Clan.SUBUNIT_ACADEMY))
|
||||
{
|
||||
if ((target.getPledgeType() != Clan.SUBUNIT_ACADEMY) && (getPledgeType() != Clan.SUBUNIT_ACADEMY))
|
||||
final ClanWar war = clan.getWarWith(target.getClan().getId());
|
||||
if (war != null)
|
||||
{
|
||||
ClanWar war = clan.getWarWith(target.getClan().getId());
|
||||
if (war != null)
|
||||
switch (war.getState())
|
||||
{
|
||||
switch (war.getState())
|
||||
case DECLARATION:
|
||||
case BLOOD_DECLARATION:
|
||||
{
|
||||
case DECLARATION:
|
||||
case BLOOD_DECLARATION:
|
||||
{
|
||||
result |= RelationChanged.RELATION_DECLARED_WAR;
|
||||
break;
|
||||
}
|
||||
case MUTUAL:
|
||||
{
|
||||
result |= RelationChanged.RELATION_DECLARED_WAR;
|
||||
result |= RelationChanged.RELATION_MUTUAL_WAR;
|
||||
break;
|
||||
}
|
||||
result |= RelationChanged.RELATION_DECLARED_WAR;
|
||||
break;
|
||||
}
|
||||
case MUTUAL:
|
||||
{
|
||||
result |= RelationChanged.RELATION_DECLARED_WAR;
|
||||
result |= RelationChanged.RELATION_MUTUAL_WAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1493,7 +1490,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
/** List of all QuestState instance that needs to be notified of this PlayerInstance's or its pet's death */
|
||||
private volatile Set<QuestState> _notifyQuestOfDeathList;
|
||||
private Set<QuestState> _notifyQuestOfDeathList;
|
||||
|
||||
/**
|
||||
* Add QuestState instance that is to be notified of PlayerInstance's death.
|
||||
@@ -1651,11 +1648,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean isRegisteredOnThisSiegeField(int val)
|
||||
{
|
||||
if ((_siegeSide != val) && ((_siegeSide < 81) || (_siegeSide > 89)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (_siegeSide != val) && ((_siegeSide < 81) || (_siegeSide > 89));
|
||||
}
|
||||
|
||||
public int getSiegeSide()
|
||||
@@ -2073,7 +2066,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
/**
|
||||
* Update the overloaded status of the PlayerInstance.
|
||||
* @param broadcast TODO
|
||||
* @param broadcast
|
||||
*/
|
||||
public void refreshOverloaded(boolean broadcast)
|
||||
{
|
||||
@@ -2363,9 +2356,9 @@ public class PlayerInstance extends Playable
|
||||
|
||||
/**
|
||||
* Set the template of the PlayerInstance.
|
||||
* @param Id The Identifier of the PlayerTemplate to set to the PlayerInstance
|
||||
* @param id The Identifier of the PlayerTemplate to set to the PlayerInstance
|
||||
*/
|
||||
public void setClassId(int Id)
|
||||
public void setClassId(int id)
|
||||
{
|
||||
if (!_subclassLock.tryLock())
|
||||
{
|
||||
@@ -2374,7 +2367,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
try
|
||||
{
|
||||
if ((getLvlJoinedAcademy() != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, Id))
|
||||
if ((getLvlJoinedAcademy() != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, id))
|
||||
{
|
||||
if (_lvlJoinedAcademy <= 16)
|
||||
{
|
||||
@@ -2402,11 +2395,11 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
if (isSubClassActive())
|
||||
{
|
||||
getSubClasses().get(_classIndex).setClassId(Id);
|
||||
getSubClasses().get(_classIndex).setClassId(id);
|
||||
}
|
||||
setTarget(this);
|
||||
broadcastPacket(new MagicSkillUse(this, 5103, 1, 1000, 0));
|
||||
setClassTemplate(Id);
|
||||
setClassTemplate(id);
|
||||
if (getClassId().level() == 3)
|
||||
{
|
||||
sendPacket(SystemMessageId.CONGRATULATIONS_YOU_VE_COMPLETED_YOUR_THIRD_CLASS_TRANSFER_QUEST);
|
||||
@@ -3300,7 +3293,6 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
CursedWeaponsManager.getInstance().activate(this, newitem);
|
||||
}
|
||||
|
||||
// Combat Flag
|
||||
else if (FortSiegeManager.getInstance().isCombat(item.getId()))
|
||||
{
|
||||
@@ -3744,25 +3736,15 @@ public class PlayerInstance extends Playable
|
||||
|
||||
item.dropMe(this, (getX() + Rnd.get(50)) - 25, (getY() + Rnd.get(50)) - 25, getZ() + 20);
|
||||
|
||||
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
|
||||
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable()))
|
||||
{
|
||||
if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
|
||||
{
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
|
||||
// protection against auto destroy dropped item
|
||||
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
|
||||
{
|
||||
if (!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
|
||||
{
|
||||
item.setProtected(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setProtected(true);
|
||||
}
|
||||
item.setProtected(item.isEquipable() && (!item.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3833,23 +3815,13 @@ public class PlayerInstance extends Playable
|
||||
|
||||
item.dropMe(this, x, y, z);
|
||||
|
||||
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
|
||||
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable()))
|
||||
{
|
||||
if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
|
||||
{
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
}
|
||||
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
|
||||
{
|
||||
if (!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
|
||||
{
|
||||
item.setProtected(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setProtected(true);
|
||||
}
|
||||
item.setProtected(item.isEquipable() && (!item.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4202,7 +4174,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
// Update relation.
|
||||
final int relation = getRelation(player);
|
||||
Integer oldrelation = getKnownRelations().get(player.getObjectId());
|
||||
final Integer oldrelation = getKnownRelations().get(player.getObjectId());
|
||||
if ((oldrelation == null) || (oldrelation != relation))
|
||||
{
|
||||
final RelationChanged rc = new RelationChanged();
|
||||
@@ -4497,12 +4469,9 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// You can pickup only 1 combat flag
|
||||
if (FortSiegeManager.getInstance().isCombat(target.getId()))
|
||||
if (FortSiegeManager.getInstance().isCombat(target.getId()) && !FortSiegeManager.getInstance().checkIfCanPickup(this))
|
||||
{
|
||||
if (!FortSiegeManager.getInstance().checkIfCanPickup(this))
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((target.getItemLootShedule() != null) && ((target.getOwnerId() == getObjectId()) || isInLooterParty(target.getOwnerId())))
|
||||
@@ -4829,20 +4798,13 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
final ItemInstance legs = getLegsArmorInstance();
|
||||
final ItemInstance armor = getChestArmorInstance();
|
||||
|
||||
if ((armor != null) && (legs != null))
|
||||
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.HEAVY) && (armor.getItemType() == ArmorType.HEAVY))
|
||||
{
|
||||
if ((legs.getItemType() == ArmorType.HEAVY) && (armor.getItemType() == ArmorType.HEAVY))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (armor != null)
|
||||
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.HEAVY)))
|
||||
{
|
||||
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.HEAVY)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -4851,20 +4813,13 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
final ItemInstance legs = getLegsArmorInstance();
|
||||
final ItemInstance armor = getChestArmorInstance();
|
||||
|
||||
if ((armor != null) && (legs != null))
|
||||
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.LIGHT) && (armor.getItemType() == ArmorType.LIGHT))
|
||||
{
|
||||
if ((legs.getItemType() == ArmorType.LIGHT) && (armor.getItemType() == ArmorType.LIGHT))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (armor != null)
|
||||
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.LIGHT)))
|
||||
{
|
||||
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.LIGHT)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -4873,20 +4828,13 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
final ItemInstance legs = getLegsArmorInstance();
|
||||
final ItemInstance armor = getChestArmorInstance();
|
||||
|
||||
if ((armor != null) && (legs != null))
|
||||
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.MAGIC) && (armor.getItemType() == ArmorType.MAGIC))
|
||||
{
|
||||
if ((legs.getItemType() == ArmorType.MAGIC) && (armor.getItemType() == ArmorType.MAGIC))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (armor != null)
|
||||
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.MAGIC)))
|
||||
{
|
||||
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.MAGIC)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -5341,29 +5289,29 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public void updatePvPStatus(Creature target)
|
||||
{
|
||||
final PlayerInstance player_target = target.getActingPlayer();
|
||||
if (player_target == null)
|
||||
final PlayerInstance targetPlayer = target.getActingPlayer();
|
||||
if (targetPlayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this == player_target)
|
||||
if (this == targetPlayer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && player_target.isEvil()) || (isEvil() && player_target.isGood())))
|
||||
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && targetPlayer.isEvil()) || (isEvil() && targetPlayer.isGood())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isInDuel && (player_target.getDuelId() == getDuelId()))
|
||||
if (_isInDuel && (targetPlayer.getDuelId() == getDuelId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((!isInsideZone(ZoneId.PVP) || !player_target.isInsideZone(ZoneId.PVP)) && (player_target.getReputation() >= 0))
|
||||
if ((!isInsideZone(ZoneId.PVP) || !targetPlayer.isInsideZone(ZoneId.PVP)) && (targetPlayer.getReputation() >= 0))
|
||||
{
|
||||
if (checkIfPvP(player_target))
|
||||
if (checkIfPvP(targetPlayer))
|
||||
{
|
||||
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
}
|
||||
@@ -5583,12 +5531,9 @@ public class PlayerInstance extends Playable
|
||||
public PlayerInstance getActiveRequester()
|
||||
{
|
||||
final PlayerInstance requester = _activeRequester;
|
||||
if (requester != null)
|
||||
if ((requester != null) && requester.isRequestExpired() && (_activeTradeList == null))
|
||||
{
|
||||
if (requester.isRequestExpired() && (_activeTradeList == null))
|
||||
{
|
||||
_activeRequester = null;
|
||||
}
|
||||
_activeRequester = null;
|
||||
}
|
||||
return _activeRequester;
|
||||
}
|
||||
@@ -5633,7 +5578,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isRequestExpired()
|
||||
{
|
||||
return !(_requestExpireTime > GameTimeController.getInstance().getGameTicks());
|
||||
return _requestExpireTime <= GameTimeController.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6704,16 +6649,13 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Restore Subclass Data (cannot be done earlier in function)
|
||||
if (restoreSubClassData(player))
|
||||
if (restoreSubClassData(player) && (activeClassId != player.getBaseClass()))
|
||||
{
|
||||
if (activeClassId != player.getBaseClass())
|
||||
for (SubClass subClass : player.getSubClasses().values())
|
||||
{
|
||||
for (SubClass subClass : player.getSubClasses().values())
|
||||
if (subClass.getClassId() == activeClassId)
|
||||
{
|
||||
if (subClass.getClassId() == activeClassId)
|
||||
{
|
||||
player.setClassIndex(subClass.getClassIndex());
|
||||
}
|
||||
player.setClassIndex(subClass.getClassIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7297,7 +7239,7 @@ public class PlayerInstance extends Playable
|
||||
delete.execute();
|
||||
}
|
||||
|
||||
int buff_index = 0;
|
||||
int buffIndex = 0;
|
||||
final List<Long> storedSkills = new ArrayList<>();
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
|
||||
@@ -7364,7 +7306,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
|
||||
statement.setInt(9, _classIndex);
|
||||
statement.setInt(10, ++buff_index);
|
||||
statement.setInt(10, ++buffIndex);
|
||||
statement.addBatch();
|
||||
}
|
||||
}
|
||||
@@ -7392,7 +7334,7 @@ public class PlayerInstance extends Playable
|
||||
statement.setDouble(7, t.getStamp());
|
||||
statement.setInt(8, 1); // Restore type 1, skill reuse.
|
||||
statement.setInt(9, _classIndex);
|
||||
statement.setInt(10, ++buff_index);
|
||||
statement.setInt(10, ++buffIndex);
|
||||
statement.addBatch();
|
||||
}
|
||||
}
|
||||
@@ -7666,15 +7608,12 @@ public class PlayerInstance extends Playable
|
||||
// Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
|
||||
addSkill(skill);
|
||||
|
||||
if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
|
||||
if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM) && !SkillTreesData.getInstance().isSkillAllowed(this, skill))
|
||||
{
|
||||
if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
|
||||
Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
|
||||
if (Config.SKILL_CHECK_REMOVE)
|
||||
{
|
||||
Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
|
||||
if (Config.SKILL_CHECK_REMOVE)
|
||||
{
|
||||
removeSkill(skill);
|
||||
}
|
||||
removeSkill(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8268,11 +8207,7 @@ public class PlayerInstance extends Playable
|
||||
// Check if the attacker is in olympia and olympia start
|
||||
if (attacker.isPlayer() && attacker.getActingPlayer().isInOlympiadMode())
|
||||
{
|
||||
if (_inOlympiadMode && _OlympiadStart && (((PlayerInstance) attacker).getOlympiadGameId() == getOlympiadGameId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return _inOlympiadMode && _OlympiadStart && (((PlayerInstance) attacker).getOlympiadGameId() == getOlympiadGameId());
|
||||
}
|
||||
|
||||
if (_isOnCustomEvent && (getTeam() == attacker.getTeam()))
|
||||
@@ -8358,13 +8293,10 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker instanceof DefenderInstance)
|
||||
if ((attacker instanceof DefenderInstance) && (_clan != null))
|
||||
{
|
||||
if (_clan != null)
|
||||
{
|
||||
final Siege siege = SiegeManager.getInstance().getSiege(this);
|
||||
return ((siege != null) && siege.checkIsAttacker(_clan));
|
||||
}
|
||||
final Siege siege = SiegeManager.getInstance().getSiege(this);
|
||||
return ((siege != null) && siege.checkIsAttacker(_clan));
|
||||
}
|
||||
|
||||
if (attacker instanceof GuardInstance)
|
||||
@@ -8570,18 +8502,15 @@ public class PlayerInstance extends Playable
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
// Upon failed conditions, next action is called.
|
||||
if ((skill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this))
|
||||
if ((skill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)))
|
||||
{
|
||||
if ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
if (skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
if (skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target, item, false, false);
|
||||
}
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target, item, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8614,9 +8543,9 @@ public class PlayerInstance extends Playable
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isInLooterParty(int LooterId)
|
||||
public boolean isInLooterParty(int looterId)
|
||||
{
|
||||
final PlayerInstance looter = World.getInstance().getPlayer(LooterId);
|
||||
final PlayerInstance looter = World.getInstance().getPlayer(looterId);
|
||||
|
||||
// if PlayerInstance is in a CommandChannel
|
||||
if (isInParty() && _party.isInCommandChannel() && (looter != null))
|
||||
@@ -9032,9 +8961,9 @@ public class PlayerInstance extends Playable
|
||||
return _apprentice;
|
||||
}
|
||||
|
||||
public void setApprentice(int apprentice_id)
|
||||
public void setApprentice(int apprenticeId)
|
||||
{
|
||||
_apprentice = apprentice_id;
|
||||
_apprentice = apprenticeId;
|
||||
}
|
||||
|
||||
public int getSponsor()
|
||||
@@ -9042,9 +8971,9 @@ public class PlayerInstance extends Playable
|
||||
return _sponsor;
|
||||
}
|
||||
|
||||
public void setSponsor(int sponsor_id)
|
||||
public void setSponsor(int sponsorId)
|
||||
{
|
||||
_sponsor = sponsor_id;
|
||||
_sponsor = sponsorId;
|
||||
}
|
||||
|
||||
public int getBookMarkSlot()
|
||||
@@ -10096,12 +10025,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean isRentedPet()
|
||||
{
|
||||
if (_taskRentPet != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _taskRentPet != null;
|
||||
}
|
||||
|
||||
public void stopWaterTask()
|
||||
@@ -10127,12 +10051,7 @@ public class PlayerInstance extends Playable
|
||||
|
||||
public boolean isInWater()
|
||||
{
|
||||
if (_taskWater != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _taskWater != null;
|
||||
}
|
||||
|
||||
public void checkWaterState()
|
||||
@@ -10558,12 +10477,11 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastSnoop(ChatType type, String name, String _text)
|
||||
public void broadcastSnoop(ChatType type, String name, String text)
|
||||
{
|
||||
if (!_snoopListener.isEmpty())
|
||||
{
|
||||
final Snoop sn = new Snoop(getObjectId(), getName(), type, name, _text);
|
||||
|
||||
final Snoop sn = new Snoop(getObjectId(), getName(), type, name, text);
|
||||
for (PlayerInstance pci : _snoopListener)
|
||||
{
|
||||
if (pci != null)
|
||||
@@ -11811,43 +11729,40 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
Collection<Skill> currentSkills = getAllSkills();
|
||||
|
||||
if (isTransformed())
|
||||
if (isTransformed() && !_transformSkills.isEmpty())
|
||||
{
|
||||
if (!_transformSkills.isEmpty())
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
{
|
||||
// Include transformation skills and those skills that are allowed during transformation.
|
||||
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
|
||||
|
||||
// Revelation skills.
|
||||
if (isDualClassActive())
|
||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
else if (!isSubClassActive())
|
||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
else if (!isSubClassActive())
|
||||
{
|
||||
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, 0);
|
||||
if (revelationSkill != 0)
|
||||
{
|
||||
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
|
||||
}
|
||||
}
|
||||
// Include transformation skills.
|
||||
currentSkills.addAll(_transformSkills.values());
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
@@ -12312,6 +12227,11 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<TeleportBookmark> getTeleportBookmarks()
|
||||
{
|
||||
return _tpbookmarks.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendInfo(PlayerInstance player)
|
||||
{
|
||||
@@ -12945,19 +12865,6 @@ public class PlayerInstance extends Playable
|
||||
return _multiSocialTarget;
|
||||
}
|
||||
|
||||
public Collection<TeleportBookmark> getTeleportBookmarks()
|
||||
{
|
||||
return _tpbookmarks.values();
|
||||
}
|
||||
|
||||
public int getBookmarkslot()
|
||||
{
|
||||
return _bookmarkslot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getQuestInventoryLimit()
|
||||
{
|
||||
return Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
|
||||
|
@@ -49,7 +49,7 @@ public class PetStat extends SummonStat
|
||||
return false;
|
||||
}
|
||||
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
|
||||
sm.addLong(finalExp);
|
||||
getActiveChar().updateAndBroadcastStatus(1);
|
||||
getActiveChar().sendPacket(sm);
|
||||
|
@@ -140,7 +140,7 @@ public enum ClassId implements IIdentifiable
|
||||
|
||||
FORTUNE_SEEKER(117, false, Race.DWARF, BOUNTY_HUNTER),
|
||||
MAESTRO(118, false, Race.DWARF, WARSMITH),
|
||||
|
||||
|
||||
MALE_SOLDIER(123, false, Race.KAMAEL, null),
|
||||
FEMALE_SOLDIER(124, false, Race.KAMAEL, null),
|
||||
TROOPER(125, false, Race.KAMAEL, MALE_SOLDIER),
|
||||
@@ -155,7 +155,7 @@ public enum ClassId implements IIdentifiable
|
||||
TRICKSTER(134, false, Race.KAMAEL, ARBALESTER),
|
||||
INSPECTOR(135, false, Race.KAMAEL, WARDER),
|
||||
JUDICATOR(136, false, Race.KAMAEL, INSPECTOR),
|
||||
|
||||
|
||||
SIGEL_KNIGHT(139, false, null, null),
|
||||
TYRR_WARRIOR(140, false, null, null),
|
||||
OTHELL_ROGUE(141, false, null, null),
|
||||
@@ -164,7 +164,7 @@ public enum ClassId implements IIdentifiable
|
||||
ISS_ENCHANTER(144, false, null, null),
|
||||
WYNN_SUMMONER(145, false, null, null),
|
||||
AEORE_HEALER(146, false, null, null),
|
||||
|
||||
|
||||
SIGEL_PHOENIX_KNIGHT(148, false, Race.HUMAN, PHOENIX_KNIGHT),
|
||||
SIGEL_HELL_KNIGHT(149, false, Race.HUMAN, HELL_KNIGHT),
|
||||
SIGEL_EVA_TEMPLAR(150, false, Race.ELF, EVA_TEMPLAR),
|
||||
|
@@ -70,8 +70,8 @@ public class ProductList
|
||||
return (_allowedNpcs != null) && _allowedNpcs.contains(npcId);
|
||||
}
|
||||
|
||||
//public Set<Integer> getNpcsAllowed()
|
||||
//{
|
||||
// return _allowedNpcs;
|
||||
//}
|
||||
// public Set<Integer> getNpcsAllowed()
|
||||
// {
|
||||
// return _allowedNpcs;
|
||||
// }
|
||||
}
|
||||
|
@@ -998,7 +998,7 @@ public class Duel
|
||||
|
||||
if (_partyDuel)
|
||||
{
|
||||
boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
|
||||
final boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
|
||||
|
||||
if (teamdefeated)
|
||||
{
|
||||
|
@@ -382,13 +382,13 @@ public class Fishing
|
||||
// calculate a position in front of the player with a random distance
|
||||
final int distMin = FishingData.getInstance().getBaitDistanceMin();
|
||||
final int distMax = FishingData.getInstance().getBaitDistanceMax();
|
||||
int distance = Rnd.get(distMin, distMax);
|
||||
final int distance = Rnd.get(distMin, distMax);
|
||||
final double angle = Util.convertHeadingToDegree(_player.getHeading());
|
||||
final double radian = Math.toRadians(angle);
|
||||
final double sin = Math.sin(radian);
|
||||
final double cos = Math.cos(radian);
|
||||
int baitX = (int) (_player.getX() + (cos * distance));
|
||||
int baitY = (int) (_player.getY() + (sin * distance));
|
||||
final int baitX = (int) (_player.getX() + (cos * distance));
|
||||
final int baitY = (int) (_player.getY() + (sin * distance));
|
||||
|
||||
// search for fishing zone
|
||||
FishingZone fishingZone = null;
|
||||
@@ -411,7 +411,7 @@ public class Fishing
|
||||
}
|
||||
}
|
||||
|
||||
int baitZ = computeBaitZ(_player, baitX, baitY, fishingZone, waterZone);
|
||||
final int baitZ = computeBaitZ(_player, baitX, baitY, fishingZone, waterZone);
|
||||
if (baitZ == Integer.MIN_VALUE)
|
||||
{
|
||||
_player.sendPacket(SystemMessageId.YOU_CAN_T_FISH_HERE_YOUR_CHARACTER_IS_NOT_FACING_WATER_OR_YOU_ARE_NOT_IN_A_FISHING_GROUND);
|
||||
|
@@ -636,7 +636,7 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
|
||||
// player < party < command channel
|
||||
for (GroupType t : GroupType.values())
|
||||
{
|
||||
if (t != playerGroup && groupMaskContains(t))
|
||||
if ((t != playerGroup) && groupMaskContains(t))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
@@ -326,11 +326,10 @@ public abstract class Inventory extends ItemContainer
|
||||
|
||||
it.forEachSkill(ItemSkillType.NORMAL, holder ->
|
||||
{
|
||||
final Skill Skill = holder.getSkill();
|
||||
|
||||
if (Skill != null)
|
||||
final Skill skill = holder.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
player.removeSkill(Skill, false, Skill.isPassive());
|
||||
player.removeSkill(skill, false, skill.isPassive());
|
||||
update.compareAndSet(false, true);
|
||||
}
|
||||
else
|
||||
@@ -359,19 +358,15 @@ public abstract class Inventory extends ItemContainer
|
||||
if (skill != null)
|
||||
{
|
||||
player.addSkill(skill, false);
|
||||
|
||||
if (skill.isActive())
|
||||
if (skill.isActive() && !player.hasSkillReuse(skill.getReuseHashCode()))
|
||||
{
|
||||
if (!player.hasSkillReuse(skill.getReuseHashCode()))
|
||||
final int equipDelay = item.getEquipReuseDelay();
|
||||
if (equipDelay > 0)
|
||||
{
|
||||
final int equipDelay = item.getEquipReuseDelay();
|
||||
if (equipDelay > 0)
|
||||
{
|
||||
player.addTimeStamp(skill, equipDelay);
|
||||
player.disableSkill(skill, equipDelay);
|
||||
}
|
||||
updateTimestamp.compareAndSet(false, true);
|
||||
player.addTimeStamp(skill, equipDelay);
|
||||
player.disableSkill(skill, equipDelay);
|
||||
}
|
||||
updateTimestamp.compareAndSet(false, true);
|
||||
}
|
||||
update.compareAndSet(false, true);
|
||||
}
|
||||
@@ -487,19 +482,15 @@ public abstract class Inventory extends ItemContainer
|
||||
}
|
||||
|
||||
player.addSkill(skill, false);
|
||||
|
||||
if (skill.isActive())
|
||||
if (skill.isActive() && !player.hasSkillReuse(skill.getReuseHashCode()))
|
||||
{
|
||||
if (!player.hasSkillReuse(skill.getReuseHashCode()))
|
||||
final int equipDelay = item.getEquipReuseDelay();
|
||||
if (equipDelay > 0)
|
||||
{
|
||||
final int equipDelay = item.getEquipReuseDelay();
|
||||
if (equipDelay > 0)
|
||||
{
|
||||
player.addTimeStamp(skill, equipDelay);
|
||||
player.disableSkill(skill, equipDelay);
|
||||
}
|
||||
updateTimestamp.compareAndSet(false, true);
|
||||
player.addTimeStamp(skill, equipDelay);
|
||||
player.disableSkill(skill, equipDelay);
|
||||
}
|
||||
updateTimestamp.compareAndSet(false, true);
|
||||
}
|
||||
update.compareAndSet(false, true);
|
||||
}
|
||||
@@ -574,12 +565,9 @@ public abstract class Inventory extends ItemContainer
|
||||
if (itemVisualId > 0)
|
||||
{
|
||||
final AppearanceStone stone = AppearanceItemData.getInstance().getStone(itemVisualId);
|
||||
if (stone != null)
|
||||
if ((stone != null) && (stone.getType() == AppearanceType.FIXED) && verifyAndApply(player, item, ItemInstance::getVisualId))
|
||||
{
|
||||
if ((stone.getType() == AppearanceType.FIXED) && verifyAndApply(player, item, ItemInstance::getVisualId))
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1557,12 +1545,9 @@ public abstract class Inventory extends ItemContainer
|
||||
if (pdollSlot >= 0)
|
||||
{
|
||||
final ItemInstance old = setPaperdollItem(pdollSlot, null);
|
||||
if (old != null)
|
||||
if ((old != null) && getOwner().isPlayer())
|
||||
{
|
||||
if (getOwner().isPlayer())
|
||||
{
|
||||
((PlayerInstance) getOwner()).refreshExpertisePenalty();
|
||||
}
|
||||
((PlayerInstance) getOwner()).refreshExpertisePenalty();
|
||||
}
|
||||
return old;
|
||||
}
|
||||
@@ -1990,14 +1975,11 @@ public abstract class Inventory extends ItemContainer
|
||||
// find same (or incompatible) talisman type
|
||||
for (int i = PAPERDOLL_DECO1; i < (PAPERDOLL_DECO1 + getTalismanSlots()); i++)
|
||||
{
|
||||
if (_paperdoll[i] != null)
|
||||
if ((_paperdoll[i] != null) && (getPaperdollItemId(i) == item.getId()))
|
||||
{
|
||||
if (getPaperdollItemId(i) == item.getId())
|
||||
{
|
||||
// overwtite
|
||||
setPaperdollItem(i, item);
|
||||
return;
|
||||
}
|
||||
// overwrite
|
||||
setPaperdollItem(i, item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -200,7 +200,7 @@ public class EnchantScroll extends AbstractEnchantItem
|
||||
final double finalChance = Math.min(chance + bonusRate + supportBonusRate, 100);
|
||||
|
||||
final double random = 100 * Rnd.nextDouble();
|
||||
boolean success = (random < finalChance) || player.tryLuck();
|
||||
final boolean success = (random < finalChance) || player.tryLuck();
|
||||
|
||||
return success ? EnchantResultType.SUCCESS : EnchantResultType.FAILURE;
|
||||
}
|
||||
|
@@ -1021,9 +1021,9 @@ public class ItemInstance extends WorldObject
|
||||
{
|
||||
if (rs.next())
|
||||
{
|
||||
int mineralId = rs.getInt("mineralId");
|
||||
int option1 = rs.getInt("option1");
|
||||
int option2 = rs.getInt("option2");
|
||||
final int mineralId = rs.getInt("mineralId");
|
||||
final int option1 = rs.getInt("option1");
|
||||
final int option2 = rs.getInt("option2");
|
||||
if ((option1 != -1) && (option2 != -1))
|
||||
{
|
||||
_augmentation = new VariationInstance(mineralId, option1, option2);
|
||||
@@ -1786,7 +1786,7 @@ public class ItemInstance extends WorldObject
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Creature owner = getActingPlayer();
|
||||
final Creature owner = getActingPlayer();
|
||||
if (owner != null)
|
||||
{
|
||||
for (Condition condition : _item.getConditions())
|
||||
|
@@ -640,13 +640,13 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
Calendar currentTime = Calendar.getInstance();
|
||||
final Calendar currentTime = Calendar.getInstance();
|
||||
currentTime.set(Calendar.AM_PM, Calendar.AM);
|
||||
currentTime.set(Calendar.HOUR, 12);
|
||||
currentTime.set(Calendar.MINUTE, 0);
|
||||
currentTime.set(Calendar.SECOND, 0);
|
||||
|
||||
Calendar nextChange = Calendar.getInstance();
|
||||
final Calendar nextChange = Calendar.getInstance();
|
||||
|
||||
switch (Config.ALT_OLY_PERIOD)
|
||||
{
|
||||
@@ -999,26 +999,23 @@ public class Olympiad extends ListenersContainer
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (NOBLES != null)
|
||||
LOGGER_OLYMPIAD.info("Noble,charid,classid,compDone,points");
|
||||
StatsSet nobleInfo;
|
||||
for (Entry<Integer, StatsSet> entry : NOBLES.entrySet())
|
||||
{
|
||||
LOGGER_OLYMPIAD.info("Noble,charid,classid,compDone,points");
|
||||
StatsSet nobleInfo;
|
||||
for (Entry<Integer, StatsSet> entry : NOBLES.entrySet())
|
||||
nobleInfo = entry.getValue();
|
||||
if (nobleInfo == null)
|
||||
{
|
||||
nobleInfo = entry.getValue();
|
||||
if (nobleInfo == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int charId = entry.getKey();
|
||||
final int classId = nobleInfo.getInt(CLASS_ID);
|
||||
final String charName = nobleInfo.getString(CHAR_NAME);
|
||||
final int points = nobleInfo.getInt(POINTS);
|
||||
final int compDone = nobleInfo.getInt(COMP_DONE);
|
||||
|
||||
LOGGER_OLYMPIAD.info(charName + "," + charId + "," + classId + "," + compDone + "," + points);
|
||||
continue;
|
||||
}
|
||||
|
||||
final int charId = entry.getKey();
|
||||
final int classId = nobleInfo.getInt(CLASS_ID);
|
||||
final String charName = nobleInfo.getString(CHAR_NAME);
|
||||
final int points = nobleInfo.getInt(POINTS);
|
||||
final int compDone = nobleInfo.getInt(COMP_DONE);
|
||||
|
||||
LOGGER_OLYMPIAD.info(charName + "," + charId + "," + classId + "," + compDone + "," + points);
|
||||
}
|
||||
|
||||
final List<StatsSet> heroesToBe = new LinkedList<>();
|
||||
@@ -1181,7 +1178,7 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
public int getCompetitionDone(int objId)
|
||||
{
|
||||
if ((NOBLES == null) || !NOBLES.containsKey(objId))
|
||||
if (!NOBLES.containsKey(objId))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1190,7 +1187,7 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
public int getCompetitionWon(int objId)
|
||||
{
|
||||
if ((NOBLES == null) || !NOBLES.containsKey(objId))
|
||||
if (!NOBLES.containsKey(objId))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1199,7 +1196,7 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
public int getCompetitionLost(int objId)
|
||||
{
|
||||
if ((NOBLES == null) || !NOBLES.containsKey(objId))
|
||||
if (!NOBLES.containsKey(objId))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1213,7 +1210,7 @@ public class Olympiad extends ListenersContainer
|
||||
*/
|
||||
public int getCompetitionDoneWeek(int objId)
|
||||
{
|
||||
if ((NOBLES == null) || !NOBLES.containsKey(objId))
|
||||
if (!NOBLES.containsKey(objId))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -134,7 +134,7 @@ public class Options
|
||||
|
||||
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type)
|
||||
{
|
||||
List<OptionsSkillHolder> temp = new ArrayList<>();
|
||||
final List<OptionsSkillHolder> temp = new ArrayList<>();
|
||||
if (_activationSkills != null)
|
||||
{
|
||||
for (OptionsSkillHolder holder : _activationSkills)
|
||||
|
@@ -48,7 +48,7 @@ public class Variation
|
||||
|
||||
public Options getRandomEffect(VariationWeaponType type, int order)
|
||||
{
|
||||
OptionDataGroup[] effects = _effects.get(type);
|
||||
final OptionDataGroup[] effects = _effects.get(type);
|
||||
if ((effects == null) || (effects[order] == null))
|
||||
{
|
||||
LOGGER.warning("Null effect: " + type + ", " + order);
|
||||
|
@@ -237,7 +237,7 @@ public class PunishmentTask implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
if (_type == PunishmentType.CHAT_BAN && _affect == PunishmentAffect.CHARACTER)
|
||||
if ((_type == PunishmentType.CHAT_BAN) && (_affect == PunishmentAffect.CHARACTER))
|
||||
{
|
||||
final PlayerInstance player = World.getInstance().getPlayer(Integer.parseInt(_key));
|
||||
if (player != null)
|
||||
|
@@ -243,7 +243,7 @@ public class Formulas
|
||||
final double statBonus;
|
||||
|
||||
// There is a chance that activeChar has altered base stat for skill critical.
|
||||
byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL);
|
||||
final byte skillCritRateStat = (byte) creature.getStat().getValue(Stats.STAT_BONUS_SKILL_CRITICAL);
|
||||
if ((skillCritRateStat >= 0) && (skillCritRateStat < BaseStats.values().length))
|
||||
{
|
||||
// Best tested.
|
||||
@@ -471,11 +471,11 @@ public class Formulas
|
||||
|
||||
public static double calcAtkSpdMultiplier(Creature creature)
|
||||
{
|
||||
double armorBonus = 1; // EquipedArmorSpeedByCrystal TODO: Implement me!
|
||||
double dexBonus = BaseStats.DEX.calcBonus(creature);
|
||||
double weaponAttackSpeed = Stats.weaponBaseValue(creature, Stats.PHYSICAL_ATTACK_SPEED) / armorBonus; // unk868
|
||||
double attackSpeedPerBonus = creature.getStat().getMul(Stats.PHYSICAL_ATTACK_SPEED);
|
||||
double attackSpeedDiffBonus = creature.getStat().getAdd(Stats.PHYSICAL_ATTACK_SPEED);
|
||||
final double armorBonus = 1; // EquipedArmorSpeedByCrystal TODO: Implement me!
|
||||
final double dexBonus = BaseStats.DEX.calcBonus(creature);
|
||||
final double weaponAttackSpeed = Stats.weaponBaseValue(creature, Stats.PHYSICAL_ATTACK_SPEED) / armorBonus; // unk868
|
||||
final double attackSpeedPerBonus = creature.getStat().getMul(Stats.PHYSICAL_ATTACK_SPEED);
|
||||
final double attackSpeedDiffBonus = creature.getStat().getAdd(Stats.PHYSICAL_ATTACK_SPEED);
|
||||
return (dexBonus * (weaponAttackSpeed / 333) * attackSpeedPerBonus) + (attackSpeedDiffBonus / 333);
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ public class Formulas
|
||||
|
||||
if (creature.isNpc())
|
||||
{
|
||||
double npcFactor = ((Npc) creature).getTemplate().getHitTimeFactorSkill();
|
||||
final double npcFactor = ((Npc) creature).getTemplate().getHitTimeFactorSkill();
|
||||
if (npcFactor > 0)
|
||||
{
|
||||
factor /= npcFactor;
|
||||
|
@@ -119,7 +119,7 @@ public interface IStatsFunction
|
||||
(bodypart == Item.SLOT_HAIRALL))
|
||||
{
|
||||
// TODO: Item after enchant shows pDef, but scroll says mDef increase.
|
||||
if (stat != Stats.PHYSICAL_DEFENCE && stat != Stats.MAGICAL_DEFENCE)
|
||||
if ((stat != Stats.PHYSICAL_DEFENCE) && (stat != Stats.MAGICAL_DEFENCE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ public class Hopzone extends VoteSystem
|
||||
|
||||
try
|
||||
{
|
||||
URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection();
|
||||
final URLConnection con = new URL(Config.HOPZONE_SERVER_LINK).openConnection();
|
||||
con.addRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
isr = new InputStreamReader(con.getInputStream());
|
||||
br = new BufferedReader(isr);
|
||||
|
@@ -48,7 +48,7 @@ public class Network extends VoteSystem
|
||||
|
||||
try
|
||||
{
|
||||
URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection();
|
||||
final URLConnection con = new URL(Config.NETWORK_SERVER_LINK).openConnection();
|
||||
con.addRequestProperty("User-Agent", "Mozilla/5.0");
|
||||
isr = new InputStreamReader(con.getInputStream());
|
||||
br = new BufferedReader(isr);
|
||||
|
@@ -48,7 +48,7 @@ public class Topzone extends VoteSystem
|
||||
|
||||
try
|
||||
{
|
||||
URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection();
|
||||
final URLConnection con = new URL(Config.TOPZONE_SERVER_LINK).openConnection();
|
||||
con.addRequestProperty("User-Agent", "L2TopZone");
|
||||
isr = new InputStreamReader(con.getInputStream());
|
||||
br = new BufferedReader(isr);
|
||||
|
@@ -99,7 +99,7 @@ public abstract class VoteSystem implements Runnable
|
||||
|
||||
protected void reward()
|
||||
{
|
||||
int currentVotes = getVotes();
|
||||
final int currentVotes = getVotes();
|
||||
|
||||
if (currentVotes == -1)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public abstract class VoteSystem implements Runnable
|
||||
|
||||
if (currentVotes >= (lastVotes + votesDiff))
|
||||
{
|
||||
Collection<PlayerInstance> pls = World.getInstance().getPlayers();
|
||||
final Collection<PlayerInstance> pls = World.getInstance().getPlayers();
|
||||
if (allowReport)
|
||||
{
|
||||
LOGGER.info("VoteSystem: Server votes on " + getSiteName() + ": " + currentVotes);
|
||||
@@ -139,10 +139,10 @@ public abstract class VoteSystem implements Runnable
|
||||
}
|
||||
|
||||
boolean canReward = false;
|
||||
String pIp = p.getClient().getConnectionAddress().getHostAddress();
|
||||
final String pIp = p.getClient().getConnectionAddress().getHostAddress();
|
||||
if (playerIps.containsKey(pIp))
|
||||
{
|
||||
int count = playerIps.get(pIp);
|
||||
final int count = playerIps.get(pIp);
|
||||
if (count < boxes)
|
||||
{
|
||||
playerIps.remove(pIp);
|
||||
@@ -185,7 +185,7 @@ public abstract class VoteSystem implements Runnable
|
||||
|
||||
private void announce(String msg)
|
||||
{
|
||||
CreatureSay cs = new CreatureSay(0, ChatType.CRITICAL_ANNOUNCE, "", msg);
|
||||
final CreatureSay cs = new CreatureSay(0, ChatType.CRITICAL_ANNOUNCE, "", msg);
|
||||
Broadcast.toAllOnlinePlayers(cs);
|
||||
}
|
||||
|
||||
|
@@ -122,7 +122,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedMultisellListHolder list = player.getMultiSell();
|
||||
final PreparedMultisellListHolder list = player.getMultiSell();
|
||||
if ((list == null) || (list.getId() != _listId))
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
@@ -265,7 +265,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
// Check for enchanted item if its present in the inventory.
|
||||
if ((itemEnchantment != null) && (inventory.getItemByObjectId(itemEnchantment.getObjectId()) == null))
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
sm.addItemName(itemEnchantment.getItem().getId());
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
if (clan != null)
|
||||
{
|
||||
clan.takeReputationScore((int) totalCount, true);
|
||||
SystemMessage smsg = new SystemMessage(SystemMessageId.S1_POINT_S_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION);
|
||||
final SystemMessage smsg = new SystemMessage(SystemMessageId.S1_POINT_S_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION);
|
||||
smsg.addLong(totalCount);
|
||||
player.sendPacket(smsg);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
sm.addItemName(ingredient.getId());
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
@@ -383,7 +383,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_A_N_S1);
|
||||
sm.addItemName(ingredient.getId());
|
||||
player.sendPacket(sm);
|
||||
return;
|
||||
@@ -399,7 +399,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(ingredient.getId());
|
||||
sm.addLong(totalCount);
|
||||
player.sendPacket(sm);
|
||||
@@ -648,7 +648,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
// Check if the necessary items are there. If list maintains enchantment, allow all enchanted items, otherwise only unenchanted. TODO: Check how retail does it.
|
||||
else if (inventory.getInventoryItemCount(ingredientId, list.isMaintainEnchantment() ? -1 : 0, false) < totalCount)
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(ingredientId);
|
||||
sm.addLong(totalCount);
|
||||
player.sendPacket(sm);
|
||||
|
@@ -50,7 +50,7 @@ public class RequestDuelStart implements IClientIncomingPacket
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_DECLINED_YOUR_CHALLENGE_TO_A_DUEL);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_DECLINED_YOUR_CHALLENGE_TO_A_DUEL);
|
||||
sm.addString(name);
|
||||
player.sendPacket(sm);
|
||||
player.onTransactionResponse();
|
||||
|
@@ -60,7 +60,7 @@ public class RequestExCubeGameChangeTeam implements IClientIncomingPacket
|
||||
}
|
||||
case -1:
|
||||
{
|
||||
// Remove Player (me)
|
||||
// Remove Player (me)
|
||||
}
|
||||
{
|
||||
final int team = HandysBlockCheckerManager.getInstance().getHolder(_arena).getPlayerTeam(player);
|
||||
|
@@ -300,7 +300,7 @@ public class RequestExEnchantItemAttribute implements IClientIncomingPacket
|
||||
return -1;
|
||||
}
|
||||
|
||||
boolean success = Elementals.isSuccess(item, stone.getId());
|
||||
final boolean success = Elementals.isSuccess(item, stone.getId());
|
||||
|
||||
if (success)
|
||||
{
|
||||
|
@@ -77,7 +77,7 @@ public class RequestJoinParty implements IClientIncomingPacket
|
||||
|
||||
if (FakePlayerData.getInstance().isTalkable(_name))
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_BEEN_INVITED_TO_THE_PARTY);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_BEEN_INVITED_TO_THE_PARTY);
|
||||
sm.addString(FakePlayerData.getInstance().getProperName(_name));
|
||||
requestor.sendPacket(sm);
|
||||
if (!requestor.isProcessingRequest())
|
||||
|
@@ -47,7 +47,7 @@ public class RequestJoinPledge implements IClientIncomingPacket
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.S1_DID_NOT_RESPOND_INVITATION_TO_THE_CLAN_HAS_BEEN_CANCELLED);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DID_NOT_RESPOND_INVITATION_TO_THE_CLAN_HAS_BEEN_CANCELLED);
|
||||
sm.addString(name);
|
||||
player.sendPacket(sm);
|
||||
player.onTransactionResponse();
|
||||
|
@@ -40,7 +40,7 @@ public class RequestPrivateStoreSell implements IClientIncomingPacket
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_storePlayerId = packet.readD();
|
||||
int itemsCount = packet.readD();
|
||||
final int itemsCount = packet.readD();
|
||||
if ((itemsCount <= 0) || (itemsCount > Config.MAX_ITEM_IN_PACKET))
|
||||
{
|
||||
return false;
|
||||
@@ -58,12 +58,12 @@ public class RequestPrivateStoreSell implements IClientIncomingPacket
|
||||
packet.readD(); // visual id
|
||||
packet.readD(); // option 1
|
||||
packet.readD(); // option 2
|
||||
int soulCrystals = packet.readC();
|
||||
final int soulCrystals = packet.readC();
|
||||
for (int s = 0; s < soulCrystals; s++)
|
||||
{
|
||||
packet.readD(); // soul crystal option
|
||||
}
|
||||
int soulCrystals2 = packet.readC();
|
||||
final int soulCrystals2 = packet.readC();
|
||||
for (int s = 0; s < soulCrystals2; s++)
|
||||
{
|
||||
packet.readD(); // sa effect
|
||||
|
@@ -109,7 +109,7 @@ public class RequestRefine extends AbstractRefinePacket
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
if (targetItem.isEquipped())
|
||||
{
|
||||
ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
|
||||
final ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
|
||||
for (ItemInstance itm : unequiped)
|
||||
{
|
||||
iu.addModifiedItem(itm);
|
||||
|
@@ -146,13 +146,13 @@ public class RequestSellItem implements IClientIncomingPacket
|
||||
// Proceed the sell
|
||||
for (UniqueItemHolder i : _items)
|
||||
{
|
||||
ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
|
||||
final ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
|
||||
if ((item == null) || (!item.isSellable()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
long price = item.getReferencePrice() / 2;
|
||||
final long price = item.getReferencePrice() / 2;
|
||||
totalPrice += price * i.getCount();
|
||||
if (((MAX_ADENA / i.getCount()) < price) || (totalPrice > MAX_ADENA))
|
||||
{
|
||||
|
@@ -61,7 +61,7 @@ public class RequestVoteNew implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_RECOMMENDED_C1_YOU_HAVE_S2_RECOMMENDATIONS_LEFT);
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_RECOMMENDED_C1_YOU_HAVE_S2_RECOMMENDATIONS_LEFT);
|
||||
sm.addString(FakePlayerData.getInstance().getProperName(object.getName()));
|
||||
sm.addInt(player.getRecomLeft());
|
||||
client.sendPacket(sm);
|
||||
|
@@ -56,7 +56,7 @@ public class SetPrivateStoreListBuy implements IClientIncomingPacket
|
||||
_items = new TradeItem[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int itemId = packet.readD();
|
||||
final int itemId = packet.readD();
|
||||
|
||||
final Item template = ItemTable.getInstance().getTemplate(itemId);
|
||||
if (template == null)
|
||||
@@ -68,8 +68,8 @@ public class SetPrivateStoreListBuy implements IClientIncomingPacket
|
||||
final int enchantLevel = packet.readH();
|
||||
packet.readH(); // TODO analyse this
|
||||
|
||||
long cnt = packet.readQ();
|
||||
long price = packet.readQ();
|
||||
final long cnt = packet.readQ();
|
||||
final long price = packet.readQ();
|
||||
|
||||
if ((itemId < 1) || (cnt < 1) || (price < 0))
|
||||
{
|
||||
@@ -157,7 +157,7 @@ public class SetPrivateStoreListBuy implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
TradeList tradeList = player.getBuyList();
|
||||
final TradeList tradeList = player.getBuyList();
|
||||
tradeList.clear();
|
||||
|
||||
// Check maximum number of allowed slots for pvt shops
|
||||
|
@@ -188,7 +188,7 @@ public class RequestShapeShiftingItem implements IClientIncomingPacket
|
||||
extracItemId = extractItem.getId();
|
||||
}
|
||||
|
||||
long cost = appearanceStone.getCost();
|
||||
final long cost = appearanceStone.getCost();
|
||||
if (cost > player.getAdena())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.YOU_CANNOT_MODIFY_AS_YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
|
@@ -83,7 +83,7 @@ public class RequestChangeAttributeItem implements IClientIncomingPacket
|
||||
msg.addAttribute(oldElementId);
|
||||
msg.addAttribute(_newElementId);
|
||||
player.sendPacket(msg);
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(item);
|
||||
for (ItemInstance i : player.getInventory().getItemsByItemId(_consumeItemId))
|
||||
{
|
||||
|
@@ -370,9 +370,9 @@ public class CharSelectionInfo implements IClientOutgoingPacket
|
||||
{
|
||||
if (result.next())
|
||||
{
|
||||
int mineralId = result.getInt("mineralId");
|
||||
int option1 = result.getInt("option1");
|
||||
int option2 = result.getInt("option2");
|
||||
final int mineralId = result.getInt("mineralId");
|
||||
final int option1 = result.getInt("option1");
|
||||
final int option2 = result.getInt("option2");
|
||||
if ((option1 != -1) && (option2 != -1))
|
||||
{
|
||||
charInfopackage.setAugmentation(new VariationInstance(mineralId, option1, option2));
|
||||
|
@@ -104,7 +104,7 @@ public class FakePlayerInfo implements IClientOutgoingPacket
|
||||
packet.writeD(_fpcHolder.getEquipHair2());
|
||||
|
||||
for (@SuppressWarnings("unused")
|
||||
int slot : getPaperdollOrderAugument())
|
||||
final int slot : getPaperdollOrderAugument())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
packet.writeD(0x00);
|
||||
@@ -113,7 +113,7 @@ public class FakePlayerInfo implements IClientOutgoingPacket
|
||||
packet.writeC(_fpcHolder.getArmorEnchantLevel());
|
||||
|
||||
for (@SuppressWarnings("unused")
|
||||
int slot : getPaperdollOrderVisualId())
|
||||
final int slot : getPaperdollOrderVisualId())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ public class SellListProcure implements IClientOutgoingPacket
|
||||
|
||||
for (Entry<ItemInstance, Long> entry : _sellList.entrySet())
|
||||
{
|
||||
ItemInstance item = entry.getKey();
|
||||
final ItemInstance item = entry.getKey();
|
||||
packet.writeH(item.getItem().getType1());
|
||||
packet.writeD(item.getObjectId());
|
||||
packet.writeD(item.getDisplayId());
|
||||
|
@@ -39,7 +39,7 @@ public class JavaScriptingEngine
|
||||
public JavaScriptingEngine()
|
||||
{
|
||||
// Load config.
|
||||
Properties props = new Properties();
|
||||
final Properties props = new Properties();
|
||||
try (FileInputStream fis = new FileInputStream("config/ScriptEngine.ini"))
|
||||
{
|
||||
props.load(fis);
|
||||
|
@@ -95,14 +95,14 @@ public class Gui
|
||||
txtrConsole.getDocument().addDocumentListener(new LimitLinesDocumentListener(500));
|
||||
|
||||
// Initialize menu items.
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
final JMenuBar menuBar = new JMenuBar();
|
||||
menuBar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
|
||||
|
||||
JMenu mnActions = new JMenu("Actions");
|
||||
final JMenu mnActions = new JMenu("Actions");
|
||||
mnActions.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnActions);
|
||||
|
||||
JMenuItem mntmShutdown = new JMenuItem("Shutdown");
|
||||
final JMenuItem mntmShutdown = new JMenuItem("Shutdown");
|
||||
mntmShutdown.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmShutdown.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -125,7 +125,7 @@ public class Gui
|
||||
});
|
||||
mnActions.add(mntmShutdown);
|
||||
|
||||
JMenuItem mntmRestart = new JMenuItem("Restart");
|
||||
final JMenuItem mntmRestart = new JMenuItem("Restart");
|
||||
mntmRestart.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmRestart.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -148,7 +148,7 @@ public class Gui
|
||||
});
|
||||
mnActions.add(mntmRestart);
|
||||
|
||||
JMenuItem mntmAbort = new JMenuItem("Abort");
|
||||
final JMenuItem mntmAbort = new JMenuItem("Abort");
|
||||
mntmAbort.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmAbort.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -159,11 +159,11 @@ public class Gui
|
||||
});
|
||||
mnActions.add(mntmAbort);
|
||||
|
||||
JMenu mnReload = new JMenu("Reload");
|
||||
final JMenu mnReload = new JMenu("Reload");
|
||||
mnReload.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnReload);
|
||||
|
||||
JMenuItem mntmConfigs = new JMenuItem("Configs");
|
||||
final JMenuItem mntmConfigs = new JMenuItem("Configs");
|
||||
mntmConfigs.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmConfigs.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -174,7 +174,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmConfigs);
|
||||
|
||||
JMenuItem mntmAccess = new JMenuItem("Access");
|
||||
final JMenuItem mntmAccess = new JMenuItem("Access");
|
||||
mntmAccess.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmAccess.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -185,7 +185,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmAccess);
|
||||
|
||||
JMenuItem mntmHtml = new JMenuItem("HTML");
|
||||
final JMenuItem mntmHtml = new JMenuItem("HTML");
|
||||
mntmHtml.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmHtml.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -196,7 +196,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmHtml);
|
||||
|
||||
JMenuItem mntmMultisells = new JMenuItem("Multisells");
|
||||
final JMenuItem mntmMultisells = new JMenuItem("Multisells");
|
||||
mntmMultisells.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmMultisells.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -207,7 +207,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmMultisells);
|
||||
|
||||
JMenuItem mntmBuylists = new JMenuItem("Buylists");
|
||||
final JMenuItem mntmBuylists = new JMenuItem("Buylists");
|
||||
mntmBuylists.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmBuylists.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -218,7 +218,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmBuylists);
|
||||
|
||||
JMenuItem mntmPrimeShop = new JMenuItem("PrimeShop");
|
||||
final JMenuItem mntmPrimeShop = new JMenuItem("PrimeShop");
|
||||
mntmPrimeShop.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmPrimeShop.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -229,11 +229,11 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmPrimeShop);
|
||||
|
||||
JMenu mnAnnounce = new JMenu("Announce");
|
||||
final JMenu mnAnnounce = new JMenu("Announce");
|
||||
mnAnnounce.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnAnnounce);
|
||||
|
||||
JMenuItem mntmNormal = new JMenuItem("Normal");
|
||||
final JMenuItem mntmNormal = new JMenuItem("Normal");
|
||||
mntmNormal.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmNormal.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -249,7 +249,7 @@ public class Gui
|
||||
});
|
||||
mnAnnounce.add(mntmNormal);
|
||||
|
||||
JMenuItem mntmCritical = new JMenuItem("Critical");
|
||||
final JMenuItem mntmCritical = new JMenuItem("Critical");
|
||||
mntmCritical.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmCritical.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -265,11 +265,11 @@ public class Gui
|
||||
});
|
||||
mnAnnounce.add(mntmCritical);
|
||||
|
||||
JMenu mnFont = new JMenu("Font");
|
||||
final JMenu mnFont = new JMenu("Font");
|
||||
mnFont.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnFont);
|
||||
|
||||
String[] fonts =
|
||||
final String[] fonts =
|
||||
{
|
||||
"16",
|
||||
"21",
|
||||
@@ -278,38 +278,38 @@ public class Gui
|
||||
};
|
||||
for (String font : fonts)
|
||||
{
|
||||
JMenuItem mntmFont = new JMenuItem(font);
|
||||
final JMenuItem mntmFont = new JMenuItem(font);
|
||||
mntmFont.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmFont.addActionListener(arg0 -> txtrConsole.setFont(new Font("Monospaced", Font.PLAIN, Integer.parseInt(font))));
|
||||
mnFont.add(mntmFont);
|
||||
}
|
||||
|
||||
JMenu mnHelp = new JMenu("Help");
|
||||
final JMenu mnHelp = new JMenu("Help");
|
||||
mnHelp.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnHelp);
|
||||
|
||||
JMenuItem mntmAbout = new JMenuItem("About");
|
||||
final JMenuItem mntmAbout = new JMenuItem("About");
|
||||
mntmAbout.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmAbout.addActionListener(arg0 -> new frmAbout());
|
||||
mnHelp.add(mntmAbout);
|
||||
|
||||
// Set icons.
|
||||
List<Image> icons = new ArrayList<>();
|
||||
final List<Image> icons = new ArrayList<>();
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_16x16.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_32x32.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_64x64.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_128x128.png").getImage());
|
||||
|
||||
// Set Panels.
|
||||
JPanel systemPanel = new SystemPanel();
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
final JPanel systemPanel = new SystemPanel();
|
||||
final JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
JLayeredPane layeredPanel = new JLayeredPane();
|
||||
final JLayeredPane layeredPanel = new JLayeredPane();
|
||||
layeredPanel.add(scrollPanel, 0, 0);
|
||||
layeredPanel.add(systemPanel, 1, 0);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - GameServer");
|
||||
final JFrame frame = new JFrame("Mobius - GameServer");
|
||||
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
frame.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@@ -358,7 +358,7 @@ public class Gui
|
||||
// Method that manages the redirect.
|
||||
private void redirectSystemStreams()
|
||||
{
|
||||
OutputStream out = new OutputStream()
|
||||
final OutputStream out = new OutputStream()
|
||||
{
|
||||
@Override
|
||||
public void write(int b)
|
||||
|
@@ -49,37 +49,37 @@ public class SystemPanel extends JPanel
|
||||
setOpaque(true);
|
||||
setLayout(null);
|
||||
|
||||
JLabel lblProtocol = new JLabel("Protocol");
|
||||
final JLabel lblProtocol = new JLabel("Protocol");
|
||||
lblProtocol.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblProtocol.setBounds(10, 5, 264, 17);
|
||||
add(lblProtocol);
|
||||
|
||||
JLabel lblConnected = new JLabel("Connected");
|
||||
final JLabel lblConnected = new JLabel("Connected");
|
||||
lblConnected.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblConnected.setBounds(10, 23, 264, 17);
|
||||
add(lblConnected);
|
||||
|
||||
JLabel lblMaxConnected = new JLabel("Max connected");
|
||||
final JLabel lblMaxConnected = new JLabel("Max connected");
|
||||
lblMaxConnected.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblMaxConnected.setBounds(10, 41, 264, 17);
|
||||
add(lblMaxConnected);
|
||||
|
||||
JLabel lblOfflineShops = new JLabel("Offline trade");
|
||||
final JLabel lblOfflineShops = new JLabel("Offline trade");
|
||||
lblOfflineShops.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblOfflineShops.setBounds(10, 59, 264, 17);
|
||||
add(lblOfflineShops);
|
||||
|
||||
JLabel lblElapsedTime = new JLabel("Elapsed time");
|
||||
final JLabel lblElapsedTime = new JLabel("Elapsed time");
|
||||
lblElapsedTime.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblElapsedTime.setBounds(10, 77, 264, 17);
|
||||
add(lblElapsedTime);
|
||||
|
||||
JLabel lblJavaVersion = new JLabel("Build JDK");
|
||||
final JLabel lblJavaVersion = new JLabel("Build JDK");
|
||||
lblJavaVersion.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblJavaVersion.setBounds(10, 95, 264, 17);
|
||||
add(lblJavaVersion);
|
||||
|
||||
JLabel lblBuildDate = new JLabel("Build date");
|
||||
final JLabel lblBuildDate = new JLabel("Build date");
|
||||
lblBuildDate.setFont(new Font("Monospaced", Font.PLAIN, 16));
|
||||
lblBuildDate.setBounds(10, 113, 264, 17);
|
||||
add(lblBuildDate);
|
||||
@@ -94,9 +94,9 @@ public class SystemPanel extends JPanel
|
||||
lblBuildDate.setText("Build date: Unavailable");
|
||||
try
|
||||
{
|
||||
File jarName = Locator.getClassSource(GameServer.class);
|
||||
JarFile jarFile = new JarFile(jarName);
|
||||
Attributes attrs = jarFile.getManifest().getMainAttributes();
|
||||
final File jarName = Locator.getClassSource(GameServer.class);
|
||||
final JarFile jarFile = new JarFile(jarName);
|
||||
final Attributes attrs = jarFile.getManifest().getMainAttributes();
|
||||
lblBuildDate.setText("Build date: " + attrs.getValue("Build-Date").split(" ")[0]);
|
||||
jarFile.close();
|
||||
}
|
||||
@@ -131,13 +131,13 @@ public class SystemPanel extends JPanel
|
||||
|
||||
static String getDurationBreakdown(long millis)
|
||||
{
|
||||
long days = TimeUnit.MILLISECONDS.toDays(millis);
|
||||
final long days = TimeUnit.MILLISECONDS.toDays(millis);
|
||||
millis -= TimeUnit.DAYS.toMillis(days);
|
||||
long hours = TimeUnit.MILLISECONDS.toHours(millis);
|
||||
final long hours = TimeUnit.MILLISECONDS.toHours(millis);
|
||||
millis -= TimeUnit.HOURS.toMillis(hours);
|
||||
long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
|
||||
final long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
|
||||
millis -= TimeUnit.MINUTES.toMillis(minutes);
|
||||
long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
|
||||
final long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
|
||||
|
||||
return (days + "d " + hours + "h " + minutes + "m " + seconds + "s");
|
||||
}
|
||||
|
@@ -59,30 +59,30 @@ public class frmAbout
|
||||
frmAbout.setType(Type.UTILITY);
|
||||
frmAbout.getContentPane().setLayout(null);
|
||||
|
||||
JLabel lblLjmobius = new JLabel("L2jMobius");
|
||||
final JLabel lblLjmobius = new JLabel("L2jMobius");
|
||||
lblLjmobius.setFont(new Font("Tahoma", Font.PLAIN, 32));
|
||||
lblLjmobius.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblLjmobius.setBounds(10, 11, 271, 39);
|
||||
frmAbout.getContentPane().add(lblLjmobius);
|
||||
|
||||
JLabel lblData = new JLabel("2013-" + Calendar.getInstance().get(Calendar.YEAR));
|
||||
final JLabel lblData = new JLabel("2013-" + Calendar.getInstance().get(Calendar.YEAR));
|
||||
lblData.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblData.setBounds(10, 44, 271, 14);
|
||||
frmAbout.getContentPane().add(lblData);
|
||||
|
||||
JLabel lblSupports = new JLabel("Server Protocol");
|
||||
final JLabel lblSupports = new JLabel("Server Protocol");
|
||||
lblSupports.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblSupports.setFont(new Font("Tahoma", Font.PLAIN, 14));
|
||||
lblSupports.setBounds(10, 78, 271, 23);
|
||||
frmAbout.getContentPane().add(lblSupports);
|
||||
|
||||
JLabel lblProtocols = new JLabel("Protocol Number");
|
||||
final JLabel lblProtocols = new JLabel("Protocol Number");
|
||||
lblProtocols.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblProtocols.setFont(new Font("Tahoma", Font.PLAIN, 14));
|
||||
lblProtocols.setBounds(10, 92, 271, 23);
|
||||
frmAbout.getContentPane().add(lblProtocols);
|
||||
|
||||
JLabel site = new JLabel(URL);
|
||||
final JLabel site = new JLabel(URL);
|
||||
site.setText("<HTML><FONT color=\"#000099\"><U>" + URL + "</U></FONT></HTML>");
|
||||
site.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
site.setBounds(76, 128, 140, 14);
|
||||
|
@@ -45,7 +45,7 @@ public class Locator
|
||||
*/
|
||||
public static File getClassSource(Class<?> c)
|
||||
{
|
||||
String classResource = c.getName().replace('.', '/') + ".class";
|
||||
final String classResource = c.getName().replace('.', '/') + ".class";
|
||||
return getResourceSource(c.getClassLoader(), classResource);
|
||||
}
|
||||
|
||||
@@ -73,17 +73,17 @@ public class Locator
|
||||
}
|
||||
if (url != null)
|
||||
{
|
||||
String u = url.toString();
|
||||
final String u = url.toString();
|
||||
if (u.startsWith("jar:file:"))
|
||||
{
|
||||
int pling = u.indexOf('!');
|
||||
String jarName = u.substring(4, pling);
|
||||
final int pling = u.indexOf('!');
|
||||
final String jarName = u.substring(4, pling);
|
||||
return new File(fromURI(jarName));
|
||||
}
|
||||
else if (u.startsWith("file:"))
|
||||
{
|
||||
int tail = u.indexOf(resource);
|
||||
String dirName = u.substring(0, tail);
|
||||
final int tail = u.indexOf(resource);
|
||||
final String dirName = u.substring(0, tail);
|
||||
return new File(fromURI(dirName));
|
||||
}
|
||||
}
|
||||
@@ -117,13 +117,13 @@ public class Locator
|
||||
{
|
||||
throw new IllegalArgumentException("Can only handle valid file: URIs");
|
||||
}
|
||||
StringBuilder buf = new StringBuilder(url.getHost());
|
||||
final StringBuilder buf = new StringBuilder(url.getHost());
|
||||
if (buf.length() > 0)
|
||||
{
|
||||
buf.insert(0, File.separatorChar).insert(0, File.separatorChar);
|
||||
}
|
||||
String file = url.getFile();
|
||||
int queryPos = file.indexOf('?');
|
||||
final String file = url.getFile();
|
||||
final int queryPos = file.indexOf('?');
|
||||
buf.append((queryPos < 0) ? file : file.substring(0, queryPos));
|
||||
|
||||
uri = buf.toString().replace('/', File.separatorChar);
|
||||
@@ -146,20 +146,20 @@ public class Locator
|
||||
{
|
||||
return uri;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
CharacterIterator iter = new StringCharacterIterator(uri);
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final CharacterIterator iter = new StringCharacterIterator(uri);
|
||||
for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
|
||||
{
|
||||
if (c == '%')
|
||||
{
|
||||
char c1 = iter.next();
|
||||
final char c1 = iter.next();
|
||||
if (c1 != CharacterIterator.DONE)
|
||||
{
|
||||
int i1 = Character.digit(c1, 16);
|
||||
char c2 = iter.next();
|
||||
final int i1 = Character.digit(c1, 16);
|
||||
final char c2 = iter.next();
|
||||
if (c2 != CharacterIterator.DONE)
|
||||
{
|
||||
int i2 = Character.digit(c2, 16);
|
||||
final int i2 = Character.digit(c2, 16);
|
||||
sb.append((char) ((i1 << 4) + i2));
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ public class Locator
|
||||
{
|
||||
javaHome = javaHome.substring(0, javaHome.length() - 4);
|
||||
}
|
||||
File toolsJar = new File(javaHome + "/lib/tools.jar");
|
||||
final File toolsJar = new File(javaHome + "/lib/tools.jar");
|
||||
if (!toolsJar.exists())
|
||||
{
|
||||
System.out.println("Unable to locate tools.jar. " + "Expected to find it in " + toolsJar.getPath());
|
||||
@@ -251,7 +251,7 @@ public class Locator
|
||||
if (!location.isDirectory())
|
||||
{
|
||||
urls = new URL[1];
|
||||
String path = location.getPath();
|
||||
final String path = location.getPath();
|
||||
for (String extension : extensions)
|
||||
{
|
||||
if (path.toLowerCase().endsWith(extension))
|
||||
@@ -262,7 +262,7 @@ public class Locator
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
File[] matches = location.listFiles((FilenameFilter) (dir, name) ->
|
||||
final File[] matches = location.listFiles((FilenameFilter) (dir, name) ->
|
||||
{
|
||||
for (String extension : extensions)
|
||||
{
|
||||
|
@@ -245,8 +245,8 @@ public class CronParser
|
||||
*/
|
||||
public static TaskTable parse(Reader reader) throws IOException
|
||||
{
|
||||
TaskTable table = new TaskTable();
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
final TaskTable table = new TaskTable();
|
||||
final BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
try
|
||||
{
|
||||
String line;
|
||||
@@ -287,7 +287,7 @@ public class CronParser
|
||||
String pattern = null;
|
||||
for (int i = size; i >= 0; i--)
|
||||
{
|
||||
String aux = line.substring(0, i);
|
||||
final String aux = line.substring(0, i);
|
||||
if (SchedulingPattern.validate(aux))
|
||||
{
|
||||
pattern = aux;
|
||||
@@ -301,12 +301,12 @@ public class CronParser
|
||||
line = line.substring(pattern.length());
|
||||
size = line.length();
|
||||
// Splitting the line
|
||||
ArrayList<String> splitted = new ArrayList<>();
|
||||
final ArrayList<String> splitted = new ArrayList<>();
|
||||
StringBuilder current = null;
|
||||
boolean quotes = false;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
char c = line.charAt(i);
|
||||
final char c = line.charAt(i);
|
||||
if (current == null)
|
||||
{
|
||||
if (c == '"')
|
||||
@@ -371,12 +371,12 @@ public class CronParser
|
||||
File stdinFile = null;
|
||||
File stdoutFile = null;
|
||||
File stderrFile = null;
|
||||
ArrayList<String> envsList = new ArrayList<>();
|
||||
final ArrayList<String> envsList = new ArrayList<>();
|
||||
String command = null;
|
||||
ArrayList<String> argsList = new ArrayList<>();
|
||||
final ArrayList<String> argsList = new ArrayList<>();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
String tk = splitted.get(i);
|
||||
final String tk = splitted.get(i);
|
||||
// Check the local status.
|
||||
if (status == 0)
|
||||
{
|
||||
@@ -441,7 +441,7 @@ public class CronParser
|
||||
throw new Exception("Invalid Java class name on line: " + line);
|
||||
}
|
||||
String methodName;
|
||||
int sep = className.indexOf('#');
|
||||
final int sep = className.indexOf('#');
|
||||
if (sep == -1)
|
||||
{
|
||||
methodName = "main";
|
||||
@@ -455,7 +455,7 @@ public class CronParser
|
||||
throw new Exception("Invalid Java method name on line: " + line);
|
||||
}
|
||||
}
|
||||
String[] args = new String[argsList.size()];
|
||||
final String[] args = new String[argsList.size()];
|
||||
for (int i = 0; i < argsList.size(); i++)
|
||||
{
|
||||
args[i] = argsList.get(i);
|
||||
@@ -465,7 +465,7 @@ public class CronParser
|
||||
else
|
||||
{
|
||||
// External command.
|
||||
String[] cmdarray = new String[1 + argsList.size()];
|
||||
final String[] cmdarray = new String[1 + argsList.size()];
|
||||
cmdarray[0] = command;
|
||||
for (int i = 0; i < argsList.size(); i++)
|
||||
{
|
||||
@@ -493,7 +493,7 @@ public class CronParser
|
||||
}
|
||||
}
|
||||
// Builds the task.
|
||||
ProcessTask process = new ProcessTask(cmdarray, envs, dir);
|
||||
final ProcessTask process = new ProcessTask(cmdarray, envs, dir);
|
||||
// Channels.
|
||||
if (stdinFile != null)
|
||||
{
|
||||
@@ -520,15 +520,15 @@ public class CronParser
|
||||
*/
|
||||
private static String escape(String str)
|
||||
{
|
||||
int size = str.length();
|
||||
StringBuilder b = new StringBuilder();
|
||||
final int size = str.length();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
int skip = 0;
|
||||
char c = str.charAt(i);
|
||||
final char c = str.charAt(i);
|
||||
if ((c == '\\') && (i < (size - 1)))
|
||||
{
|
||||
char d = str.charAt(i + 1);
|
||||
final char d = str.charAt(i + 1);
|
||||
if (d == '"')
|
||||
{
|
||||
b.append('"');
|
||||
@@ -573,10 +573,10 @@ public class CronParser
|
||||
{
|
||||
if (i < (size - 5))
|
||||
{
|
||||
String hex = str.substring(i + 2, i + 6);
|
||||
final String hex = str.substring(i + 2, i + 6);
|
||||
try
|
||||
{
|
||||
int code = Integer.parseInt(hex, 16);
|
||||
final int code = Integer.parseInt(hex, 16);
|
||||
if (code >= 0)
|
||||
{
|
||||
b.append((char) code);
|
||||
|
@@ -60,8 +60,8 @@ class FileTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized File[] getFiles()
|
||||
{
|
||||
int size = files.size();
|
||||
File[] ret = new File[size];
|
||||
final int size = files.size();
|
||||
final File[] ret = new File[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ret[i] = files.get(i);
|
||||
@@ -75,11 +75,11 @@ class FileTaskCollector implements TaskCollector
|
||||
@Override
|
||||
public synchronized TaskTable getTasks()
|
||||
{
|
||||
TaskTable ret = new TaskTable();
|
||||
int size = files.size();
|
||||
final TaskTable ret = new TaskTable();
|
||||
final int size = files.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
File f = files.get(i);
|
||||
final File f = files.get(i);
|
||||
TaskTable aux = null;
|
||||
try
|
||||
{
|
||||
@@ -87,12 +87,12 @@ class FileTaskCollector implements TaskCollector
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Exception e1 = new Exception("Cannot parse cron file: " + f.getAbsolutePath(), e);
|
||||
final Exception e1 = new Exception("Cannot parse cron file: " + f.getAbsolutePath(), e);
|
||||
e1.printStackTrace();
|
||||
}
|
||||
if (aux != null)
|
||||
{
|
||||
int auxSize = aux.size();
|
||||
final int auxSize = aux.size();
|
||||
for (int j = 0; j < auxSize; j++)
|
||||
{
|
||||
ret.add(aux.getSchedulingPattern(j), aux.getTask(j));
|
||||
|
@@ -41,7 +41,7 @@ class GUIDGenerator
|
||||
*/
|
||||
public static String generate()
|
||||
{
|
||||
StringBuilder id = new StringBuilder();
|
||||
final StringBuilder id = new StringBuilder();
|
||||
encode(id, MACHINE_DESCRIPTOR);
|
||||
encode(id, Runtime.getRuntime());
|
||||
encode(id, Thread.currentThread());
|
||||
@@ -56,7 +56,7 @@ class GUIDGenerator
|
||||
*/
|
||||
private static String getMachineDescriptor()
|
||||
{
|
||||
StringBuilder descriptor = new StringBuilder();
|
||||
final StringBuilder descriptor = new StringBuilder();
|
||||
descriptor.append(System.getProperty("os.name"));
|
||||
descriptor.append("::");
|
||||
descriptor.append(System.getProperty("os.arch"));
|
||||
@@ -65,7 +65,7 @@ class GUIDGenerator
|
||||
descriptor.append("::");
|
||||
descriptor.append(System.getProperty("user.name"));
|
||||
descriptor.append("::");
|
||||
StringBuilder b = buildNetworkInterfaceDescriptor();
|
||||
final StringBuilder b = buildNetworkInterfaceDescriptor();
|
||||
if (b != null)
|
||||
{
|
||||
descriptor.append(b);
|
||||
@@ -102,13 +102,13 @@ class GUIDGenerator
|
||||
// not available
|
||||
return null;
|
||||
}
|
||||
StringBuilder b = new StringBuilder();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
while (e1.hasMoreElements())
|
||||
{
|
||||
NetworkInterface ni = (NetworkInterface) e1.nextElement();
|
||||
StringBuilder b1 = getMACAddressDescriptor(ni);
|
||||
StringBuilder b2 = getInetAddressDescriptor(ni);
|
||||
StringBuilder b3 = new StringBuilder();
|
||||
final NetworkInterface ni = (NetworkInterface) e1.nextElement();
|
||||
final StringBuilder b1 = getMACAddressDescriptor(ni);
|
||||
final StringBuilder b2 = getInetAddressDescriptor(ni);
|
||||
final StringBuilder b3 = new StringBuilder();
|
||||
if (b1 != null)
|
||||
{
|
||||
b3.append(b1);
|
||||
@@ -150,7 +150,7 @@ class GUIDGenerator
|
||||
// not available.
|
||||
haddr = null;
|
||||
}
|
||||
StringBuilder b = new StringBuilder();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
if (haddr != null)
|
||||
{
|
||||
for (byte element : haddr)
|
||||
@@ -159,7 +159,7 @@ class GUIDGenerator
|
||||
{
|
||||
b.append("-");
|
||||
}
|
||||
String hex = Integer.toHexString(0xff & element);
|
||||
final String hex = Integer.toHexString(0xff & element);
|
||||
if (hex.length() == 1)
|
||||
{
|
||||
b.append('0');
|
||||
@@ -177,11 +177,11 @@ class GUIDGenerator
|
||||
*/
|
||||
private static StringBuilder getInetAddressDescriptor(NetworkInterface ni)
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
Enumeration<?> e2 = ni.getInetAddresses();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
final Enumeration<?> e2 = ni.getInetAddresses();
|
||||
while (e2.hasMoreElements())
|
||||
{
|
||||
InetAddress addr = (InetAddress) e2.nextElement();
|
||||
final InetAddress addr = (InetAddress) e2.nextElement();
|
||||
if (b.length() > 0)
|
||||
{
|
||||
b.append(',');
|
||||
@@ -217,8 +217,8 @@ class GUIDGenerator
|
||||
*/
|
||||
private static void encode(StringBuilder b, int value)
|
||||
{
|
||||
String hex = Integer.toHexString(value);
|
||||
int hexSize = hex.length();
|
||||
final String hex = Integer.toHexString(value);
|
||||
final int hexSize = hex.length();
|
||||
for (int i = 8; i > hexSize; i--)
|
||||
{
|
||||
b.append('0');
|
||||
@@ -233,8 +233,8 @@ class GUIDGenerator
|
||||
*/
|
||||
private static void encode(StringBuilder b, long value)
|
||||
{
|
||||
String hex = Long.toHexString(value);
|
||||
int hexSize = hex.length();
|
||||
final String hex = Long.toHexString(value);
|
||||
final int hexSize = hex.length();
|
||||
for (int i = 16; i > hexSize; i--)
|
||||
{
|
||||
b.append('0');
|
||||
|
@@ -39,7 +39,7 @@ class IntArrayValueMatcher implements ValueMatcher
|
||||
*/
|
||||
public IntArrayValueMatcher(List<?> integers)
|
||||
{
|
||||
int size = integers.size();
|
||||
final int size = integers.size();
|
||||
values = new int[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
|
@@ -57,7 +57,7 @@ class LauncherThread extends Thread
|
||||
this.collectors = collectors;
|
||||
this.referenceTimeInMillis = referenceTimeInMillis;
|
||||
// Thread name.
|
||||
String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::launcher[" + guid + "]";
|
||||
final String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::launcher[" + guid + "]";
|
||||
setName(name);
|
||||
}
|
||||
|
||||
@@ -78,18 +78,18 @@ class LauncherThread extends Thread
|
||||
{
|
||||
outer: for (TaskCollector collector : collectors)
|
||||
{
|
||||
TaskTable taskTable = collector.getTasks();
|
||||
int size = taskTable.size();
|
||||
final TaskTable taskTable = collector.getTasks();
|
||||
final int size = taskTable.size();
|
||||
for (int j = 0; j < size; j++)
|
||||
{
|
||||
if (isInterrupted())
|
||||
{
|
||||
break outer;
|
||||
}
|
||||
SchedulingPattern pattern = taskTable.getSchedulingPattern(j);
|
||||
final SchedulingPattern pattern = taskTable.getSchedulingPattern(j);
|
||||
if (pattern.match(scheduler.getTimeZone(), referenceTimeInMillis))
|
||||
{
|
||||
Task task = taskTable.getTask(j);
|
||||
final Task task = taskTable.getTask(j);
|
||||
scheduler.spawnExecutor(task);
|
||||
}
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ class MemoryTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized String add(SchedulingPattern pattern, Task task)
|
||||
{
|
||||
String id = GUIDGenerator.generate();
|
||||
final String id = GUIDGenerator.generate();
|
||||
patterns.add(pattern);
|
||||
tasks.add(task);
|
||||
ids.add(id);
|
||||
@@ -80,7 +80,7 @@ class MemoryTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized void update(String id, SchedulingPattern pattern)
|
||||
{
|
||||
int index = ids.indexOf(id);
|
||||
final int index = ids.indexOf(id);
|
||||
if (index > -1)
|
||||
{
|
||||
patterns.set(index, pattern);
|
||||
@@ -94,7 +94,7 @@ class MemoryTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized void remove(String id) throws IndexOutOfBoundsException
|
||||
{
|
||||
int index = ids.indexOf(id);
|
||||
final int index = ids.indexOf(id);
|
||||
if (index > -1)
|
||||
{
|
||||
tasks.remove(index);
|
||||
@@ -110,7 +110,7 @@ class MemoryTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized Task getTask(String id)
|
||||
{
|
||||
int index = ids.indexOf(id);
|
||||
final int index = ids.indexOf(id);
|
||||
if (index > -1)
|
||||
{
|
||||
return tasks.get(index);
|
||||
@@ -125,7 +125,7 @@ class MemoryTaskCollector implements TaskCollector
|
||||
*/
|
||||
public synchronized SchedulingPattern getSchedulingPattern(String id)
|
||||
{
|
||||
int index = ids.indexOf(id);
|
||||
final int index = ids.indexOf(id);
|
||||
if (index > -1)
|
||||
{
|
||||
return patterns.get(index);
|
||||
@@ -139,12 +139,12 @@ class MemoryTaskCollector implements TaskCollector
|
||||
@Override
|
||||
public synchronized TaskTable getTasks()
|
||||
{
|
||||
TaskTable ret = new TaskTable();
|
||||
int size = tasks.size();
|
||||
final TaskTable ret = new TaskTable();
|
||||
final int size = tasks.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
Task t = tasks.get(i);
|
||||
SchedulingPattern p = patterns.get(i);
|
||||
final Task t = tasks.get(i);
|
||||
final SchedulingPattern p = patterns.get(i);
|
||||
ret.add(p, t);
|
||||
}
|
||||
return ret;
|
||||
|
@@ -131,8 +131,8 @@ public class PastPredictor
|
||||
return _time;
|
||||
}
|
||||
// Go through the matcher groups.
|
||||
int size = _schedulingPattern.matcherSize;
|
||||
long[] times = new long[size];
|
||||
final int size = _schedulingPattern.matcherSize;
|
||||
final long[] times = new long[size];
|
||||
for (int k = 0; k < size; k++)
|
||||
{
|
||||
// Ok, split the time!
|
||||
@@ -145,11 +145,11 @@ public class PastPredictor
|
||||
int month = c.get(Calendar.MONTH);
|
||||
int year = c.get(Calendar.YEAR);
|
||||
// Gets the matchers.
|
||||
ValueMatcher minuteMatcher = _schedulingPattern.minuteMatchers.get(k);
|
||||
ValueMatcher hourMatcher = _schedulingPattern.hourMatchers.get(k);
|
||||
ValueMatcher dayOfMonthMatcher = _schedulingPattern.dayOfMonthMatchers.get(k);
|
||||
ValueMatcher dayOfWeekMatcher = _schedulingPattern.dayOfWeekMatchers.get(k);
|
||||
ValueMatcher monthMatcher = _schedulingPattern.monthMatchers.get(k);
|
||||
final ValueMatcher minuteMatcher = _schedulingPattern.minuteMatchers.get(k);
|
||||
final ValueMatcher hourMatcher = _schedulingPattern.hourMatchers.get(k);
|
||||
final ValueMatcher dayOfMonthMatcher = _schedulingPattern.dayOfMonthMatchers.get(k);
|
||||
final ValueMatcher dayOfWeekMatcher = _schedulingPattern.dayOfWeekMatchers.get(k);
|
||||
final ValueMatcher monthMatcher = _schedulingPattern.monthMatchers.get(k);
|
||||
for (;;)
|
||||
{ // day of week
|
||||
for (;;)
|
||||
@@ -195,7 +195,7 @@ public class PastPredictor
|
||||
}
|
||||
if (dayOfMonthMatcher instanceof DayOfMonthValueMatcher)
|
||||
{
|
||||
DayOfMonthValueMatcher aux = (DayOfMonthValueMatcher) dayOfMonthMatcher;
|
||||
final DayOfMonthValueMatcher aux = (DayOfMonthValueMatcher) dayOfMonthMatcher;
|
||||
if (aux.match(dayOfMonth, month + 1, c.isLeapYear(year)))
|
||||
{
|
||||
break;
|
||||
@@ -267,7 +267,7 @@ public class PastPredictor
|
||||
continue;
|
||||
}
|
||||
// Day of week.
|
||||
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
final int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
if (dayOfWeekMatcher.match(dayOfWeek - 1))
|
||||
{
|
||||
break;
|
||||
|
@@ -69,7 +69,7 @@ public class Predictor
|
||||
public Predictor(String schedulingPattern, long start) throws InvalidPatternException
|
||||
{
|
||||
this.schedulingPattern = new SchedulingPattern(schedulingPattern);
|
||||
this.time = (start / (1000 * 60)) * 1000 * 60;
|
||||
time = (start / (1000 * 60)) * 1000 * 60;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ public class Predictor
|
||||
public Predictor(SchedulingPattern schedulingPattern, long start)
|
||||
{
|
||||
this.schedulingPattern = schedulingPattern;
|
||||
this.time = (start / (1000 * 60)) * 1000 * 60;
|
||||
time = (start / (1000 * 60)) * 1000 * 60;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,8 +150,8 @@ public class Predictor
|
||||
return time;
|
||||
}
|
||||
// Go through the matcher groups.
|
||||
int size = schedulingPattern.matcherSize;
|
||||
long[] times = new long[size];
|
||||
final int size = schedulingPattern.matcherSize;
|
||||
final long[] times = new long[size];
|
||||
for (int k = 0; k < size; k++)
|
||||
{
|
||||
// Ok, split the time!
|
||||
@@ -164,11 +164,11 @@ public class Predictor
|
||||
int month = c.get(Calendar.MONTH);
|
||||
int year = c.get(Calendar.YEAR);
|
||||
// Gets the matchers.
|
||||
ValueMatcher minuteMatcher = schedulingPattern.minuteMatchers.get(k);
|
||||
ValueMatcher hourMatcher = schedulingPattern.hourMatchers.get(k);
|
||||
ValueMatcher dayOfMonthMatcher = schedulingPattern.dayOfMonthMatchers.get(k);
|
||||
ValueMatcher dayOfWeekMatcher = schedulingPattern.dayOfWeekMatchers.get(k);
|
||||
ValueMatcher monthMatcher = schedulingPattern.monthMatchers.get(k);
|
||||
final ValueMatcher minuteMatcher = schedulingPattern.minuteMatchers.get(k);
|
||||
final ValueMatcher hourMatcher = schedulingPattern.hourMatchers.get(k);
|
||||
final ValueMatcher dayOfMonthMatcher = schedulingPattern.dayOfMonthMatchers.get(k);
|
||||
final ValueMatcher dayOfWeekMatcher = schedulingPattern.dayOfWeekMatchers.get(k);
|
||||
final ValueMatcher monthMatcher = schedulingPattern.monthMatchers.get(k);
|
||||
for (;;)
|
||||
{ // day of week
|
||||
for (;;)
|
||||
@@ -214,7 +214,7 @@ public class Predictor
|
||||
}
|
||||
if (dayOfMonthMatcher instanceof DayOfMonthValueMatcher)
|
||||
{
|
||||
DayOfMonthValueMatcher aux = (DayOfMonthValueMatcher) dayOfMonthMatcher;
|
||||
final DayOfMonthValueMatcher aux = (DayOfMonthValueMatcher) dayOfMonthMatcher;
|
||||
if (aux.match(dayOfMonth, month + 1, c.isLeapYear(year)))
|
||||
{
|
||||
break;
|
||||
@@ -252,9 +252,9 @@ public class Predictor
|
||||
c.set(Calendar.MONTH, month);
|
||||
c.set(Calendar.YEAR, year);
|
||||
// Day-of-month/month/year compatibility check.
|
||||
int oldDayOfMonth = dayOfMonth;
|
||||
int oldMonth = month;
|
||||
int oldYear = year;
|
||||
final int oldDayOfMonth = dayOfMonth;
|
||||
final int oldMonth = month;
|
||||
final int oldYear = year;
|
||||
dayOfMonth = c.get(Calendar.DAY_OF_MONTH);
|
||||
month = c.get(Calendar.MONTH);
|
||||
year = c.get(Calendar.YEAR);
|
||||
@@ -264,7 +264,7 @@ public class Predictor
|
||||
continue;
|
||||
}
|
||||
// Day of week.
|
||||
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
final int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||
if (dayOfWeekMatcher.match(dayOfWeek - 1))
|
||||
{
|
||||
break;
|
||||
|
@@ -241,22 +241,22 @@ public class ProcessTask extends Task
|
||||
{
|
||||
throw new RuntimeException(toString() + " cannot be started", e);
|
||||
}
|
||||
InputStream in = buildInputStream(stdinFile);
|
||||
OutputStream out = buildOutputStream(stdoutFile);
|
||||
OutputStream err = buildOutputStream(stderrFile);
|
||||
final InputStream in = buildInputStream(stdinFile);
|
||||
final OutputStream out = buildOutputStream(stdoutFile);
|
||||
final OutputStream err = buildOutputStream(stderrFile);
|
||||
if (in != null)
|
||||
{
|
||||
StreamBridge b = new StreamBridge(in, p.getOutputStream());
|
||||
final StreamBridge b = new StreamBridge(in, p.getOutputStream());
|
||||
b.start();
|
||||
}
|
||||
if (out != null)
|
||||
{
|
||||
StreamBridge b = new StreamBridge(p.getInputStream(), out);
|
||||
final StreamBridge b = new StreamBridge(p.getInputStream(), out);
|
||||
b.start();
|
||||
}
|
||||
if (err != null)
|
||||
{
|
||||
StreamBridge b = new StreamBridge(p.getErrorStream(), err);
|
||||
final StreamBridge b = new StreamBridge(p.getErrorStream(), err);
|
||||
b.start();
|
||||
}
|
||||
int r;
|
||||
@@ -315,7 +315,7 @@ public class ProcessTask extends Task
|
||||
*/
|
||||
private Process exec() throws IOException
|
||||
{
|
||||
Runtime rt = Runtime.getRuntime();
|
||||
final Runtime rt = Runtime.getRuntime();
|
||||
Process p;
|
||||
try
|
||||
{
|
||||
@@ -385,7 +385,7 @@ public class ProcessTask extends Task
|
||||
{
|
||||
return "null";
|
||||
}
|
||||
StringBuilder b = new StringBuilder();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append('[');
|
||||
for (int i = 0; i < arr.length; i++)
|
||||
{
|
||||
@@ -405,7 +405,7 @@ public class ProcessTask extends Task
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append("Task[");
|
||||
b.append("cmd=");
|
||||
b.append(listStrings(command));
|
||||
|
@@ -66,7 +66,7 @@ class RunnableTask extends Task
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder b = new StringBuilder();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append("Task[");
|
||||
b.append("runnable=");
|
||||
b.append(runnable);
|
||||
|
@@ -162,7 +162,7 @@ public class Scheduler
|
||||
{
|
||||
throw new IllegalStateException("Scheduler already started");
|
||||
}
|
||||
this.daemon = on;
|
||||
daemon = on;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,8 +238,8 @@ public class Scheduler
|
||||
synchronized (collectors)
|
||||
{
|
||||
// Discard the first 2 elements in the list.
|
||||
int size = collectors.size() - 2;
|
||||
TaskCollector[] ret = new TaskCollector[size];
|
||||
final int size = collectors.size() - 2;
|
||||
final TaskCollector[] ret = new TaskCollector[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ret[i] = collectors.get(i + 2);
|
||||
@@ -280,8 +280,8 @@ public class Scheduler
|
||||
{
|
||||
synchronized (listeners)
|
||||
{
|
||||
int size = listeners.size();
|
||||
SchedulerListener[] ret = new SchedulerListener[size];
|
||||
final int size = listeners.size();
|
||||
final SchedulerListener[] ret = new SchedulerListener[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ret[i] = listeners.get(i);
|
||||
@@ -299,8 +299,8 @@ public class Scheduler
|
||||
{
|
||||
synchronized (executors)
|
||||
{
|
||||
int size = executors.size();
|
||||
TaskExecutor[] ret = new TaskExecutor[size];
|
||||
final int size = executors.size();
|
||||
final TaskExecutor[] ret = new TaskExecutor[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ret[i] = executors.get(i);
|
||||
@@ -432,10 +432,10 @@ public class Scheduler
|
||||
@Deprecated
|
||||
public Runnable getTaskRunnable(Object id)
|
||||
{
|
||||
Task task = getTask((String) id);
|
||||
final Task task = getTask((String) id);
|
||||
if (task instanceof RunnableTask)
|
||||
{
|
||||
RunnableTask rt = (RunnableTask) task;
|
||||
final RunnableTask rt = (RunnableTask) task;
|
||||
return rt.getRunnable();
|
||||
}
|
||||
return null;
|
||||
@@ -564,14 +564,14 @@ public class Scheduler
|
||||
TaskCollector[] nowCollectors;
|
||||
synchronized (collectors)
|
||||
{
|
||||
int size = collectors.size();
|
||||
final int size = collectors.size();
|
||||
nowCollectors = new TaskCollector[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
nowCollectors[i] = collectors.get(i);
|
||||
}
|
||||
}
|
||||
LauncherThread l = new LauncherThread(this, nowCollectors, referenceTimeInMillis);
|
||||
final LauncherThread l = new LauncherThread(this, nowCollectors, referenceTimeInMillis);
|
||||
synchronized (launchers)
|
||||
{
|
||||
launchers.add(l);
|
||||
@@ -588,7 +588,7 @@ public class Scheduler
|
||||
*/
|
||||
TaskExecutor spawnExecutor(Task task)
|
||||
{
|
||||
TaskExecutor e = new TaskExecutor(this, task);
|
||||
final TaskExecutor e = new TaskExecutor(this, task);
|
||||
synchronized (executors)
|
||||
{
|
||||
executors.add(e);
|
||||
@@ -629,10 +629,10 @@ public class Scheduler
|
||||
{
|
||||
synchronized (listeners)
|
||||
{
|
||||
int size = listeners.size();
|
||||
final int size = listeners.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SchedulerListener l = listeners.get(i);
|
||||
final SchedulerListener l = listeners.get(i);
|
||||
l.taskLaunching(executor);
|
||||
}
|
||||
}
|
||||
@@ -646,10 +646,10 @@ public class Scheduler
|
||||
{
|
||||
synchronized (listeners)
|
||||
{
|
||||
int size = listeners.size();
|
||||
final int size = listeners.size();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SchedulerListener l = listeners.get(i);
|
||||
final SchedulerListener l = listeners.get(i);
|
||||
l.taskSucceeded(executor);
|
||||
}
|
||||
}
|
||||
@@ -664,12 +664,12 @@ public class Scheduler
|
||||
{
|
||||
synchronized (listeners)
|
||||
{
|
||||
int size = listeners.size();
|
||||
final int size = listeners.size();
|
||||
if (size > 0)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
SchedulerListener l = listeners.get(i);
|
||||
final SchedulerListener l = listeners.get(i);
|
||||
l.taskFailed(executor, exception);
|
||||
}
|
||||
}
|
||||
|
@@ -199,16 +199,16 @@ public class SchedulingPattern
|
||||
*/
|
||||
public SchedulingPattern(String pattern) throws InvalidPatternException
|
||||
{
|
||||
this.asString = pattern;
|
||||
StringTokenizer st1 = new StringTokenizer(pattern, "|");
|
||||
asString = pattern;
|
||||
final StringTokenizer st1 = new StringTokenizer(pattern, "|");
|
||||
if (st1.countTokens() < 1)
|
||||
{
|
||||
throw new InvalidPatternException("invalid pattern: \"" + pattern + "\"");
|
||||
}
|
||||
while (st1.hasMoreTokens())
|
||||
{
|
||||
String localPattern = st1.nextToken();
|
||||
StringTokenizer st2 = new StringTokenizer(localPattern, " \t");
|
||||
final String localPattern = st1.nextToken();
|
||||
final StringTokenizer st2 = new StringTokenizer(localPattern, " \t");
|
||||
if (st2.countTokens() != 5)
|
||||
{
|
||||
throw new InvalidPatternException("invalid pattern: \"" + localPattern + "\"");
|
||||
@@ -270,11 +270,11 @@ public class SchedulingPattern
|
||||
{
|
||||
return new AlwaysTrueValueMatcher();
|
||||
}
|
||||
ArrayList<Object> values = new ArrayList<>();
|
||||
StringTokenizer st = new StringTokenizer(str, ",");
|
||||
final ArrayList<Object> values = new ArrayList<>();
|
||||
final StringTokenizer st = new StringTokenizer(str, ",");
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
String element = st.nextToken();
|
||||
final String element = st.nextToken();
|
||||
ArrayList<Integer> local;
|
||||
try
|
||||
{
|
||||
@@ -286,7 +286,7 @@ public class SchedulingPattern
|
||||
}
|
||||
for (Integer integer : local)
|
||||
{
|
||||
Object value = integer;
|
||||
final Object value = integer;
|
||||
if (!values.contains(value))
|
||||
{
|
||||
values.add(value);
|
||||
@@ -313,8 +313,8 @@ public class SchedulingPattern
|
||||
*/
|
||||
private ArrayList<Integer> parseListElement(String str, ValueParser parser) throws Exception
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(str, "/");
|
||||
int size = st.countTokens();
|
||||
final StringTokenizer st = new StringTokenizer(str, "/");
|
||||
final int size = st.countTokens();
|
||||
if ((size < 1) || (size > 2))
|
||||
{
|
||||
throw new Exception("syntax error");
|
||||
@@ -330,7 +330,7 @@ public class SchedulingPattern
|
||||
}
|
||||
if (size == 2)
|
||||
{
|
||||
String dStr = st.nextToken();
|
||||
final String dStr = st.nextToken();
|
||||
int div;
|
||||
try
|
||||
{
|
||||
@@ -344,7 +344,7 @@ public class SchedulingPattern
|
||||
{
|
||||
throw new Exception("non positive divisor \"" + div + "\"");
|
||||
}
|
||||
ArrayList<Integer> values2 = new ArrayList<>();
|
||||
final ArrayList<Integer> values2 = new ArrayList<>();
|
||||
for (int i = 0; i < values.size(); i += div)
|
||||
{
|
||||
values2.add(values.get(i));
|
||||
@@ -365,22 +365,22 @@ public class SchedulingPattern
|
||||
{
|
||||
if (str.equals("*"))
|
||||
{
|
||||
int min = parser.getMinValue();
|
||||
int max = parser.getMaxValue();
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
final int min = parser.getMinValue();
|
||||
final int max = parser.getMaxValue();
|
||||
final ArrayList<Integer> values = new ArrayList<>();
|
||||
for (int i = min; i <= max; i++)
|
||||
{
|
||||
values.add(i);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
StringTokenizer st = new StringTokenizer(str, "-");
|
||||
int size = st.countTokens();
|
||||
final StringTokenizer st = new StringTokenizer(str, "-");
|
||||
final int size = st.countTokens();
|
||||
if ((size < 1) || (size > 2))
|
||||
{
|
||||
throw new Exception("syntax error");
|
||||
}
|
||||
String v1Str = st.nextToken();
|
||||
final String v1Str = st.nextToken();
|
||||
int v1;
|
||||
try
|
||||
{
|
||||
@@ -392,11 +392,11 @@ public class SchedulingPattern
|
||||
}
|
||||
if (size == 1)
|
||||
{
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
final ArrayList<Integer> values = new ArrayList<>();
|
||||
values.add(v1);
|
||||
return values;
|
||||
}
|
||||
String v2Str = st.nextToken();
|
||||
final String v2Str = st.nextToken();
|
||||
int v2;
|
||||
try
|
||||
{
|
||||
@@ -406,7 +406,7 @@ public class SchedulingPattern
|
||||
{
|
||||
throw new Exception("invalid value \"" + v2Str + "\", " + e.getMessage());
|
||||
}
|
||||
ArrayList<Integer> values = new ArrayList<>();
|
||||
final ArrayList<Integer> values = new ArrayList<>();
|
||||
if (v1 < v2)
|
||||
{
|
||||
for (int i = v1; i <= v2; i++)
|
||||
@@ -416,8 +416,8 @@ public class SchedulingPattern
|
||||
}
|
||||
else if (v1 > v2)
|
||||
{
|
||||
int min = parser.getMinValue();
|
||||
int max = parser.getMaxValue();
|
||||
final int min = parser.getMinValue();
|
||||
final int max = parser.getMaxValue();
|
||||
for (int i = v1; i <= max; i++)
|
||||
{
|
||||
values.add(i);
|
||||
@@ -443,23 +443,23 @@ public class SchedulingPattern
|
||||
*/
|
||||
public boolean match(TimeZone timezone, long millis)
|
||||
{
|
||||
GregorianCalendar gc = new GregorianCalendar();
|
||||
final GregorianCalendar gc = new GregorianCalendar();
|
||||
gc.setTimeInMillis(millis);
|
||||
gc.setTimeZone(timezone);
|
||||
int minute = gc.get(Calendar.MINUTE);
|
||||
int hour = gc.get(Calendar.HOUR_OF_DAY);
|
||||
int dayOfMonth = gc.get(Calendar.DAY_OF_MONTH);
|
||||
int month = gc.get(Calendar.MONTH) + 1;
|
||||
int dayOfWeek = gc.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
int year = gc.get(Calendar.YEAR);
|
||||
final int minute = gc.get(Calendar.MINUTE);
|
||||
final int hour = gc.get(Calendar.HOUR_OF_DAY);
|
||||
final int dayOfMonth = gc.get(Calendar.DAY_OF_MONTH);
|
||||
final int month = gc.get(Calendar.MONTH) + 1;
|
||||
final int dayOfWeek = gc.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
final int year = gc.get(Calendar.YEAR);
|
||||
for (int i = 0; i < matcherSize; i++)
|
||||
{
|
||||
ValueMatcher minuteMatcher = minuteMatchers.get(i);
|
||||
ValueMatcher hourMatcher = hourMatchers.get(i);
|
||||
ValueMatcher dayOfMonthMatcher = dayOfMonthMatchers.get(i);
|
||||
ValueMatcher monthMatcher = monthMatchers.get(i);
|
||||
ValueMatcher dayOfWeekMatcher = dayOfWeekMatchers.get(i);
|
||||
boolean eval = minuteMatcher.match(minute) && hourMatcher.match(hour) && ((dayOfMonthMatcher instanceof DayOfMonthValueMatcher) ? ((DayOfMonthValueMatcher) dayOfMonthMatcher).match(dayOfMonth, month, gc.isLeapYear(year)) : dayOfMonthMatcher.match(dayOfMonth)) && monthMatcher.match(month) && dayOfWeekMatcher.match(dayOfWeek);
|
||||
final ValueMatcher minuteMatcher = minuteMatchers.get(i);
|
||||
final ValueMatcher hourMatcher = hourMatchers.get(i);
|
||||
final ValueMatcher dayOfMonthMatcher = dayOfMonthMatchers.get(i);
|
||||
final ValueMatcher monthMatcher = monthMatchers.get(i);
|
||||
final ValueMatcher dayOfWeekMatcher = dayOfWeekMatchers.get(i);
|
||||
final boolean eval = minuteMatcher.match(minute) && hourMatcher.match(hour) && ((dayOfMonthMatcher instanceof DayOfMonthValueMatcher) ? ((DayOfMonthValueMatcher) dayOfMonthMatcher).match(dayOfMonth, month, gc.isLeapYear(year)) : dayOfMonthMatcher.match(dayOfMonth)) && monthMatcher.match(month) && dayOfWeekMatcher.match(dayOfWeek);
|
||||
if (eval)
|
||||
{
|
||||
return true;
|
||||
|
@@ -76,7 +76,7 @@ class StaticMethodTask extends Task
|
||||
Method methodObject;
|
||||
try
|
||||
{
|
||||
Class<?>[] argTypes = new Class[]
|
||||
final Class<?>[] argTypes = new Class[]
|
||||
{
|
||||
String[].class
|
||||
};
|
||||
@@ -86,7 +86,7 @@ class StaticMethodTask extends Task
|
||||
{
|
||||
throw new RuntimeException("Cannot find a " + methodName + "(String[]) method in class " + className, e);
|
||||
}
|
||||
int modifiers = methodObject.getModifiers();
|
||||
final int modifiers = methodObject.getModifiers();
|
||||
if (!Modifier.isStatic(modifiers))
|
||||
{
|
||||
throw new RuntimeException("The method " + methodName + "(String[]) of the class " + className + " is not static");
|
||||
|
@@ -66,7 +66,7 @@ class StreamBridge
|
||||
{
|
||||
this.in = in;
|
||||
this.out = out;
|
||||
this.thread = new Thread(new Runner());
|
||||
thread = new Thread(new Runner());
|
||||
synchronized (traced)
|
||||
{
|
||||
traced.add(this);
|
||||
|
@@ -100,7 +100,7 @@ public class TaskExecutor
|
||||
{
|
||||
this.scheduler = scheduler;
|
||||
this.task = task;
|
||||
this.context = new MyContext();
|
||||
context = new MyContext();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,8 +135,8 @@ public class TaskExecutor
|
||||
{
|
||||
synchronized (listeners)
|
||||
{
|
||||
int size = listeners.size();
|
||||
TaskExecutorListener[] ret = new TaskExecutorListener[size];
|
||||
final int size = listeners.size();
|
||||
final TaskExecutorListener[] ret = new TaskExecutorListener[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ret[i] = listeners.get(i);
|
||||
@@ -226,7 +226,7 @@ public class TaskExecutor
|
||||
synchronized (lock)
|
||||
{
|
||||
startTime = System.currentTimeMillis();
|
||||
String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::executor[" + guid + "]";
|
||||
final String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::executor[" + guid + "]";
|
||||
thread = new Thread(new Runner());
|
||||
thread.setDaemon(daemon);
|
||||
thread.setName(name);
|
||||
@@ -393,7 +393,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.executionPausing(this);
|
||||
}
|
||||
}
|
||||
@@ -408,7 +408,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.executionResuming(this);
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.executionStopping(this);
|
||||
}
|
||||
}
|
||||
@@ -439,7 +439,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.executionTerminated(this, exception);
|
||||
}
|
||||
}
|
||||
@@ -455,7 +455,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.statusMessageChanged(this, statusMessage);
|
||||
}
|
||||
}
|
||||
@@ -471,7 +471,7 @@ public class TaskExecutor
|
||||
{
|
||||
for (TaskExecutorListener taskExecutorListener : listeners)
|
||||
{
|
||||
TaskExecutorListener l = taskExecutorListener;
|
||||
final TaskExecutorListener l = taskExecutorListener;
|
||||
l.completenessValueChanged(this, completenessValue);
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class TimerThread extends Thread
|
||||
{
|
||||
this.scheduler = scheduler;
|
||||
// Thread name.
|
||||
String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::timer[" + guid + "]";
|
||||
final String name = "cron4j::scheduler[" + scheduler.getGuid() + "]::timer[" + guid + "]";
|
||||
setName(name);
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ class TimerThread extends Thread
|
||||
long done = 0;
|
||||
do
|
||||
{
|
||||
long before = System.currentTimeMillis();
|
||||
final long before = System.currentTimeMillis();
|
||||
sleep(millis - done);
|
||||
long after = System.currentTimeMillis();
|
||||
final long after = System.currentTimeMillis();
|
||||
done += (after - before);
|
||||
}
|
||||
while (done < millis);
|
||||
@@ -91,7 +91,7 @@ class TimerThread extends Thread
|
||||
for (;;)
|
||||
{
|
||||
// Coffee break 'till next minute comes!
|
||||
long sleepTime = (nextMinute - System.currentTimeMillis());
|
||||
final long sleepTime = (nextMinute - System.currentTimeMillis());
|
||||
if (sleepTime > 0)
|
||||
{
|
||||
try
|
||||
|
@@ -48,7 +48,7 @@ class ArrayStack
|
||||
{
|
||||
if ((idx + 1) == data.length)
|
||||
{
|
||||
double[] temp = new double[(int) (data.length * 1.2) + 1];
|
||||
final double[] temp = new double[(int) (data.length * 1.2) + 1];
|
||||
System.arraycopy(data, 0, temp, 0, data.length);
|
||||
data = temp;
|
||||
}
|
||||
|
@@ -162,7 +162,7 @@ public class Expression
|
||||
}
|
||||
case Token.TOKEN_OPERATOR:
|
||||
{
|
||||
Operator op = ((OperatorToken) tok).getOperator();
|
||||
final Operator op = ((OperatorToken) tok).getOperator();
|
||||
if (op.getNumOperands() == 2)
|
||||
{
|
||||
count--;
|
||||
@@ -215,7 +215,7 @@ public class Expression
|
||||
}
|
||||
else if (t.getType() == Token.TOKEN_OPERATOR)
|
||||
{
|
||||
OperatorToken op = (OperatorToken) t;
|
||||
final OperatorToken op = (OperatorToken) t;
|
||||
if (output.size() < op.getOperator().getNumOperands())
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid number of operands available for '" + op.getOperator().getSymbol() + "' operator");
|
||||
@@ -223,27 +223,27 @@ public class Expression
|
||||
if (op.getOperator().getNumOperands() == 2)
|
||||
{
|
||||
/* pop the operands and push the result of the operation */
|
||||
double rightArg = output.pop();
|
||||
double leftArg = output.pop();
|
||||
final double rightArg = output.pop();
|
||||
final double leftArg = output.pop();
|
||||
output.push(op.getOperator().apply(leftArg, rightArg));
|
||||
}
|
||||
else if (op.getOperator().getNumOperands() == 1)
|
||||
{
|
||||
/* pop the operand and push the result of the operation */
|
||||
double arg = output.pop();
|
||||
final double arg = output.pop();
|
||||
output.push(op.getOperator().apply(arg));
|
||||
}
|
||||
}
|
||||
else if (t.getType() == Token.TOKEN_FUNCTION)
|
||||
{
|
||||
FunctionToken func = (FunctionToken) t;
|
||||
final FunctionToken func = (FunctionToken) t;
|
||||
final int numArguments = func.getFunction().getNumArguments();
|
||||
if (output.size() < numArguments)
|
||||
{
|
||||
throw new IllegalArgumentException("Invalid number of arguments available for '" + func.getFunction().getName() + "' function");
|
||||
}
|
||||
/* collect the arguments from the stack */
|
||||
double[] args = new double[numArguments];
|
||||
final double[] args = new double[numArguments];
|
||||
for (int j = numArguments - 1; j >= 0; j--)
|
||||
{
|
||||
args[j] = output.pop();
|
||||
|
@@ -146,7 +146,7 @@ public class ExpressionBuilder
|
||||
|
||||
private void checkOperatorSymbol(Operator op)
|
||||
{
|
||||
String name = op.getSymbol();
|
||||
final String name = op.getSymbol();
|
||||
for (char ch : name.toCharArray())
|
||||
{
|
||||
if (!Operator.isAllowedOperatorChar(ch))
|
||||
|
@@ -86,7 +86,7 @@ public abstract class Function
|
||||
@Deprecated
|
||||
public static char[] getAllowedFunctionCharacters()
|
||||
{
|
||||
char[] chars = new char[53];
|
||||
final char[] chars = new char[53];
|
||||
int count = 0;
|
||||
for (int i = 65; i < 91; i++)
|
||||
{
|
||||
|
@@ -76,7 +76,7 @@ public class Functions
|
||||
@Override
|
||||
public double apply(double... args)
|
||||
{
|
||||
double tan = Math.tan(args[0]);
|
||||
final double tan = Math.tan(args[0]);
|
||||
if (tan == 0d)
|
||||
{
|
||||
throw new ArithmeticException("Division by zero in cotangent!");
|
||||
|
@@ -93,7 +93,7 @@ public abstract class Operator
|
||||
public Operator(String symbol, int numberOfOperands, boolean leftAssociative, int precedence)
|
||||
{
|
||||
super();
|
||||
this.numOperands = numberOfOperands;
|
||||
numOperands = numberOfOperands;
|
||||
this.leftAssociative = leftAssociative;
|
||||
this.symbol = symbol;
|
||||
this.precedence = precedence;
|
||||
|
@@ -33,7 +33,7 @@ public class OperatorToken extends Token
|
||||
{
|
||||
throw new IllegalArgumentException("Operator is unknown for token.");
|
||||
}
|
||||
this.operator = op;
|
||||
operator = op;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -43,7 +43,7 @@ public class ShuntingYard
|
||||
final Tokenizer tokenizer = new Tokenizer(expression, userFunctions, userOperators, variableNames, implicitMultiplication);
|
||||
while (tokenizer.hasNext())
|
||||
{
|
||||
Token token = tokenizer.nextToken();
|
||||
final Token token = tokenizer.nextToken();
|
||||
switch (token.getType())
|
||||
{
|
||||
case Token.TOKEN_NUMBER:
|
||||
@@ -73,8 +73,8 @@ public class ShuntingYard
|
||||
{
|
||||
while (!stack.empty() && (stack.peek().getType() == Token.TOKEN_OPERATOR))
|
||||
{
|
||||
OperatorToken o1 = (OperatorToken) token;
|
||||
OperatorToken o2 = (OperatorToken) stack.peek();
|
||||
final OperatorToken o1 = (OperatorToken) token;
|
||||
final OperatorToken o2 = (OperatorToken) stack.peek();
|
||||
if ((o1.getOperator().getNumOperands() == 1) && (o2.getOperator().getNumOperands() == 2))
|
||||
{
|
||||
break;
|
||||
@@ -117,7 +117,7 @@ public class ShuntingYard
|
||||
}
|
||||
while (!stack.empty())
|
||||
{
|
||||
Token t = stack.pop();
|
||||
final Token t = stack.pop();
|
||||
if ((t.getType() == Token.TOKEN_PARENTHESES_CLOSE) || (t.getType() == Token.TOKEN_PARENTHESES_OPEN))
|
||||
{
|
||||
throw new IllegalArgumentException("Mismatched parentheses detected. Please check the expression");
|
||||
|
@@ -39,7 +39,7 @@ public class Tokenizer
|
||||
public Tokenizer(String expression, Map<String, Function> userFunctions, Map<String, Operator> userOperators, Set<String> variableNames, boolean implicitMultiplication)
|
||||
{
|
||||
this.expression = expression.trim().toCharArray();
|
||||
this.expressionLength = this.expression.length;
|
||||
expressionLength = this.expression.length;
|
||||
this.userFunctions = userFunctions;
|
||||
this.userOperators = userOperators;
|
||||
this.variableNames = variableNames;
|
||||
@@ -49,16 +49,16 @@ public class Tokenizer
|
||||
public Tokenizer(String expression, Map<String, Function> userFunctions, Map<String, Operator> userOperators, Set<String> variableNames)
|
||||
{
|
||||
this.expression = expression.trim().toCharArray();
|
||||
this.expressionLength = this.expression.length;
|
||||
expressionLength = this.expression.length;
|
||||
this.userFunctions = userFunctions;
|
||||
this.userOperators = userOperators;
|
||||
this.variableNames = variableNames;
|
||||
this.implicitMultiplication = true;
|
||||
implicitMultiplication = true;
|
||||
}
|
||||
|
||||
public boolean hasNext()
|
||||
{
|
||||
return this.expression.length > pos;
|
||||
return expression.length > pos;
|
||||
}
|
||||
|
||||
public Token nextToken()
|
||||
@@ -124,8 +124,8 @@ public class Tokenizer
|
||||
|
||||
private Token parseArgumentSeparatorToken(char ch)
|
||||
{
|
||||
this.pos++;
|
||||
this.lastToken = new ArgumentSeparatorToken();
|
||||
pos++;
|
||||
lastToken = new ArgumentSeparatorToken();
|
||||
return lastToken;
|
||||
}
|
||||
|
||||
@@ -138,13 +138,13 @@ public class Tokenizer
|
||||
{
|
||||
if (open)
|
||||
{
|
||||
this.lastToken = new OpenParenthesesToken();
|
||||
lastToken = new OpenParenthesesToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastToken = new CloseParenthesesToken();
|
||||
lastToken = new CloseParenthesesToken();
|
||||
}
|
||||
this.pos++;
|
||||
pos++;
|
||||
return lastToken;
|
||||
}
|
||||
|
||||
@@ -160,19 +160,19 @@ public class Tokenizer
|
||||
|
||||
private Token parseFunctionOrVariable()
|
||||
{
|
||||
final int offset = this.pos;
|
||||
final int offset = pos;
|
||||
int testPos;
|
||||
int lastValidLen = 1;
|
||||
Token lastValidToken = null;
|
||||
int len = 1;
|
||||
if (isEndOfExpression(offset))
|
||||
{
|
||||
this.pos++;
|
||||
pos++;
|
||||
}
|
||||
testPos = (offset + len) - 1;
|
||||
while (!isEndOfExpression(testPos) && isVariableOrFunctionCharacter(expression[testPos]))
|
||||
{
|
||||
String name = new String(expression, offset, len);
|
||||
final String name = new String(expression, offset, len);
|
||||
if ((variableNames != null) && variableNames.contains(name))
|
||||
{
|
||||
lastValidLen = len;
|
||||
@@ -202,9 +202,9 @@ public class Tokenizer
|
||||
private Function getFunction(String name)
|
||||
{
|
||||
Function f = null;
|
||||
if (this.userFunctions != null)
|
||||
if (userFunctions != null)
|
||||
{
|
||||
f = this.userFunctions.get(name);
|
||||
f = userFunctions.get(name);
|
||||
}
|
||||
if (f == null)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ public class Tokenizer
|
||||
|
||||
private Token parseOperatorToken(char firstChar)
|
||||
{
|
||||
final int offset = this.pos;
|
||||
final int offset = pos;
|
||||
int len = 1;
|
||||
final StringBuilder symbol = new StringBuilder();
|
||||
Operator lastValid = null;
|
||||
@@ -228,7 +228,7 @@ public class Tokenizer
|
||||
|
||||
while (symbol.length() > 0)
|
||||
{
|
||||
Operator op = getOperator(symbol.toString());
|
||||
final Operator op = getOperator(symbol.toString());
|
||||
if (op == null)
|
||||
{
|
||||
symbol.setLength(symbol.length() - 1);
|
||||
@@ -248,9 +248,9 @@ public class Tokenizer
|
||||
private Operator getOperator(String symbol)
|
||||
{
|
||||
Operator op = null;
|
||||
if (this.userOperators != null)
|
||||
if (userOperators != null)
|
||||
{
|
||||
op = this.userOperators.get(symbol);
|
||||
op = userOperators.get(symbol);
|
||||
}
|
||||
if ((op == null) && (symbol.length() == 1))
|
||||
{
|
||||
@@ -261,7 +261,7 @@ public class Tokenizer
|
||||
}
|
||||
else
|
||||
{
|
||||
int lastTokenType = lastToken.getType();
|
||||
final int lastTokenType = lastToken.getType();
|
||||
if ((lastTokenType == Token.TOKEN_PARENTHESES_OPEN) || (lastTokenType == Token.TOKEN_SEPARATOR))
|
||||
{
|
||||
argc = 1;
|
||||
@@ -283,9 +283,9 @@ public class Tokenizer
|
||||
|
||||
private Token parseNumberToken(char firstChar)
|
||||
{
|
||||
final int offset = this.pos;
|
||||
final int offset = pos;
|
||||
int len = 1;
|
||||
this.pos++;
|
||||
pos++;
|
||||
if (isEndOfExpression(offset + len))
|
||||
{
|
||||
lastToken = new NumberToken(Double.parseDouble(String.valueOf(firstChar)));
|
||||
@@ -294,7 +294,7 @@ public class Tokenizer
|
||||
while (!isEndOfExpression(offset + len) && isNumeric(expression[offset + len], (expression[(offset + len) - 1] == 'e') || (expression[(offset + len) - 1] == 'E')))
|
||||
{
|
||||
len++;
|
||||
this.pos++;
|
||||
pos++;
|
||||
}
|
||||
// check if the e is at the end
|
||||
if ((expression[(offset + len) - 1] == 'e') || (expression[(offset + len) - 1] == 'E'))
|
||||
@@ -324,6 +324,6 @@ public class Tokenizer
|
||||
|
||||
private boolean isEndOfExpression(int offset)
|
||||
{
|
||||
return this.expressionLength <= offset;
|
||||
return expressionLength <= offset;
|
||||
}
|
||||
}
|
||||
|
@@ -14,15 +14,15 @@ public class UnknownFunctionOrVariableException extends IllegalArgumentException
|
||||
public UnknownFunctionOrVariableException(String expression, int position, int length)
|
||||
{
|
||||
this.expression = expression;
|
||||
this.token = token(expression, position, length);
|
||||
token = token(expression, position, length);
|
||||
this.position = position;
|
||||
this.message = "Unknown function or variable '" + token + "' at pos " + position + " in expression '" + expression + "'";
|
||||
message = "Unknown function or variable '" + token + "' at pos " + position + " in expression '" + expression + "'";
|
||||
}
|
||||
|
||||
private static String token(String expression, int position, int length)
|
||||
{
|
||||
|
||||
int len = expression.length();
|
||||
final int len = expression.length();
|
||||
int end = (position + length) - 1;
|
||||
|
||||
if (len < end)
|
||||
|
@@ -75,7 +75,7 @@ public class RequestAuthLogin implements IIncomingPacket<LoginClient>
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] decrypted = new byte[_newAuthMethod ? 256 : 128];
|
||||
final byte[] decrypted = new byte[_newAuthMethod ? 256 : 128];
|
||||
try
|
||||
{
|
||||
final Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
|
||||
|
@@ -64,7 +64,7 @@ public class RequestCmdLogin implements IIncomingPacket<LoginClient>
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] decrypted = new byte[128];
|
||||
final byte[] decrypted = new byte[128];
|
||||
try
|
||||
{
|
||||
final Cipher rsaCipher = Cipher.getInstance("RSA/ECB/nopadding");
|
||||
|
@@ -33,9 +33,9 @@ public class RequestPIAgreementCheck implements IIncomingPacket<LoginClient>
|
||||
public boolean read(LoginClient client, PacketReader packet)
|
||||
{
|
||||
_accountId = packet.readD();
|
||||
byte[] padding0 = new byte[3];
|
||||
byte[] checksum = new byte[4];
|
||||
byte[] padding1 = new byte[12];
|
||||
final byte[] padding0 = new byte[3];
|
||||
final byte[] checksum = new byte[4];
|
||||
final byte[] padding1 = new byte[12];
|
||||
packet.readB(padding0, 0, padding0.length);
|
||||
packet.readB(checksum, 0, checksum.length);
|
||||
packet.readB(padding1, 0, padding1.length);
|
||||
|
@@ -84,14 +84,14 @@ public class Gui
|
||||
txtrConsole.getDocument().addDocumentListener(new LimitLinesDocumentListener(500));
|
||||
|
||||
// Initialize menu items.
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
final JMenuBar menuBar = new JMenuBar();
|
||||
menuBar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
|
||||
|
||||
JMenu mnActions = new JMenu("Actions");
|
||||
final JMenu mnActions = new JMenu("Actions");
|
||||
mnActions.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnActions);
|
||||
|
||||
JMenuItem mntmShutdown = new JMenuItem("Shutdown");
|
||||
final JMenuItem mntmShutdown = new JMenuItem("Shutdown");
|
||||
mntmShutdown.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmShutdown.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public class Gui
|
||||
});
|
||||
mnActions.add(mntmShutdown);
|
||||
|
||||
JMenuItem mntmRestart = new JMenuItem("Restart");
|
||||
final JMenuItem mntmRestart = new JMenuItem("Restart");
|
||||
mntmRestart.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmRestart.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -113,11 +113,11 @@ public class Gui
|
||||
});
|
||||
mnActions.add(mntmRestart);
|
||||
|
||||
JMenu mnReload = new JMenu("Reload");
|
||||
final JMenu mnReload = new JMenu("Reload");
|
||||
mnReload.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnReload);
|
||||
|
||||
JMenuItem mntmBannedIps = new JMenuItem("Banned IPs");
|
||||
final JMenuItem mntmBannedIps = new JMenuItem("Banned IPs");
|
||||
mntmBannedIps.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmBannedIps.addActionListener(arg0 ->
|
||||
{
|
||||
@@ -126,7 +126,7 @@ public class Gui
|
||||
});
|
||||
mnReload.add(mntmBannedIps);
|
||||
|
||||
JMenu mnStatus = new JMenu("Status");
|
||||
final JMenu mnStatus = new JMenu("Status");
|
||||
mnStatus.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnStatus);
|
||||
|
||||
@@ -179,11 +179,11 @@ public class Gui
|
||||
});
|
||||
mnStatus.add(chckbxmntmGmOnly);
|
||||
|
||||
JMenu mnFont = new JMenu("Font");
|
||||
final JMenu mnFont = new JMenu("Font");
|
||||
mnFont.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnFont);
|
||||
|
||||
String[] fonts =
|
||||
final String[] fonts =
|
||||
{
|
||||
"16",
|
||||
"21",
|
||||
@@ -192,33 +192,33 @@ public class Gui
|
||||
};
|
||||
for (String font : fonts)
|
||||
{
|
||||
JMenuItem mntmFont = new JMenuItem(font);
|
||||
final JMenuItem mntmFont = new JMenuItem(font);
|
||||
mntmFont.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmFont.addActionListener(arg0 -> txtrConsole.setFont(new Font("Monospaced", Font.PLAIN, Integer.parseInt(font))));
|
||||
mnFont.add(mntmFont);
|
||||
}
|
||||
|
||||
JMenu mnHelp = new JMenu("Help");
|
||||
final JMenu mnHelp = new JMenu("Help");
|
||||
mnHelp.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
menuBar.add(mnHelp);
|
||||
|
||||
JMenuItem mntmAbout = new JMenuItem("About");
|
||||
final JMenuItem mntmAbout = new JMenuItem("About");
|
||||
mntmAbout.setFont(new Font("Segoe UI", Font.PLAIN, 13));
|
||||
mntmAbout.addActionListener(arg0 -> new frmAbout());
|
||||
mnHelp.add(mntmAbout);
|
||||
|
||||
// Set icons.
|
||||
List<Image> icons = new ArrayList<>();
|
||||
final List<Image> icons = new ArrayList<>();
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_16x16.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_32x32.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_64x64.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_128x128.png").getImage());
|
||||
|
||||
JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
final JScrollPane scrollPanel = new JScrollPane(txtrConsole);
|
||||
scrollPanel.setBounds(0, 0, 800, 550);
|
||||
|
||||
// Set frame.
|
||||
JFrame frame = new JFrame("Mobius - LoginServer");
|
||||
final JFrame frame = new JFrame("Mobius - LoginServer");
|
||||
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
frame.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@@ -266,7 +266,7 @@ public class Gui
|
||||
// Method that manages the redirect.
|
||||
private void redirectSystemStreams()
|
||||
{
|
||||
OutputStream out = new OutputStream()
|
||||
final OutputStream out = new OutputStream()
|
||||
{
|
||||
@Override
|
||||
public void write(int b)
|
||||
|
@@ -57,24 +57,24 @@ public class frmAbout
|
||||
frmAbout.setType(Type.UTILITY);
|
||||
frmAbout.getContentPane().setLayout(null);
|
||||
|
||||
JLabel lblLjmobius = new JLabel("L2jMobius");
|
||||
final JLabel lblLjmobius = new JLabel("L2jMobius");
|
||||
lblLjmobius.setFont(new Font("Tahoma", Font.PLAIN, 32));
|
||||
lblLjmobius.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblLjmobius.setBounds(10, 11, 271, 39);
|
||||
frmAbout.getContentPane().add(lblLjmobius);
|
||||
|
||||
JLabel lblData = new JLabel("2013-" + Calendar.getInstance().get(Calendar.YEAR));
|
||||
final JLabel lblData = new JLabel("2013-" + Calendar.getInstance().get(Calendar.YEAR));
|
||||
lblData.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblData.setBounds(10, 44, 271, 14);
|
||||
frmAbout.getContentPane().add(lblData);
|
||||
|
||||
JLabel lblLoginServer = new JLabel("Login Server");
|
||||
final JLabel lblLoginServer = new JLabel("Login Server");
|
||||
lblLoginServer.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblLoginServer.setFont(new Font("Tahoma", Font.PLAIN, 14));
|
||||
lblLoginServer.setBounds(10, 86, 271, 23);
|
||||
frmAbout.getContentPane().add(lblLoginServer);
|
||||
|
||||
JLabel site = new JLabel(URL);
|
||||
final JLabel site = new JLabel(URL);
|
||||
site.setText("<HTML><FONT color=\"#000099\"><U>" + URL + "</U></FONT></HTML>");
|
||||
site.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
site.setBounds(76, 148, 140, 14);
|
||||
|
@@ -66,7 +66,7 @@ public class DBConfigGUI extends JFrame
|
||||
setDefaultLookAndFeelDecorated(true);
|
||||
|
||||
// Set icons.
|
||||
List<Image> icons = new ArrayList<>();
|
||||
final List<Image> icons = new ArrayList<>();
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_16x16.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_32x32.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_64x64.png").getImage());
|
||||
|
@@ -50,7 +50,7 @@ public class DBInstallerGUI extends JFrame implements DBOutputInterface
|
||||
setDefaultLookAndFeelDecorated(true);
|
||||
|
||||
// Set icons.
|
||||
List<Image> icons = new ArrayList<>();
|
||||
final List<Image> icons = new ArrayList<>();
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_16x16.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_32x32.png").getImage());
|
||||
icons.add(new ImageIcon("..\\images\\l2jmobius_64x64.png").getImage());
|
||||
|
@@ -86,7 +86,7 @@ public class GeoDataConverter
|
||||
{
|
||||
final String input = String.format(_format.getFilename(), rx, ry);
|
||||
final String filepath = Config.GEODATA_PATH;
|
||||
File f = new File(filepath + input);
|
||||
final File f = new File(filepath + input);
|
||||
if (f.exists() && !f.isDirectory())
|
||||
{
|
||||
// load geodata
|
||||
@@ -133,7 +133,7 @@ public class GeoDataConverter
|
||||
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
|
||||
FileChannel fc = raf.getChannel())
|
||||
{
|
||||
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
|
||||
final MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
|
||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
// load 18B header for L2off geodata (1st and 2nd byte...region X and Y)
|
||||
@@ -235,7 +235,7 @@ public class GeoDataConverter
|
||||
for (int y = 0; y < GeoStructure.REGION_CELLS_Y; y++)
|
||||
{
|
||||
// get block
|
||||
ABlock block = _blocks[x / GeoStructure.BLOCK_CELLS_X][y / GeoStructure.BLOCK_CELLS_Y];
|
||||
final ABlock block = _blocks[x / GeoStructure.BLOCK_CELLS_X][y / GeoStructure.BLOCK_CELLS_Y];
|
||||
|
||||
// skip flat blocks
|
||||
if (block instanceof BlockFlat)
|
||||
@@ -280,13 +280,13 @@ public class GeoDataConverter
|
||||
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
|
||||
{
|
||||
// calculate virtual layer height
|
||||
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
|
||||
final short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
|
||||
|
||||
// get NSWE of neighbor cells below virtual layer (NPC/PC can fall down of clif, but can not climb it -> NSWE of cell below)
|
||||
byte nsweN = getNsweBelow(x, y - 1, height);
|
||||
byte nsweS = getNsweBelow(x, y + 1, height);
|
||||
byte nsweW = getNsweBelow(x - 1, y, height);
|
||||
byte nsweE = getNsweBelow(x + 1, y, height);
|
||||
final byte nsweN = getNsweBelow(x, y - 1, height);
|
||||
final byte nsweS = getNsweBelow(x, y + 1, height);
|
||||
final byte nsweW = getNsweBelow(x - 1, y, height);
|
||||
final byte nsweE = getNsweBelow(x + 1, y, height);
|
||||
|
||||
// north-west
|
||||
if ((((nswe & GeoStructure.CELL_FLAG_N) != 0) && ((nsweN & GeoStructure.CELL_FLAG_W) != 0)) || (((nswe & GeoStructure.CELL_FLAG_W) != 0) && ((nsweW & GeoStructure.CELL_FLAG_N) != 0)))
|
||||
|
Reference in New Issue
Block a user