Prohibit parameter assignments.

This commit is contained in:
MobiusDevelopment
2020-05-10 03:29:34 +00:00
parent 2d73110d15
commit 33bbf97afb
1756 changed files with 12542 additions and 10025 deletions

View File

@@ -499,7 +499,7 @@ public class AdminCommands extends Thread
activeChar.sendPacket(adminReply);
}
private void listCharacters(ClientThread client, int page)
private void listCharacters(ClientThread client, int pageValue)
{
final PlayerInstance activeChar = client.getActiveChar();
final Collection<PlayerInstance> allWorldPlayers = World.getInstance().getAllPlayers();
@@ -511,6 +511,7 @@ public class AdminCommands extends Thread
{
++maxPages;
}
int page = pageValue;
if (page > maxPages)
{
page = maxPages;

View File

@@ -396,9 +396,9 @@ public abstract class Creature extends WorldObject
final StatusUpdate su = new StatusUpdate(getObjectId());
su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
su.addAttribute(StatusUpdate.CUR_MP, (int) getCurrentMp());
for (int i = 0; i < list.size(); ++i)
for (Creature element : list)
{
final Creature temp = list.get(i);
final Creature temp = element;
if (!(temp instanceof PlayerInstance))
{
continue;
@@ -881,19 +881,21 @@ public abstract class Creature extends WorldObject
}
}
private synchronized void calculateMovement(int x, int y, int z, double distance)
private synchronized void calculateMovement(int x, int y, int z, double distanceValue)
{
if (isMoving())
{
stopMove();
}
if ((getPawnTarget() != null) && (distance <= getAttackRange()) && (getCurrentState() == CreatureState.FOLLOW))
if ((getPawnTarget() != null) && (distanceValue <= getAttackRange()) && (getCurrentState() == CreatureState.FOLLOW))
{
_moveTask = ThreadPool.schedule(new ArriveTask(this), 3000);
return;
}
int dx = x - getX();
int dy = y - getY();
double distance = distanceValue;
if (_moveOffset > 0)
{
if ((distance - _moveOffset) <= 0.0)
@@ -908,6 +910,7 @@ public abstract class Creature extends WorldObject
dy = (int) (-(Math.sin(angle) * distance));
dx = (int) (-(Math.cos(angle) * distance));
}
if ((distance > 0.0) || (getPawnTarget() != null))
{
final float speed = _effectiveSpeed;

View File

@@ -221,9 +221,8 @@ public class NpcInstance extends Creature
public void insertObjectIdAndShowChatWindow(PlayerInstance player, String content)
{
content = content.replace("%objectId%", String.valueOf(getObjectId()));
final NpcHtmlMessage npcReply = new NpcHtmlMessage(5);
npcReply.setHtml(content);
npcReply.setHtml(content.replace("%objectId%", String.valueOf(getObjectId())));
player.sendPacket(npcReply);
}

View File

@@ -94,8 +94,9 @@ public class PetInstance extends Creature
player.sendPacket(new MyTargetSelected(getObjectId(), player.getLevel() - getLevel()));
}
public void setSummonHp(int hp)
public void setSummonHp(int value)
{
int hp = value;
if (hp == 0)
{
hp = 5000;
@@ -130,31 +131,19 @@ public class PetInstance extends Creature
@Override
public void setWalkSpeed(int walkSpeed)
{
if (walkSpeed < 24)
{
walkSpeed = 24;
}
super.setWalkSpeed(walkSpeed);
super.setWalkSpeed(Math.max(24, walkSpeed));
}
@Override
public void setPhysicalDefense(int pdef)
{
if (pdef < 100)
{
pdef = 100;
}
super.setPhysicalDefense(pdef);
super.setPhysicalDefense(Math.max(100, pdef));
}
@Override
public void setRunSpeed(int runSpeed)
{
if (runSpeed < 125)
{
runSpeed = 125;
}
super.setRunSpeed(runSpeed);
super.setRunSpeed(Math.max(125, runSpeed));
}
public int getPetId()
@@ -322,12 +311,14 @@ public class PetInstance extends Creature
}
@Override
public void setPhysicalAttack(int physicalAttack)
public void setPhysicalAttack(int value)
{
int physicalAttack = value;
if (physicalAttack < 100)
{
physicalAttack = 100;
}
super.setPhysicalAttack(physicalAttack);
_dummyWeapon = new Weapon();
_dummyWeapon.setPDamage(physicalAttack);
@@ -503,9 +494,9 @@ public class PetInstance extends Creature
}
}
public void dropItemHere(ItemInstance dropit)
public void dropItemHere(ItemInstance item)
{
dropit = getInventory().dropItem(dropit.getObjectId(), dropit.getCount());
final ItemInstance dropit = getInventory().dropItem(item.getObjectId(), item.getCount());
if (dropit != null)
{
dropit.setX(getX());
@@ -544,11 +535,7 @@ public class PetInstance extends Creature
public void setAttackRange(int range)
{
if (range < 36)
{
range = 36;
}
_attackRange = range;
_attackRange = Math.max(36, range);
}
public void setFollowStatus(boolean value)

View File

@@ -130,13 +130,14 @@ public class SystemPanel extends JPanel
static String getDurationBreakdown(long millis)
{
final long days = TimeUnit.MILLISECONDS.toDays(millis);
millis -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(millis);
millis -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
millis -= TimeUnit.MINUTES.toMillis(minutes);
final long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
long remaining = millis;
final long days = TimeUnit.MILLISECONDS.toDays(remaining);
remaining -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(remaining);
remaining -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(remaining);
remaining -= TimeUnit.MINUTES.toMillis(minutes);
final long seconds = TimeUnit.MILLISECONDS.toSeconds(remaining);
return (days + "d " + hours + "h " + minutes + "m " + seconds + "s");
}
}

View File

@@ -91,6 +91,7 @@ public class BlowfishEngine
return ((S0[x >>> 24] + S1[(x >>> 16) & 0xFF]) ^ S2[(x >>> 8) & 0xFF]) + S3[x & 0xFF];
}
@SuppressWarnings("all")
private void processTable(int xl, int xr, int[] table)
{
final int size = table.length;

View File

@@ -52,13 +52,14 @@ public class Locator
/**
* Find the directory or jar a given resource has been loaded from.
* @param c the classloader to be consulted for the source.
* @param classLoader the classloader to be consulted for the source.
* @param resource the resource whose location is required.
* @return the file with the resource source or null if we cannot determine the location.
* @since Ant 1.6
*/
public static File getResourceSource(ClassLoader c, String resource)
public static File getResourceSource(ClassLoader classLoader, String resource)
{
ClassLoader c = classLoader;
if (c == null)
{
c = Locator.class.getClassLoader();
@@ -99,12 +100,13 @@ public class Locator
* <p>
* Swallows '%' that are not followed by two characters, doesn't deal with non-ASCII characters.
* </p>
* @param uri the URI designating a file in the local filesystem.
* @param uriValue the URI designating a file in the local filesystem.
* @return the local file system path for the file.
* @since Ant 1.6
*/
public static String fromURI(String uri)
public static String fromURI(String uriValue)
{
String uri = uriValue;
URL url = null;
try
{
@@ -114,10 +116,12 @@ public class Locator
{
// Ignore malformed exception
}
if ((url == null) || !("file".equals(url.getProtocol())))
{
throw new IllegalArgumentException("Can only handle valid file: URIs");
}
final StringBuilder buf = new StringBuilder(url.getHost());
if (buf.length() > 0)
{
@@ -126,13 +130,12 @@ public class Locator
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);
if ((File.pathSeparatorChar == ';') && uri.startsWith("\\") && (uri.length() > 2) && Character.isLetter(uri.charAt(1)) && (uri.lastIndexOf(':') > -1))
{
uri = uri.substring(1);
}
return decodeUri(uri);
}

View File

@@ -107,9 +107,9 @@ public class Util
return number;
}
public static void printSection(String s)
public static void printSection(String section)
{
s = "=[ " + s + " ]";
String s = "=[ " + section + " ]";
while (s.length() < 61)
{
s = "-" + s;