Small code improvements.
This commit is contained in:
@@ -59,7 +59,7 @@ public class GeoEngine
|
||||
* Returns the instance of the {@link GeoEngine}.
|
||||
* @return {@link GeoEngine} : The instance.
|
||||
*/
|
||||
public static final GeoEngine getInstance()
|
||||
public static GeoEngine getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ public class GeoEngine
|
||||
* @param worldX
|
||||
* @return int : Geo X
|
||||
*/
|
||||
public static final int getGeoX(int worldX)
|
||||
public static int getGeoX(int worldX)
|
||||
{
|
||||
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public class GeoEngine
|
||||
* @param worldY
|
||||
* @return int : Geo Y
|
||||
*/
|
||||
public static final int getGeoY(int worldY)
|
||||
public static int getGeoY(int worldY)
|
||||
{
|
||||
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class GeoEngine
|
||||
* @param geoX
|
||||
* @return int : World X
|
||||
*/
|
||||
public static final int getWorldX(int geoX)
|
||||
public static int getWorldX(int geoX)
|
||||
{
|
||||
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
|
||||
}
|
||||
@@ -254,7 +254,7 @@ public class GeoEngine
|
||||
* @param geoY
|
||||
* @return int : World Y
|
||||
*/
|
||||
public static final int getWorldY(int geoY)
|
||||
public static int getWorldY(int geoY)
|
||||
{
|
||||
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
|
||||
}
|
||||
@@ -362,7 +362,7 @@ public class GeoEngine
|
||||
* @param inside : 2D description of {@link IGeoObject}
|
||||
* @return byte[][] : Returns NSWE flags of {@link IGeoObject}.
|
||||
*/
|
||||
public static final byte[][] calculateGeoObject(boolean inside[][])
|
||||
public static byte[][] calculateGeoObject(boolean inside[][])
|
||||
{
|
||||
// get dimensions
|
||||
final int width = inside.length;
|
||||
@@ -1243,7 +1243,7 @@ public class GeoEngine
|
||||
* @param dirY : Y direction NSWE flag
|
||||
* @return byte : NSWE flag of combined direction
|
||||
*/
|
||||
private static final byte getDirXY(byte dirX, byte dirY)
|
||||
private static byte getDirXY(byte dirX, byte dirY)
|
||||
{
|
||||
// check axis directions
|
||||
if (dirY == GeoStructure.CELL_FLAG_N)
|
||||
|
@@ -170,7 +170,7 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
* @param target : the entry point
|
||||
* @return List<NodeLoc> : list of node location
|
||||
*/
|
||||
private static final List<Location> constructPath(Node target)
|
||||
private static List<Location> constructPath(Node target)
|
||||
{
|
||||
// create empty list
|
||||
LinkedList<Location> list = new LinkedList<>();
|
||||
|
@@ -151,7 +151,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final void addGeoObject(IGeoObject object)
|
||||
final synchronized public void addGeoObject(IGeoObject object)
|
||||
{
|
||||
// add geo object, update block geodata when added
|
||||
if (_objects.add(object))
|
||||
@@ -161,7 +161,7 @@ public final class BlockComplexDynamic extends BlockComplex implements IBlockDyn
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final void removeGeoObject(IGeoObject object)
|
||||
final synchronized public void removeGeoObject(IGeoObject object)
|
||||
{
|
||||
// remove geo object, update block geodata when removed
|
||||
if (_objects.remove(object))
|
||||
|
@@ -34,7 +34,7 @@ public class BlockMultilayer extends ABlock
|
||||
/**
|
||||
* Initializes the temporarily buffer.
|
||||
*/
|
||||
public static final void initialize()
|
||||
public static void initialize()
|
||||
{
|
||||
// initialize temporarily buffer and sorting mechanism
|
||||
_temp = ByteBuffer.allocate(GeoStructure.BLOCK_CELLS * MAX_LAYERS * 3);
|
||||
@@ -44,7 +44,7 @@ public class BlockMultilayer extends ABlock
|
||||
/**
|
||||
* Releases temporarily buffer.
|
||||
*/
|
||||
public static final void release()
|
||||
public static void release()
|
||||
{
|
||||
_temp = null;
|
||||
}
|
||||
|
@@ -196,7 +196,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final void addGeoObject(IGeoObject object)
|
||||
final synchronized public void addGeoObject(IGeoObject object)
|
||||
{
|
||||
// add geo object, update block geodata when added
|
||||
if (_objects.add(object))
|
||||
@@ -206,7 +206,7 @@ public final class BlockMultilayerDynamic extends BlockMultilayer implements IBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final void removeGeoObject(IGeoObject object)
|
||||
final synchronized public void removeGeoObject(IGeoObject object)
|
||||
{
|
||||
// remove geo object, update block geodata when removed
|
||||
if (_objects.remove(object))
|
||||
|
@@ -25,11 +25,11 @@ public interface IBlockDynamic
|
||||
* Adds {@link IGeoObject} to the {@link ABlock}. The block will update geodata according the object.
|
||||
* @param object : {@link IGeoObject} to be added.
|
||||
*/
|
||||
public void addGeoObject(IGeoObject object);
|
||||
void addGeoObject(IGeoObject object);
|
||||
|
||||
/**
|
||||
* Removes {@link IGeoObject} from the {@link ABlock}. The block will update geodata according the object.
|
||||
* @param object : {@link IGeoObject} to be removed.
|
||||
*/
|
||||
public void removeGeoObject(IGeoObject object);
|
||||
void removeGeoObject(IGeoObject object);
|
||||
}
|
@@ -25,29 +25,29 @@ public interface IGeoObject
|
||||
* Returns geodata X coordinate of the {@link IGeoObject}.
|
||||
* @return int : Geodata X coordinate.
|
||||
*/
|
||||
public int getGeoX();
|
||||
int getGeoX();
|
||||
|
||||
/**
|
||||
* Returns geodata Y coordinate of the {@link IGeoObject}.
|
||||
* @return int : Geodata Y coordinate.
|
||||
*/
|
||||
public int getGeoY();
|
||||
int getGeoY();
|
||||
|
||||
/**
|
||||
* Returns geodata Z coordinate of the {@link IGeoObject}.
|
||||
* @return int : Geodata Z coordinate.
|
||||
*/
|
||||
public int getGeoZ();
|
||||
int getGeoZ();
|
||||
|
||||
/**
|
||||
* Returns height of the {@link IGeoObject}.
|
||||
* @return int : Height.
|
||||
*/
|
||||
public int getHeight();
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Returns {@link IGeoObject} data.
|
||||
* @return byte[][] : {@link IGeoObject} data.
|
||||
*/
|
||||
public byte[][] getObjectGeoData();
|
||||
byte[][] getObjectGeoData();
|
||||
}
|
||||
|
@@ -43,12 +43,12 @@ import com.l2jmobius.gameserver.model.events.listeners.ConsumerEventListener;
|
||||
*/
|
||||
public class PremiumManager
|
||||
{
|
||||
private final static Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(PremiumManager.class.getName());
|
||||
|
||||
// SQL Statement
|
||||
private final static String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
|
||||
private final static String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
|
||||
private final static String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
|
||||
private static final String LOAD_SQL = "SELECT account_name,enddate FROM account_premium";
|
||||
private static final String UPDATE_SQL = "UPDATE account_premium SET enddate = ? WHERE account_name = ?";
|
||||
private static final String ADD_SQL = "INSERT INTO account_premium (enddate,account_name) VALUE (?,?)";
|
||||
|
||||
class PremiumExpireTask implements Runnable
|
||||
{
|
||||
|
@@ -70,7 +70,7 @@ public final class GeoDataConverter
|
||||
_format = type.equalsIgnoreCase("J") ? GeoFormat.L2J : GeoFormat.L2OFF;
|
||||
|
||||
// start conversion
|
||||
System.out.println("GeoDataConverter: Converting all " + _format.toString() + " files.");
|
||||
System.out.println("GeoDataConverter: Converting all " + _format + " files.");
|
||||
|
||||
// initialize geodata container
|
||||
_blocks = new ABlock[GeoStructure.REGION_BLOCKS_X][GeoStructure.REGION_BLOCKS_Y];
|
||||
@@ -116,7 +116,7 @@ public final class GeoDataConverter
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("GeoDataConverter: Converted " + converted + " " + _format.toString() + " to L2D region file(s).");
|
||||
System.out.println("GeoDataConverter: Converted " + converted + " " + _format + " to L2D region file(s).");
|
||||
|
||||
// release multilayer block temporarily buffer
|
||||
BlockMultilayer.release();
|
||||
@@ -127,7 +127,7 @@ public final class GeoDataConverter
|
||||
* @param filename : The name of the to load.
|
||||
* @return boolean : True when successful.
|
||||
*/
|
||||
private static final boolean loadGeoBlocks(String filename)
|
||||
private static boolean loadGeoBlocks(String filename)
|
||||
{
|
||||
// region file is load-able, try to load it
|
||||
try (RandomAccessFile raf = new RandomAccessFile(Config.GEODATA_PATH + filename, "r");
|
||||
@@ -217,7 +217,7 @@ public final class GeoDataConverter
|
||||
* Recalculate diagonal flags for the region file.
|
||||
* @return boolean : True when successful.
|
||||
*/
|
||||
private static final boolean recalculateNswe()
|
||||
private static boolean recalculateNswe()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -268,7 +268,7 @@ public final class GeoDataConverter
|
||||
* @param nswe : NSWE flag to be updated.
|
||||
* @return byte : Updated NSWE flag.
|
||||
*/
|
||||
private static final byte updateNsweBelow(int x, int y, short z, byte nswe)
|
||||
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
|
||||
{
|
||||
// calculate virtual layer height
|
||||
short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
|
||||
@@ -306,7 +306,7 @@ public final class GeoDataConverter
|
||||
return nswe;
|
||||
}
|
||||
|
||||
private static final byte getNsweBelow(int geoX, int geoY, short worldZ)
|
||||
private static byte getNsweBelow(int geoX, int geoY, short worldZ)
|
||||
{
|
||||
// out of geo coordinates
|
||||
if ((geoX < 0) || (geoX >= GeoStructure.REGION_CELLS_X))
|
||||
@@ -333,7 +333,7 @@ public final class GeoDataConverter
|
||||
* @param filename : The name of file to save.
|
||||
* @return boolean : True when successful.
|
||||
*/
|
||||
private static final boolean saveGeoBlocks(String filename)
|
||||
private static boolean saveGeoBlocks(String filename)
|
||||
{
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(Config.GEODATA_PATH + filename), GeoStructure.REGION_BLOCKS * GeoStructure.BLOCK_CELLS * 3))
|
||||
{
|
||||
@@ -357,7 +357,7 @@ public final class GeoDataConverter
|
||||
}
|
||||
}
|
||||
|
||||
private static final void loadGeoengineConfigs()
|
||||
private static void loadGeoengineConfigs()
|
||||
{
|
||||
final PropertiesParser geoData = new PropertiesParser(Config.GEODATA_FILE);
|
||||
Config.GEODATA_PATH = geoData.getString("GeoDataPath", "./data/geodata/");
|
||||
|
Reference in New Issue
Block a user