Addition of missing isInOfflineMode method.

This commit is contained in:
MobiusDev
2018-06-18 23:13:58 +00:00
parent 88f35f9e87
commit 304e82bba5
22 changed files with 121 additions and 177 deletions

View File

@@ -286,7 +286,7 @@ public class LoginServerThread extends Thread
st.addAttribute(ServerStatus.SERVER_AGE, ServerStatus.SERVER_AGE_ALL);
}
sendPacket(st);
final List<String> playerList = L2World.getInstance().getPlayers().stream().filter(player -> !player.isInStoreMode()).map(L2PcInstance::getAccountName).collect(Collectors.toList());
final List<String> playerList = L2World.getInstance().getPlayers().stream().filter(player -> !player.isInOfflineMode()).map(L2PcInstance::getAccountName).collect(Collectors.toList());
if (!playerList.isEmpty())
{
sendPacket(new PlayerInGame(playerList));

View File

@@ -908,11 +908,7 @@ public final class L2PcInstance extends L2Playable
public String getAccountName()
{
if (getClient() == null)
{
return getAccountNamePlayer();
}
return getClient().getAccountName();
return getClient() == null ? getAccountNamePlayer() : getClient().getAccountName();
}
public String getAccountNamePlayer()
@@ -4237,22 +4233,6 @@ public final class L2PcInstance extends L2Playable
return getClan().getAllyCrestId();
}
//@formatter:off
/*
public void queryGameGuard()
{
if (getClient() != null)
{
getClient().setGameGuardOk(false);
sendPacket(GameGuardQuery.STATIC_PACKET);
}
if (Config.GAMEGUARD_ENFORCE)
{
ThreadPoolManager.scheduleGeneral(new GameGuardCheckTask(this), 30 * 1000);
}
}*/
//@formatter:on
/**
* Send a Server->Client packet StatusUpdate to the L2PcInstance.
*/
@@ -7369,13 +7349,25 @@ public final class L2PcInstance extends L2Playable
public int isOnlineInt()
{
if (_isOnline && (getClient() != null))
if (_isOnline && (_client != null))
{
return getClient().isDetached() ? 2 : 1;
return _client.isDetached() ? 2 : 1;
}
return 0;
}
/**
* Verifies if the player is in offline mode.<br>
* The offline mode may happen for different reasons:<br>
* Abnormally: Player gets abruptly disconnected from server.<br>
* Normally: The player gets into offline shop mode, only available by enabling the offline shop mod.
* @return {@code true} if the player is in offline mode, {@code false} otherwise
*/
public boolean isInOfflineMode()
{
return (_client == null) || _client.isDetached();
}
@Override
public Skill addSkill(Skill newSkill)
{

View File

@@ -121,7 +121,7 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
LoginServerThread.getInstance().sendLogout(getAccountName());
if ((_activeChar == null) || !_activeChar.isInStoreMode())
if ((_activeChar == null) || !_activeChar.isInOfflineMode())
{
IdFactory.getInstance().releaseId(getObjectId());
Disconnection.of(this).onDisconnection();