@Override
    public void received(Connection c, Object o) {
        UserConnection connection = (UserConnection) c;
        User user = connection.user;
        if (o instanceof Login) {
            
            LoginResult lr = new LoginResult();
            lr.result = true;
            
            // Ignore if already logged in.
            if (user != null) {
                lr.result = false;
                lr.reason = "You are already logged in.";
                c.sendTCP(lr);
                return;
            }
            
            String name = ((Login) o).name;
            
            // Reject if already logged in.
            for (User other : loggedIn) {
                if (other.name.equals(name)) {
                    lr.result = false;
                    lr.reason = "There is already a user with your name.";
                    c.sendTCP(lr);
                    c.close();
                    return;
                }
            }
            
            user = new User(name, ((Login) o).skeleton);
            
            loggedIn(connection, user);
            c.sendTCP(lr);
            return;
        } else if (o instanceof SendInput) {
            SendInput sendInput = (SendInput) o;
            sendInput.user = user;
            try {
                world.process.put(sendInput);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }