Extracted ConnectionState enum to a separate file.
This commit is contained in:
parent
f79c3f1d98
commit
e7377ff021
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -39,8 +39,8 @@ import org.l2jmobius.commons.crypt.NewCrypt;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.network.gameserverpackets.AuthRequest;
|
||||
import org.l2jmobius.gameserver.network.gameserverpackets.BlowFishKey;
|
||||
import org.l2jmobius.gameserver.network.gameserverpackets.ChangeAccessLevel;
|
||||
@ -304,7 +304,7 @@ public class LoginServerThread extends Thread
|
||||
{
|
||||
final PlayerInGame pig = new PlayerInGame(par.getAccount());
|
||||
sendPacket(pig);
|
||||
wcToRemove.gameClient.setState(GameClientState.AUTHED);
|
||||
wcToRemove.gameClient.setState(ConnectionState.AUTHENTICATED);
|
||||
wcToRemove.gameClient.setSessionId(wcToRemove.session);
|
||||
final CharSelectInfo cl = new CharSelectInfo(wcToRemove.account, wcToRemove.gameClient.getSessionId().playOkID1);
|
||||
wcToRemove.gameClient.getConnection().sendPacket(cl);
|
||||
|
@ -31,8 +31,8 @@ import org.l2jmobius.gameserver.model.TradeList.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
|
||||
/**
|
||||
* @author Shyla
|
||||
@ -204,7 +204,7 @@ public class OfflineTradeTable
|
||||
player = PlayerInstance.load(rs.getInt("charId"));
|
||||
client.setPlayer(player);
|
||||
client.setAccountName(player.getAccountName());
|
||||
client.setState(GameClientState.IN_GAME);
|
||||
client.setState(ConnectionState.IN_GAME);
|
||||
player.setClient(client);
|
||||
player.setOfflineMode(true);
|
||||
player.setOnlineStatus(false);
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState
|
||||
{
|
||||
CONNECTED,
|
||||
AUTHENTICATED,
|
||||
ENTERING,
|
||||
IN_GAME
|
||||
}
|
@ -62,25 +62,13 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
|
||||
{
|
||||
protected static final Logger LOGGER = Logger.getLogger(GameClient.class.getName());
|
||||
|
||||
/**
|
||||
* CONNECTED - client has just connected AUTHED - client has authed but doesn't has character attached to it yet IN_GAME - client has selected a char and is in game
|
||||
* @author KenM
|
||||
*/
|
||||
public enum GameClientState
|
||||
{
|
||||
CONNECTED,
|
||||
AUTHED,
|
||||
ENTERING,
|
||||
IN_GAME
|
||||
}
|
||||
|
||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||
private final ReentrantLock _playerLock = new ReentrantLock();
|
||||
private final List<Integer> _charSlotMapping = new ArrayList<>();
|
||||
private final ReentrantLock _queueLock = new ReentrantLock();
|
||||
private final ArrayBlockingQueue<ReceivablePacket<GameClient>> _packetQueue;
|
||||
private final GameCrypt _crypt;
|
||||
private GameClientState _state;
|
||||
private ConnectionState _state;
|
||||
private String _accountName;
|
||||
private SessionKey _sessionId;
|
||||
private PlayerInstance _player;
|
||||
@ -92,7 +80,7 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
|
||||
public GameClient(MMOConnection<GameClient> con)
|
||||
{
|
||||
super(con);
|
||||
_state = GameClientState.CONNECTED;
|
||||
_state = ConnectionState.CONNECTED;
|
||||
_crypt = new GameCrypt();
|
||||
_packetQueue = new ArrayBlockingQueue<>(Config.CLIENT_PACKET_QUEUE_SIZE);
|
||||
}
|
||||
@ -104,12 +92,12 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
|
||||
return key;
|
||||
}
|
||||
|
||||
public GameClientState getState()
|
||||
public ConnectionState getState()
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
|
||||
public void setState(GameClientState pState)
|
||||
public void setState(ConnectionState pState)
|
||||
{
|
||||
if (_state != pState)
|
||||
{
|
||||
@ -551,7 +539,7 @@ public class GameClient extends MMOClient<MMOConnection<GameClient>> implements
|
||||
{
|
||||
return "[IP: " + getIpAddress() + "]";
|
||||
}
|
||||
case AUTHED:
|
||||
case AUTHENTICATED:
|
||||
{
|
||||
return "[Account: " + _accountName + " - IP: " + getIpAddress() + "]";
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import org.l2jmobius.commons.mmocore.IPacketHandler;
|
||||
import org.l2jmobius.commons.mmocore.MMOConnection;
|
||||
import org.l2jmobius.commons.mmocore.ReceivablePacket;
|
||||
import org.l2jmobius.commons.util.Util;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.*;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
|
||||
@ -59,7 +58,7 @@ public class GamePacketHandler implements IPacketHandler<GameClient>, IClientFac
|
||||
}
|
||||
|
||||
ReceivablePacket<GameClient> msg = null;
|
||||
final GameClientState state = client.getState();
|
||||
final ConnectionState state = client.getState();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@ -85,7 +84,7 @@ public class GamePacketHandler implements IPacketHandler<GameClient>, IClientFac
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AUTHED:
|
||||
case AUTHENTICATED:
|
||||
{
|
||||
switch (opcode)
|
||||
{
|
||||
@ -1314,7 +1313,7 @@ public class GamePacketHandler implements IPacketHandler<GameClient>, IClientFac
|
||||
return msg;
|
||||
}
|
||||
|
||||
private void printDebug(int opcode, ByteBuffer buf, GameClientState state, GameClient client)
|
||||
private void printDebug(int opcode, ByteBuffer buf, ConnectionState state, GameClient client)
|
||||
{
|
||||
if (!Config.PACKET_HANDLER_DEBUG)
|
||||
{
|
||||
@ -1329,7 +1328,7 @@ public class GamePacketHandler implements IPacketHandler<GameClient>, IClientFac
|
||||
LOGGER.warning(Util.printData(array, size));
|
||||
}
|
||||
|
||||
private void printDebugDoubleOpcode(int opcode, int id2, ByteBuffer buf, GameClientState state, GameClient client)
|
||||
private void printDebugDoubleOpcode(int opcode, int id2, ByteBuffer buf, ConnectionState state, GameClient client)
|
||||
{
|
||||
if (!Config.PACKET_HANDLER_DEBUG)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CharSelected;
|
||||
|
||||
@ -81,7 +81,7 @@ public class CharacterSelected extends GameClientPacket
|
||||
|
||||
cha.setClient(getClient());
|
||||
getClient().setPlayer(cha);
|
||||
getClient().setState(GameClientState.ENTERING);
|
||||
getClient().setState(ConnectionState.ENTERING);
|
||||
sendPacket(new CharSelected(cha, getClient().getSessionId().playOkID1));
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ClientSetTime;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@ -120,7 +120,7 @@ public class EnterWorld extends GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
getClient().setState(GameClientState.IN_GAME);
|
||||
getClient().setState(ConnectionState.IN_GAME);
|
||||
|
||||
// Set lock at login
|
||||
player.setLocked(true);
|
||||
|
@ -26,8 +26,8 @@ import org.l2jmobius.gameserver.model.entity.olympiad.Olympiad;
|
||||
import org.l2jmobius.gameserver.model.entity.sevensigns.SevenSignsFestival;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.GameClient.GameClientState;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CharSelectInfo;
|
||||
@ -180,7 +180,7 @@ public class RequestRestart extends GameClientPacket
|
||||
getClient().setPlayer(null);
|
||||
|
||||
// return the client to the authed status
|
||||
client.setState(GameClientState.AUTHED);
|
||||
client.setState(ConnectionState.AUTHENTICATED);
|
||||
|
||||
// Restart true
|
||||
sendPacket(RestartResponse.valueOf(true));
|
||||
|
@ -323,7 +323,7 @@ public class FloodProtectorAction
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AUTHED:
|
||||
case AUTHENTICATED:
|
||||
{
|
||||
if (client.getAccountName() != null)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network;
|
||||
import org.l2jmobius.commons.network.IConnectionState;
|
||||
|
||||
/**
|
||||
* @author Nos
|
||||
* @author KenM
|
||||
*/
|
||||
public enum ConnectionState implements IConnectionState
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user