@Override
    public void received(Connection connection, Object object) {
        super.received(connection, object);    //To change body of overridden methods use File | Settings | File Templates.
        if (object instanceof EntityCreation) {
            Logger.getInstance().debug("Receiving in the clientListener the following: ");
            Logger.getInstance().debug("type: " + ((EntityCreation) object).entityType);
            Entity entity = null;
            try {
                entity = EntityList.getEntity(((EntityCreation) object).entityType).getConstructor(EntityCreation.class).newInstance((EntityCreation) object);
                entityManager.createEntity(entity);
            } catch (InstantiationException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (IllegalAccessException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (InvocationTargetException e) {
                System.out.println(e.getCause());
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            } catch (NoSuchMethodException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
            System.out.println("New: " + entity.getClass().toString());
            if (entity != null) {
                entityManager.createEntity(entity);
            }

        } else if (object instanceof EntityPosChange) {
            ((MovingUnit) entityManager.getEntity(((EntityPosChange) object).id)).moveEntity((EntityPosChange) object);
        } else if (object instanceof PlayerConnected) {
            System.out.println("Player: " + ((PlayerConnected) object).playerName + " with id: " + ((PlayerConnected) object).playerId + " connected!");
        }
    }