/**
 * 
 */
package it.polimi.ingsw.game.command;

import it.polimi.ingsw.game.network.GameCommands;
import it.polimi.ingsw.game.network.NetworkPacket;

/**
 * @author Michele
 * @since 23 May 2015
 */
public class CommandBuilder {

    /**
     * @param opcode
     * @return
     */
    public static Command getCommandFromNetworkPacket(NetworkPacket packet) {
        switch( packet.getOpcode() ) {
        case GameCommands.CMD_CS_ATTACK:    
            
            
        }
        
        return null;
    }
    
}

@@ -44,16 +44,126 @@
 mmand;%0A%0A
+import it.polimi.ingsw.exception.NetworkPacketNotValidException;%0Aimport it.polimi.ingsw.game.card.ObjectCard;%0A
 import i
@@ -256,16 +256,40 @@
 acket;%0A%0A
+import java.awt.Point;%0A%0A
 /**%0A * @
@@ -487,16 +487,42 @@
  packet)
+ throws ClassCastException
  %7B%0A     
@@ -563,16 +563,20 @@
         
+    
 case Gam
@@ -607,44 +607,312 @@
     
-%0A            %0A            %0A        %7D
+        return new AttackCommand( (Point) packet.getArgs()%5B0%5D );%0A            case GameCommands.CMD_CS_DISCARD_OBJ_CARD:  return new DiscardObjectCard( (int) packet.getArgs()%5B0%5D );%0A            case GameCommands.CMD_CS_USE_OBJ_CARD:      return new UseObjectCardCommand( (ObjectCard) packet.getArgs()%5B0%5D );
 %0A   
@@ -920,29 +920,278 @@
     
-%0A
     
-    return null;
+case GameCommands.CMD_CS_SET_POSITION:      return new AttackCommand( (Point) packet.getArgs()%5B0%5D );%0A            default:                                    throw new NetworkPacketNotValidException(%22Network packet not valid. Discarded.%22);                  %0A        %7D
 %0A   

Add CommandBuilder (serverside)