Thread: Enum constant

Results 1 to 3 of 3
  1. #1 Enum constant 
    Registered Member

    Join Date
    Nov 2010
    Posts
    339
    Thanks given
    84
    Thanks received
    122
    Rep Power
    182
    fixed

    Session:
    Code:
    package com.runescape.net;
    
    import org.jboss.netty.channel.Channel;
    
    import com.runescape.model.player.Player;
    import com.runescape.util.ISAACCipher;
    
    /**
     * Represents an in-server session, which keeps track of things like the remote
     * channel, the player and the session state.
     * 
     * @author Blake Beaupain
     */
    public class Session {
    
    	/**
    	 * The state of the session.
    	 */
    	public static enum State {
    		/** When a session has just connected. */
    		CONNECTED,
    		/** When a session is updating. */
    		UPDATING,
    		/** When a session is logging in. */
    		LOGGING_IN,
    		/** When a session is logged in. */
    		LOGGED_IN
    	}
    
    	/** The channel. */
    	private Channel channel;
    
    	/** The player. */
    	private Player player;
    
    	/** The state. */
    	private State state = State.CONNECTED;
    
    	/** The stream encoder. */
    	private ISAACCipher streamEncryptor;
    
    	/** The stream decoder. */
    	private ISAACCipher streamDecryptor;
    
    	/**
    	 * Instantiates a new session.
    	 * 
    	 * @param channel
    	 *            the channel
    	 */
    	public Session(Channel channel) {
    		this.setChannel(channel);
    	}
    
    	/**
    	 * Sets the channel.
    	 * 
    	 * @param channel
    	 *            the new channel
    	 */
    	public void setChannel(Channel channel) {
    		this.channel = channel;
    	}
    
    	/**
    	 * Gets the channel.
    	 * 
    	 * @return the channel
    	 */
    	public Channel getChannel() {
    		return channel;
    	}
    
    	/**
    	 * Sets the state.
    	 * 
    	 * @param state
    	 *            the new state
    	 */
    	public void setState(State state) {
    		this.state = state;
    	}
    
    	/**
    	 * Gets the state.
    	 * 
    	 * @return the state
    	 */
    	public State getState() {
    		return state;
    	}
    
    	/**
    	 * Sets the player.
    	 * 
    	 * @param player
    	 *            the new player
    	 */
    	public void setPlayer(Player player) {
    		this.player = player;
    	}
    
    	/**
    	 * Gets the player.
    	 * 
    	 * @return the player
    	 */
    	public Player getPlayer() {
    		return player;
    	}
    
    	public void setStreamEncryptor(ISAACCipher streamEncryptor) {
    		this.streamEncryptor = streamEncryptor;
    	}
    
    	public ISAACCipher getStreamEncryptor() {
    		return streamEncryptor;
    	}
    
    	public void setStreamDecryptor(ISAACCipher streamDecryptor) {
    		this.streamDecryptor = streamDecryptor;
    	}
    
    	public ISAACCipher getStreamDecryptor() {
    		return streamDecryptor;
    	}
    
    }
    Reply With Quote  
     

  2. #2  
    Enum constant



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    Code:
    package com.runescape.net.packet.impl;
     
    import com.runescape.net.Session;
    import com.runescape.net.Session.State;
    import com.runescape.net.packet.Packet;
    import com.runescape.net.packet.PacketHandler;
     
    public class LoginPacketHandler implements PacketHandler {
           
            @Override
            public void handle(Session session, Packet packet) {
                    switch(session.getState()) {
                    case CONNECTED:
                            break;
                    case LOGGED_IN:
                            break;
                    case LOGGING_IN:
                            break;
                    case UPDATING:
                            break;
                    }
            }
     
    }

    Attached image
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member

    Join Date
    Nov 2010
    Posts
    339
    Thanks given
    84
    Thanks received
    122
    Rep Power
    182
    Thanks, not sure why I couldn't read that.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Class interface or enum expected :S
    By kiiln in forum Help
    Replies: 7
    Last Post: 12-27-2012, 06:53 PM
  2. Correct usage of enum?
    By Brandyn in forum Help
    Replies: 1
    Last Post: 01-28-2012, 08:10 AM
  3. Correct usage of enum?
    By Brandyn in forum Help
    Replies: 0
    Last Post: 12-13-2010, 11:27 PM
  4. HELP, class, interface, or enum expected
    By resurrect in forum Help
    Replies: 4
    Last Post: 06-19-2010, 08:10 PM
  5. Enum, null pointer exception
    By Pilldom in forum Help
    Replies: 2
    Last Post: 12-20-2009, 09:49 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •