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

Quick Search    Search Deep

Source code: org/zazof/jteg/GameBusyMessage.java


1   /**
2    *  Message that processes "el_servidor_esta_lleno" events.
3    *  This message is valid for following protocols:
4    *    version 3: OK
5    *    version 4: ?
6    *    version 5: ?
7    *
8    *  Content = "el_servidor_esta_lleno"
9    *
10   * This message indicates that there's already a game active, so it's impossible
11   * to connect as a player. 
12   *
13   * @author Jef De Geeter
14   * @author Yves Vandewoude
15   */
16  package org.zazof.jteg;
17  
18  import java.util.StringTokenizer;
19  
20  public class GameBusyMessage extends Message{
21  
22    public GameBusyMessage(Message nextMessage){
23      setNextMessage(nextMessage);
24    }
25  
26    public Message decodeMessage(String messageDescription)
27      throws UnknownMessageException
28    {
29      String firstToken = (new StringTokenizer(messageDescription,"=")).nextToken();    
30      if (!(firstToken.equals("el_servidor_esta_lleno")))
31      {
32        // Not for me...
33        if (this.hasNextMessage())
34          {
35            return getNextMessage().decodeMessage(messageDescription);
36          }
37        throw new UnknownMessageException(messageDescription);
38      }
39      else
40      {
41        return this;
42      }
43    }
44  
45  
46    
47    /**
48     * @return "busy"
49     */
50    public String getMessageName(){
51      return "busy";
52    }
53  }