Minor code changes.

This commit is contained in:
MobiusDev
2016-04-26 09:16:45 +00:00
parent f568bc6255
commit 6a13705766
13 changed files with 25 additions and 40 deletions

View File

@ -206,7 +206,7 @@ final class SelMahumDrill extends AbstractNpcAI
// group hate
for (L2Character ch : npc.getKnownList().getKnownCharacters())
{
if (!ch.isInCombat() && ch.isMonster() && (((L2Npc) ch).getSpawn().getName() == npc.getSpawn().getName()))
if (!ch.isInCombat() && ch.isMonster() && (((L2Npc) ch).getSpawn().getName().equals(npc.getSpawn().getName())))
{
addAttackDesire((L2Npc) ch, attacker);
}

View File

@ -651,14 +651,11 @@ public final class Raina extends AbstractNpcAI
for (PlayerClass pclass : availSubs)
{
// scan for already used subclasses
final int availClassId = pclass.ordinal();
final ClassId cid = ClassId.getClassId(availClassId);
for (SubClass subList : player.getSubClasses().values())
{
if (ClassId.getClassId(subList.getClassId()).equalsOrChildOf(cid))
if (ClassId.getClassId(subList.getClassId()).equalsOrChildOf(ClassId.getClassId(pclass.ordinal())))
{
availSubs.remove(cid);
availSubs.remove(pclass);
break;
}
}

View File

@ -81,7 +81,7 @@ final class FreyaCelebration extends LongTimeEvent
{
final long _curr_time = System.currentTimeMillis();
final String value = loadGlobalQuestVar(player.getAccountName());
final long _reuse_time = value == "" ? 0 : Long.parseLong(value);
final long _reuse_time = value.equals("") ? 0 : Long.parseLong(value);
if (_curr_time > _reuse_time)
{

View File

@ -369,7 +369,7 @@ public class AdminAdmin implements IAdminCommandHandler
}
else if (command.startsWith("admin_gmon"))
{
// nothing
// TODO why is this empty?
}
return true;
}

View File

@ -638,16 +638,9 @@ public class AutoSpawnHandler
return _locList.toArray(new Location[_locList.size()]);
}
public L2Npc[] getNPCInstanceList()
public List<L2Npc> getNPCInstanceList()
{
L2Npc[] ret;
synchronized (_npcList)
{
ret = new L2Npc[_npcList.size()];
_npcList.toArray(ret);
}
return ret;
return _npcList;
}
public List<L2Spawn> getSpawns()

View File

@ -385,13 +385,10 @@ public class L2Party extends AbstractPlayerGroup
if (_tacticalSigns == null)
{
synchronized (this)
{
if (_tacticalSigns == null)
{
_tacticalSigns = new ConcurrentHashMap<>(1);
}
}
}
return _tacticalSigns;
}

View File

@ -8320,7 +8320,7 @@ public final class L2PcInstance extends L2Playable
// Add Henna skills
for (SkillHolder skill : henna.getSkills())
{
if (!getAllSkills().contains(skill))
if (!getAllSkills().contains(skill.getSkill()))
{
addSkill(skill.getSkill(), true);
}

View File

@ -128,7 +128,7 @@ public class Friend
public String getName()
{
if (_name == "")
if (_name.equals(""))
{
_name = CharNameTable.getInstance().getNameById(_friendOID);
}

View File

@ -150,8 +150,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
PreparedStatement ps = con.prepareStatement(SQL_LOAD_GUARDS))
{
ps.setInt(1, _hall.getId());
try (ResultSet rset = ps.executeQuery())
{
final ResultSet rset = ps.executeQuery();
while (rset.next())
{
final L2Spawn spawn = new L2Spawn(rset.getInt("npcId"));
@ -164,7 +163,6 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
_guards.add(spawn);
}
}
}
catch (Exception e)
{
_log.warning(getName() + ": Couldnt load siege guards!");

View File

@ -66,7 +66,7 @@ public class RequestAlchemyTryMixCube extends L2GameClientPacket
activeChar.sendPacket(ExTryMixCube.FAIL);
return;
}
if (activeChar.isInStoreMode() || activeChar.isInStoreMode())
if (activeChar.isInStoreMode())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_TRADING_OR_USING_A_PRIVATE_STORE_OR_SHOP);
activeChar.sendPacket(ExTryMixCube.FAIL);

View File

@ -55,8 +55,8 @@ public final class RequestAnswerFriendInvite extends L2GameClientPacket
return;
}
if (player.getFriendList().containsValue(requestor.getObjectId()) //
|| requestor.getFriendList().containsValue(player.getObjectId()))
if (player.getFriendList().containsKey(requestor.getObjectId()) //
|| requestor.getFriendList().containsKey(player.getObjectId()))
{
requestor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THIS_PLAYER_IS_ALREADY_REGISTERED_ON_YOUR_FRIENDS_LIST));
return;

View File

@ -74,7 +74,7 @@ public class PledgeShowMemberListAll extends L2GameServerPacket
{
_name = subPledge.getName();
}
writeD((_name == "") || (_name == name) ? 0 : 1);
writeD((_name.equals("")) || (_name.equals(name)) ? 0 : 1);
writeD(_clan.getId());
writeD(Config.SERVER_ID);
writeD(_pledgeType);

View File

@ -136,7 +136,7 @@ public class IPSubnet
{
return applyMask(((IPSubnet) o).getAddress());
}
else if (o instanceof InetAddress)
if (o instanceof InetAddress)
{
return applyMask(((InetAddress) o).getAddress());
}