get number of users in room in server instance.?

0 votes
Hello,

I am developing server side logic in java and I am making a class which is inherited from BaseRoomAdaptor.

Now this class will be having objects for all rooms in server instance when game will be live.

How can I get number of user in particular that room in server.? I mean Do I have to implement IRoom interface. or is there any other optimized way.?

Because currently I am implementing IRoom interface but in eclipse it is giving me below error.

the type java.util.map$entry cannot be resolved. it is indirectly referenced from required .class
asked Aug 27, 2014 in AppWarpS2 by patel.sagar2611 (34 points)

1 Answer

0 votes

Hey,

You can create a local reference to IRoom inside the Room Adapter class. You can then set reference to it through constructor while creating the object of that room adapter in zone adapter.

public class GameRoom extends BaseRoomAdaptor{
    
    private IRoom m_room;
 
    public GameRoom (IRoom room) {
        m_room = room;
    }
}
 
public class GameZone extends BaseZoneAdaptor {
    
    @Override
    public void onAdminRoomAdded(IRoom room)
    {
        GameRoom mRoom = new GameRoom(room);
        room.setAdaptor(mRoom);
    } 
}
 
Now you can use the getJoinedUsers() method of IRoom to get the list of all players
 
Thanks
answered Aug 27, 2014 by Suyash Mohan (900 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...