Code style changes.

This commit is contained in:
MobiusDev
2016-04-26 19:21:19 +00:00
parent 6a13705766
commit fc070c9238
768 changed files with 3338 additions and 4252 deletions

View File

@ -80,7 +80,7 @@ public final class Broadcast
try
{
player.sendPacket(mov);
if ((mov instanceof CharInfo) && (character.isPlayer()))
if ((mov instanceof CharInfo) && character.isPlayer())
{
final int relation = ((L2PcInstance) character).getRelation(player);
final Integer oldrelation = character.getKnownList().getKnownRelations().get(player.getObjectId());

View File

@ -49,7 +49,7 @@ public final class Evolve
{
protected static final Logger _log = Logger.getLogger(Evolve.class.getName());
public static final boolean doEvolve(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
public static boolean doEvolve(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
{
if ((itemIdtake == 0) || (itemIdgive == 0) || (petminlvl == 0))
{
@ -160,7 +160,7 @@ public final class Evolve
return true;
}
public static final boolean doRestore(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
public static boolean doRestore(L2PcInstance player, L2Npc npc, int itemIdtake, int itemIdgive, int petminlvl)
{
if ((itemIdtake == 0) || (itemIdgive == 0) || (petminlvl == 0))
{

View File

@ -206,21 +206,17 @@ public final class GeoUtils
return Cell.NSWE_WEST; // Direction.WEST;
}
}
else
// unchanged x
else if (y > lastY)
{
if (y > lastY)
{
return Cell.NSWE_SOUTH; // Direction.SOUTH;
}
else if (y < lastY)
{
return Cell.NSWE_NORTH; // Direction.NORTH;
}
else
{
throw new RuntimeException();
}
return Cell.NSWE_SOUTH; // Direction.SOUTH;
}
else if (y < lastY)
{
return Cell.NSWE_NORTH; // Direction.NORTH;
}
else
{
throw new RuntimeException();
}
}
}

View File

@ -81,21 +81,18 @@ public final class LinePointIterator
return true;
}
}
else
else if (_srcY != _dstY)
{
if (_srcY != _dstY)
_srcY += _sy;
_error += _dx;
if (_error >= _dy)
{
_srcY += _sy;
_error += _dx;
if (_error >= _dy)
{
_srcX += _sx;
_error -= _dy;
}
return true;
_srcX += _sx;
_error -= _dy;
}
return true;
}
return false;

View File

@ -121,28 +121,25 @@ public final class LinePointIterator3D
return true;
}
}
else
else if (_srcZ != _dstZ)
{
if (_srcZ != _dstZ)
_srcZ += _sz;
_error += _dx;
if (_error >= _dz)
{
_srcZ += _sz;
_error += _dx;
if (_error >= _dz)
{
_srcX += _sx;
_error -= _dz;
}
_error2 += _dy;
if (_error2 >= _dz)
{
_srcY += _sy;
_error2 -= _dz;
}
return true;
_srcX += _sx;
_error -= _dz;
}
_error2 += _dy;
if (_error2 >= _dz)
{
_srcY += _sy;
_error2 -= _dz;
}
return true;
}
return false;

View File

@ -45,7 +45,7 @@ public class MinionList
/** List containing the cached deleted minions for reuse */
protected List<L2MonsterInstance> _reusedMinionReferences = null;
private final static List<Integer> KEEP_MINION_AFTER_DEATH_BOSS_IDS = new ArrayList<>();
private static final List<Integer> KEEP_MINION_AFTER_DEATH_BOSS_IDS = new ArrayList<>();
static
{
KEEP_MINION_AFTER_DEATH_BOSS_IDS.add(26094);
@ -323,14 +323,14 @@ public class MinionList
* @param minionId The L2NpcTemplate Identifier of the Minion to spawn
* @return
*/
public static final L2MonsterInstance spawnMinion(L2MonsterInstance master, int minionId)
public static L2MonsterInstance spawnMinion(L2MonsterInstance master, int minionId)
{
// Get the template of the Minion to spawn
final L2NpcTemplate minionTemplate = NpcData.getInstance().getTemplate(minionId);
return minionTemplate == null ? null : initializeNpcInstance(master, new L2MonsterInstance(minionTemplate));
}
protected static final L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion)
protected static L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion)
{
minion.stopAllEffects();
minion.setIsDead(false);

View File

@ -79,7 +79,7 @@ public final class Util
* @param toY
* @return degree value of object 2 to the horizontal line with object 1 being the origin
*/
public static final double calculateAngleFrom(int fromX, int fromY, int toX, int toY)
public static double calculateAngleFrom(int fromX, int fromY, int toX, int toY)
{
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0)
@ -89,12 +89,12 @@ public final class Util
return angleTarget;
}
public static final double convertHeadingToDegree(int clientHeading)
public static double convertHeadingToDegree(int clientHeading)
{
return clientHeading / 182.044444444;
}
public static final int convertDegreeToClientHeading(double degree)
public static int convertDegreeToClientHeading(double degree)
{
if (degree < 0)
{
@ -103,12 +103,12 @@ public final class Util
return (int) (degree * 182.044444444);
}
public static final int calculateHeadingFrom(ILocational from, ILocational to)
public static int calculateHeadingFrom(ILocational from, ILocational to)
{
return calculateHeadingFrom(from.getX(), from.getY(), to.getX(), to.getY());
}
public static final int calculateHeadingFrom(int fromX, int fromY, int toX, int toY)
public static int calculateHeadingFrom(int fromX, int fromY, int toX, int toY)
{
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0)
@ -118,7 +118,7 @@ public final class Util
return (int) (angleTarget * 182.044444444);
}
public static final int calculateHeadingFrom(double dx, double dy)
public static int calculateHeadingFrom(double dx, double dy)
{
double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0)
@ -143,7 +143,7 @@ public final class Util
public static double calculateDistance(double x1, double y1, double z1, double x2, double y2, double z2, boolean includeZAxis, boolean squared)
{
final double distance = Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2) + (includeZAxis ? Math.pow(z1 - z2, 2) : 0);
return (squared) ? distance : Math.sqrt(distance);
return squared ? distance : Math.sqrt(distance);
}
/**
@ -243,7 +243,7 @@ public final class Util
if (includeZAxis)
{
final double dz = obj1.getZ() - obj2.getZ();
d += (dz * dz);
d += dz * dz;
}
return d <= ((range * range) + (2 * range * rad) + (rad * rad));
}
@ -459,7 +459,7 @@ public final class Util
return (new SimpleDateFormat("yyyy-MM-dd")).format(date.getTime());
}
private static final void buildHtmlBypassCache(L2PcInstance player, HtmlActionScope scope, String html)
private static void buildHtmlBypassCache(L2PcInstance player, HtmlActionScope scope, String html)
{
final String htmlLower = html.toLowerCase(Locale.ENGLISH);
int bypassEnd = 0;
@ -491,7 +491,7 @@ public final class Util
}
}
private static final void buildHtmlLinkCache(L2PcInstance player, HtmlActionScope scope, String html)
private static void buildHtmlLinkCache(L2PcInstance player, HtmlActionScope scope, String html)
{
final String htmlLower = html.toLowerCase(Locale.ENGLISH);
int linkEnd = 0;
@ -636,32 +636,29 @@ public final class Util
activeChar.sendPacket(new ShowBoard(html, "1001"));
fillMultiEditContent(activeChar, fillMultiEdit);
}
else if (html.length() < 16250)
{
activeChar.sendPacket(new ShowBoard(html, "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 2))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250), "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 3))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250, 16250 * 2), "102"));
activeChar.sendPacket(new ShowBoard(html.substring(16250 * 2), "103"));
}
else
{
if (html.length() < 16250)
{
activeChar.sendPacket(new ShowBoard(html, "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 2))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250), "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
else if (html.length() < (16250 * 3))
{
activeChar.sendPacket(new ShowBoard(html.substring(0, 16250), "101"));
activeChar.sendPacket(new ShowBoard(html.substring(16250, 16250 * 2), "102"));
activeChar.sendPacket(new ShowBoard(html.substring(16250 * 2), "103"));
}
else
{
activeChar.sendPacket(new ShowBoard("<html><body><br><center>Error: HTML was too long!</center></body></html>", "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
activeChar.sendPacket(new ShowBoard("<html><body><br><center>Error: HTML was too long!</center></body></html>", "101"));
activeChar.sendPacket(new ShowBoard(null, "102"));
activeChar.sendPacket(new ShowBoard(null, "103"));
}
}
@ -689,7 +686,7 @@ public final class Util
final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
{
if ((obj != null) && (playable && (obj.isPlayable() || obj.isPet())))
if ((obj != null) && playable && (obj.isPlayable() || obj.isPet()))
{
if (!invisible && obj.isInvisible())
{
@ -697,7 +694,7 @@ public final class Util
}
final L2Character cha = (L2Character) obj;
if (((cha.getZ() < (npc.getZ() - 100)) && (cha.getZ() > (npc.getZ() + 100))) || !(GeoData.getInstance().canSeeTarget(cha.getX(), cha.getY(), cha.getZ(), npc.getX(), npc.getY(), npc.getZ())))
if (((cha.getZ() < (npc.getZ() - 100)) && (cha.getZ() > (npc.getZ() + 100))) || !GeoData.getInstance().canSeeTarget(cha.getX(), cha.getY(), cha.getZ(), npc.getX(), npc.getY(), npc.getZ()))
{
continue;
}