Proper naming for various methods and variables.

This commit is contained in:
MobiusDevelopment
2021-12-26 22:17:47 +00:00
parent f5f80399c5
commit 3e61211e14
369 changed files with 1098 additions and 1099 deletions

View File

@@ -1334,9 +1334,9 @@ public class Config
ALLOW_AIO_IN_EVENTS = generalConfig.getBoolean("AllowAioInEvents", false);
if (ENABLE_AIO_SYSTEM)
{
final String[] AioSkillsSplit = generalConfig.getString("AioSkills", "").split(";");
AIO_SKILLS = new HashMap<>(AioSkillsSplit.length);
for (String skill : AioSkillsSplit)
final String[] aioSkillsSplit = generalConfig.getString("AioSkills", "").split(";");
AIO_SKILLS = new HashMap<>(aioSkillsSplit.length);
for (String skill : aioSkillsSplit)
{
final String[] skillSplit = skill.split(",");
if (skillSplit.length != 2)

View File

@@ -197,15 +197,15 @@ public class AdminBuffs implements IAdminCommandHandler
activeChar.sendPacket(ms);
}
private void removeBuff(Player remover, String playername, int SkillId)
private void removeBuff(Player remover, String playername, int skillId)
{
final Player player = World.getInstance().getPlayer(playername);
if ((player != null) && (SkillId > 0))
if ((player != null) && (skillId > 0))
{
final Effect[] effects = player.getAllEffects().toArray(new Effect[0]);
for (Effect e : effects)
{
if ((e != null) && (e.getSkill().getId() == SkillId))
if ((e != null) && (e.getSkill().getId() == skillId))
{
e.exit(true);
remover.sendMessage("Removed " + e.getSkill().getName() + " level " + e.getSkill().getLevel() + " from " + playername);

View File

@@ -65,7 +65,7 @@ public class AdminMammon implements IAdminCommandHandler
teleportIndex = Integer.parseInt(command.substring(18));
}
}
catch (Exception NumberFormatException)
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //mammon_find [teleportIndex] (where 1 = Blacksmith, 2 = Merchant)");
}

View File

@@ -1121,8 +1121,8 @@ public class TradeList
return false;
}
final Item Item = (Item) obj;
if (item.getEnchant() != Item.getEnchantLevel())
final Item foundItem = (Item) obj;
if (item.getEnchant() != foundItem.getEnchantLevel())
{
final String msgErr = "[RequestPrivateStoreSell] player " + _owner.getName() + " tried to change enchant level in a private store (buy), ban this player!";
Util.handleIllegalPlayerAction(_owner, msgErr, Config.DEFAULT_PUNISH);

View File

@@ -12498,11 +12498,11 @@ public class Player extends Playable
}
}
public void broadcastSnoop(ChatType _chatType, String name, String text, CreatureSay cs)
public void broadcastSnoop(ChatType chatType, String name, String text, CreatureSay cs)
{
if (!_snoopListener.isEmpty())
{
final Snoop sn = new Snoop(this, _chatType, name, text);
final Snoop sn = new Snoop(this, chatType, name, text);
for (Player pci : _snoopListener)
{
if (pci != null)

View File

@@ -466,7 +466,7 @@ public class SignsPriest extends Folk
{
convertCount = Integer.parseInt(command.substring(19).trim());
}
catch (Exception NumberFormatException)
catch (Exception e)
{
player.sendMessage("You must enter an integer amount.");
break;

View File

@@ -236,7 +236,7 @@ public class VillageMaster extends Folk
paramOne = Integer.parseInt(command.substring(11, endIndex).trim());
}
}
catch (Exception NumberFormatException)
catch (Exception e)
{
}

View File

@@ -462,7 +462,7 @@ public class PlayerInventory extends Inventory
@Override
public Item destroyItem(String process, Item item, Player actor, WorldObject reference)
{
final Item Item = super.destroyItem(process, item, actor, reference);
final Item destroyedItem = super.destroyItem(process, item, actor, reference);
if ((_adena != null) && (_adena.getCount() <= 0))
{
@@ -474,7 +474,7 @@ public class PlayerInventory extends Inventory
_ancientAdena = null;
}
return Item;
return destroyedItem;
}
/**
@@ -542,7 +542,7 @@ public class PlayerInventory extends Inventory
@Override
public Item dropItem(String process, Item item, Player actor, WorldObject reference)
{
final Item Item = super.dropItem(process, item, actor, reference);
final Item droppedItem = super.dropItem(process, item, actor, reference);
if ((_adena != null) && ((_adena.getCount() <= 0) || (_adena.getOwnerId() != getOwnerId())))
{
@@ -554,7 +554,7 @@ public class PlayerInventory extends Inventory
_ancientAdena = null;
}
return Item;
return droppedItem;
}
/**

View File

@@ -31,10 +31,10 @@ public class Snoop implements IClientOutgoingPacket
private final String _speaker;
private final String _msg;
public Snoop(Player snooped, ChatType _chatType, String speaker, String msg)
public Snoop(Player snooped, ChatType chatType, String speaker, String msg)
{
_snooped = snooped;
_type = _chatType;
_type = chatType;
_speaker = speaker;
_msg = msg;
}

View File

@@ -101,14 +101,14 @@ public class GameServerTable
private void loadRSAKeys() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
{
final KeyPairGenerator _keyGen = KeyPairGenerator.getInstance("RSA");
final KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
final RSAKeyGenParameterSpec spec = new RSAKeyGenParameterSpec(512, RSAKeyGenParameterSpec.F4);
_keyGen.initialize(spec);
keyGen.initialize(spec);
_keyPairs = new KeyPair[KEYS_SIZE];
for (int i = 0; i < 10; i++)
{
_keyPairs[i] = _keyGen.generateKeyPair();
_keyPairs[i] = keyGen.generateKeyPair();
}
LOGGER.info("Cached " + _keyPairs.length + " RSA keys for Game Server communication.");
@@ -192,11 +192,11 @@ public class GameServerTable
}
}
public GameServerThread getGameServerThread(int ServerID)
public GameServerThread getGameServerThread(int serverId)
{
for (GameServer gs : _gameServerList)
{
if (gs.serverId == ServerID)
if (gs.serverId == serverId)
{
return gs.gst;
}
@@ -204,11 +204,11 @@ public class GameServerTable
return null;
}
public int getGameServerStatus(int ServerID)
public int getGameServerStatus(int serverId)
{
for (GameServer gs : _gameServerList)
{
if (gs.serverId == ServerID)
if (gs.serverId == serverId)
{
return gs.status;
}

View File

@@ -170,14 +170,14 @@ public class LoginController
return playerCount;
}
public int getOnlinePlayerCount(int ServerID)
public int getOnlinePlayerCount(int serverId)
{
final List<GameServerThread> gslist = LoginServer.getGameServerListener().getGameServerThreads();
synchronized (gslist)
{
for (GameServerThread gs : gslist)
{
if (gs.getServerID() == ServerID)
if (gs.getServerID() == serverId)
{
return gs.getCurrentPlayers();
}
@@ -186,14 +186,14 @@ public class LoginController
return 0;
}
public int getMaxAllowedOnlinePlayers(int ServerID)
public int getMaxAllowedOnlinePlayers(int serverId)
{
final List<GameServerThread> gslist = LoginServer.getGameServerListener().getGameServerThreads();
synchronized (gslist)
{
for (GameServerThread gs : gslist)
{
if (gs.getServerID() == ServerID)
if (gs.getServerID() == serverId)
{
return gs.getMaxPlayers();
}
@@ -209,12 +209,12 @@ public class LoginController
/**
* @param access
* @param ServerID
* @param serverId
* @return
*/
public boolean loginPossible(int access, int ServerID)
public boolean loginPossible(int access, int serverId)
{
return ((getOnlinePlayerCount(ServerID) < _maxAllowedOnlinePlayers) || (access >= 50));
return ((getOnlinePlayerCount(serverId) < _maxAllowedOnlinePlayers) || (access >= 50));
}
public void setAccountAccessLevel(String account, int banLevel)

View File

@@ -405,7 +405,7 @@ public class GameStatusThread extends Thread
{
_print.println("Please Enter * amount of seconds to shutdown!");
}
catch (Exception NumberFormatException)
catch (Exception e)
{
_print.println("Numbers Only!");
}
@@ -423,7 +423,7 @@ public class GameStatusThread extends Thread
{
_print.println("Please Enter * amount of seconds to restart!");
}
catch (Exception NumberFormatException)
catch (Exception e)
{
_print.println("Numbers Only!");
}

View File

@@ -59,11 +59,11 @@ public class SQLAccountManager
System.out.println("3 - Delete existing account.");
System.out.println("4 - List accounts & access levels.");
System.out.println("5 - Exit.");
final LineNumberReader _in = new LineNumberReader(new InputStreamReader(System.in));
final LineNumberReader in = new LineNumberReader(new InputStreamReader(System.in));
while ((!_mode.equals("1") && !_mode.equals("2") && !_mode.equals("3") && !_mode.equals("4") && !_mode.equals("5")))
{
System.out.print("Your choice: ");
_mode = _in.readLine();
_mode = in.readLine();
}
if (_mode.equals("1") || _mode.equals("2") || _mode.equals("3"))
@@ -73,7 +73,7 @@ public class SQLAccountManager
while (_uname.trim().length() == 0)
{
System.out.print("Username: ");
_uname = _in.readLine().toLowerCase();
_uname = in.readLine().toLowerCase();
}
}
else if (_mode.equals("3"))
@@ -81,7 +81,7 @@ public class SQLAccountManager
while (_uname.trim().length() == 0)
{
System.out.print("Account name: ");
_uname = _in.readLine().toLowerCase();
_uname = in.readLine().toLowerCase();
}
}
if (_mode.equals("1"))
@@ -89,7 +89,7 @@ public class SQLAccountManager
while (_pass.trim().length() == 0)
{
System.out.print("Password: ");
_pass = _in.readLine();
_pass = in.readLine();
}
}
if (_mode.equals("1") || _mode.equals("2"))
@@ -97,7 +97,7 @@ public class SQLAccountManager
while (_level.trim().length() == 0)
{
System.out.print("Access level: ");
_level = _in.readLine();
_level = in.readLine();
}
}
}
@@ -116,7 +116,7 @@ public class SQLAccountManager
{
// Delete
System.out.print("Do you really want to delete this account ? Y/N : ");
final String yesno = _in.readLine();
final String yesno = in.readLine();
if (yesno.equalsIgnoreCase("Y"))
{
deleteAccount(_uname.trim());
@@ -140,7 +140,7 @@ public class SQLAccountManager
while ((!_mode.equals("1") && !_mode.equals("2") && !_mode.equals("3") && !_mode.equals("4")))
{
System.out.print("Your choice: ");
_mode = _in.readLine();
_mode = in.readLine();
}
System.out.println("");
printAccInfo(_mode);

View File

@@ -53,12 +53,12 @@ public class GameServerRegister
System.out.println("Enter The id of the server you want to register or type help to get a list of ids:");
try (InputStreamReader ir = new InputStreamReader(System.in);
LineNumberReader _in = new LineNumberReader(ir))
LineNumberReader in = new LineNumberReader(ir))
{
while (true)
{
System.out.println("Your choice:");
_choice = _in.readLine();
_choice = in.readLine();
if (_choice.equalsIgnoreCase("help"))
{