Room Self Delete not working

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

stelarfox
Posts: 15
Joined: 06 Aug 2021, 14:33

Room Self Delete not working

Postby stelarfox » 30 Mar 2023, 18:30

I have the following code (insida java function) to create dynamic rooms, before i did not have them to be deleted but we want the
WHEN_EMPTY_AND_CREATOR_IS_GONE situation.
Even so when such condition happen is not removing them.
the roomId is a 5 number digit different than 0.
And even so it stays for days after everyone logs out, what i am doing wrong?


CreateRoomSettings cfg = new CreateRoomSettings();
//Room room = sender.getLastJoinedRoom();
cfg.setName(String.format("%d",roomId));

cfg.setGame(true);
cfg.setMaxUsers(CONST.MAX_PLAYER_ROOM);
cfg.setGroupId(groupRoom);
//cfg.setMaxSpectators(5);
cfg.setDynamic(true);
cfg.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY_AND_CREATOR_IS_GONE);
cfg.setUseWordsFilter(true);

CreateRoomSettings.RoomExtensionSettings ext = new CreateRoomSettings.RoomExtensionSettings(
CONST.SFSE.getName(), CONST.SFSE.getClass().getName());
cfg.setExtension(ext);
return SmartFoxServer.getInstance().getAPIManager().getSFSApi()
.createRoom(sender.getZone(), cfg, null);
(where CONST.SFSE is the extension)
So can anyone help on what i am doing wrong?
Void*
Posts: 75
Joined: 15 Feb 2021, 13:49

Re: Room Self Delete not working

Postby Void* » 30 Mar 2023, 22:59

when you call .createRoom(), the owner (3rd parameter) is `null`, which defaults to the server being the owner. You will need to pass an actual user in as that parameter to act as the "creator".
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Room Self Delete not working

Postby Lapo » 31 Mar 2023, 07:38

Yes,
WHEN_EMPTY_AND_CREATOR_IS_GONE does not work when the owner of the Room is the server... as it's not possibile to determine when the creator of the Room "is gone" (the server does not leave :) )
Lapo
--
gotoAndPlay()
...addicted to flash games
stelarfox
Posts: 15
Joined: 06 Aug 2021, 14:33

Re: Room Self Delete not working

Postby stelarfox » 31 Mar 2023, 13:48

Thanks did not notice that mistake, will now check if it works
stelarfox
Posts: 15
Joined: 06 Aug 2021, 14:33

Re: Room Self Delete not working

Postby stelarfox » 31 Mar 2023, 19:44

Yes thanks, was that the problem, will check in the future to pass the correct owner when something owner related is required.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 55 guests