Interface RoomService
public interface RoomService
Extension interface for room management related operations
Built-in default implementation
RoomService roomService = RoomService.of();
- Since:
- 21.8
- Author:
- 渔民小镇
- date:
- 2022-03-31
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidAdd user to the room and associate userId with roomIddefault voidAdd roomdefault <T extends Room>
TgetRoom(long roomId) Find room by roomIddefault <T extends Room>
TgetRoomByUserId(long userId) Find room by userIdRoom mapUser to room mapdefault <T extends Room>
Collection<T> listRoom()Get room liststatic RoomServiceof()Create a RoomService object instance (built-in default implementation)optionalRoom(long roomId) Find room Optional by roomIdoptionalRoomByUserId(long userId) Find room Optional by userIddefault voidremovePlayer(Room room, long userId) Remove user from the room and delete the association between userId and roomIddefault voidremovePlayer(Room room, Player player) Remove user from the room and delete the association between userId and roomIddefault voidremoveRoom(Room room) Remove room
-
Method Details
-
getRoomMap
-
getUserRoomMap
-
getRoomByUserId
Find room by userId- Type Parameters:
T- Room- Parameters:
userId- userId- Returns:
- Room
-
getRoom
Find room by roomId- Type Parameters:
T- Room- Parameters:
roomId- roomId- Returns:
- Room
-
optionalRoom
-
optionalRoomByUserId
-
addRoom
-
removeRoom
-
addPlayer
-
removePlayer
-
removePlayer
Remove user from the room and delete the association between userId and roomId- Parameters:
room- The roomuserId- userId
-
listRoom
Get room list- Type Parameters:
T- Room- Returns:
- Room list
-
of
Create a RoomService object instance (built-in default implementation)- Returns:
- RoomService
-