Code improvements.

This commit is contained in:
MobiusDev
2016-04-24 16:30:15 +00:00
parent 8bd51aba1c
commit 2dd14bef9b
860 changed files with 8865 additions and 17041 deletions

View File

@@ -36,26 +36,16 @@ public class ChannelDelete implements IUserCommandHandler
@Override
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
if ((id != COMMAND_IDS[0]) || !activeChar.isInParty() || !activeChar.getParty().isLeader(activeChar) || !activeChar.getParty().isInCommandChannel() || !activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{
return false;
}
if (activeChar.isInParty())
{
if (activeChar.getParty().isLeader(activeChar) && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{
final L2CommandChannel channel = activeChar.getParty().getCommandChannel();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_COMMAND_CHANNEL_HAS_BEEN_DISBANDED);
channel.broadcastPacket(sm);
channel.disbandChannel();
return true;
}
}
return false;
final L2CommandChannel channel = activeChar.getParty().getCommandChannel();
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_COMMAND_CHANNEL_HAS_BEEN_DISBANDED);
channel.broadcastPacket(sm);
channel.disbandChannel();
return true;
}
@Override

View File

@@ -35,12 +35,7 @@ public class ChannelInfo implements IUserCommandHandler
@Override
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
{
return false;
}
if ((activeChar.getParty() == null) || (activeChar.getParty().getCommandChannel() == null))
if ((id != COMMAND_IDS[0]) || (activeChar.getParty() == null) || (activeChar.getParty().getCommandChannel() == null))
{
return false;
}

View File

@@ -33,11 +33,7 @@ public class Mount implements IUserCommandHandler
@Override
public synchronized boolean useUserCommand(int id, L2PcInstance activeChar)
{
if (id != COMMAND_IDS[0])
{
return false;
}
return activeChar.mountPlayer(activeChar.getPet());
return (id == COMMAND_IDS[0]) && activeChar.mountPlayer(activeChar.getPet());
}
@Override

View File

@@ -96,5 +96,4 @@ public class SiegeStatus implements IUserCommandHandler
{
return COMMAND_IDS;
}
}

View File

@@ -62,15 +62,13 @@ public class Time implements IUserCommandHandler
if (GameTimeController.getInstance().isNight())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S22);
sm.addString(h);
sm.addString(m);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S2);
sm.addString(h);
sm.addString(m);
}
sm.addString(h);
sm.addString(m);
activeChar.sendPacket(sm);
if (Config.L2JMOD_DISPLAY_SERVER_TIME)
{

View File

@@ -45,13 +45,12 @@ public class Unstuck implements IUserCommandHandler
@Override
public boolean useUserCommand(int id, L2PcInstance activeChar)
{
// Thanks nbd
if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return false;
}
else if (activeChar.isJailed())
if (activeChar.isJailed())
{
activeChar.sendMessage("You cannot use this function while you are jailed.");
return false;