Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: marauroa/net/MessageS2CChooseCharacterACK.java


1   /* $Id: MessageS2CChooseCharacterACK.java,v 1.5 2003/12/08 01:08:30 arianne_rpg Exp $ */
2   /***************************************************************************
3    *                      (C) Copyright 2003 - Marauroa                      *
4    ***************************************************************************
5    ***************************************************************************
6    *                                                                         *
7    *   This program is free software; you can redistribute it and/or modify  *
8    *   it under the terms of the GNU General Public License as published by  *
9    *   the Free Software Foundation; either version 2 of the License, or     *
10   *   (at your option) any later version.                                   *
11   *                                                                         *
12   ***************************************************************************/
13  package marauroa.net;
14    
15  import java.net.InetSocketAddress;
16  import java.io.*;
17  
18  import marauroa.game.*;
19    
20  /** This message indicate the client that the server has accepted its ChooseCharacter Message
21   *  @see marauroa.net.Message
22   */
23  public class MessageS2CChooseCharacterACK extends Message
24    {
25    private RPObject.ID id;
26    
27    /** Constructor for allowing creation of an empty message */
28    public MessageS2CChooseCharacterACK()
29      {
30      super(null);
31      
32      type=TYPE_S2C_CHOOSECHARACTER_ACK;
33      }
34  
35    /** Constructor with a TCP/IP source/destination of the message
36     *  @param source The TCP/IP address associated to this message */
37    public MessageS2CChooseCharacterACK(InetSocketAddress source, RPObject.ID id)
38      {
39      super(source);
40      this.id=id;
41      
42      type=TYPE_S2C_CHOOSECHARACTER_ACK;
43      }
44     
45    /** This method returns the object id of the choosen character
46     *  @returns RPObject.ID of the choosen character */
47    public RPObject.ID getObjectID()
48      {
49      return id;
50      }
51  
52    /** This method returns a String that represent the object
53     *  @return a string representing the object.*/
54    public String toString()
55      {
56      return "Message (S2C Choose Character ACK) from ("+source.toString()+") CONTENTS: ("+id.toString()+")";
57      }
58        
59    public void writeObject(marauroa.net.OutputSerializer out) throws IOException
60      {
61      super.writeObject(out);
62      id.writeObject(out);
63      }
64      
65    public void readObject(marauroa.net.InputSerializer in) throws IOException, java.lang.ClassNotFoundException
66      {
67      super.readObject(in);
68      id=new RPObject.ID(-1);
69      id.readObject(in);
70      
71      if(type!=TYPE_S2C_CHOOSECHARACTER_ACK)
72        {
73        throw new java.lang.ClassNotFoundException();
74        }
75      }
76    };
77  
78  
79