0

我需要一些有关 SmartFox Server 的帮助。

ISFSGameApi gameAPI = SmartFoxServer.getInstance().getAPIManager().getGameApi();
        List<User> invitees = new ArrayList<User>();
        invitees.add(invitee);

        CreateSFSGameSettings settings = new CreateSFSGameSettings();
        settings.setMaxUsers(2);
        settings.setMaxVariablesAllowed(5);
        settings.setGame(true);
        settings.setInvitationExpiryTime(waitingTime);
        settings.setMinPlayersToStartGame(2);
        settings.setName("rm-" + sender.getName());
        settings.setDynamic(true);
        settings.setLeaveLastJoinedRoom(false);
        settings.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY);
        settings.setInvitedPlayers(invitees);

        try {
        gameAPI.createGame(getParentExtension().getParentZone(), settings, sender);
        } catch (SFSCreateRoomException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

将上述代码作为扩展名执行时出现此错误。任何想法都值得赞赏。我对java不太熟悉。谢谢

java.lang.NullPointerException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.NullPointerException
Message: *** Null ***
Description: Error while handling client request in extension: { Ext: QyServerExtension, Type: JAVA, Lev: ZONE, { Zone: Qy }, {} }
Extension Cmd: invite
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.api.SFSGameApi.populateInvitations(SFSGameApi.java:374)
com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:153)
com.smartfoxserver.v2.api.SFSGameApi.createGame(SFSGameApi.java:83)
qy.server.GameInvitation.handleClientRequest(GameInvitation.java:56)
com.smartfoxserver.v2.extensions.SFSExtension.handleClientRequest(SFSExtension.java:208)
com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:174)
com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

我的猜测是这与邀请有关,我追踪了“被邀请者”及其用户,还追踪了其他变量并且工作正常。

4

1 回答 1

0

改变了

settings.setMinPlayersToStartGame(2);

settings.setMinPlayersToStartGame(1);

它工作正常。看起来还是很奇怪。我猜。希望它可以帮助某人。

于 2015-12-24T23:15:32.387 回答