mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:02:53 +08:00
Add required server methods for kicking users
This commit is contained in:
parent
c54a37a4ca
commit
e8ad0fba75
@ -27,6 +27,14 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
||||
Task TransferHost(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// As the host, kick another user from the room.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user to kick..</param>
|
||||
/// <exception cref="NotHostException">A user other than the current host is attempting to kick a user.</exception>
|
||||
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
||||
Task KickUser(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// As the host, update the settings of the currently joined room.
|
||||
/// </summary>
|
||||
|
@ -293,6 +293,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
|
||||
public abstract Task TransferHost(int userId);
|
||||
|
||||
public abstract Task KickUser(int userId);
|
||||
|
||||
public abstract Task ChangeSettings(MultiplayerRoomSettings settings);
|
||||
|
||||
public abstract Task ChangeState(MultiplayerUserState newState);
|
||||
|
@ -91,6 +91,14 @@ namespace osu.Game.Online.Multiplayer
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.TransferHost), userId);
|
||||
}
|
||||
|
||||
public override Task KickUser(int userId)
|
||||
{
|
||||
if (!IsConnected.Value)
|
||||
return Task.CompletedTask;
|
||||
|
||||
return connection.InvokeAsync(nameof(IMultiplayerServer.KickUser), userId);
|
||||
}
|
||||
|
||||
public override Task ChangeSettings(MultiplayerRoomSettings settings)
|
||||
{
|
||||
if (!IsConnected.Value)
|
||||
|
@ -174,6 +174,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public override Task TransferHost(int userId) => ((IMultiplayerClient)this).HostChanged(userId);
|
||||
|
||||
public override Task KickUser(int userId)
|
||||
{
|
||||
Debug.Assert(Room != null);
|
||||
|
||||
return ((IMultiplayerClient)this).UserLeft(Room.Users.Single(u => u.UserID == userId));
|
||||
}
|
||||
|
||||
public override async Task ChangeSettings(MultiplayerRoomSettings settings)
|
||||
{
|
||||
Debug.Assert(Room != null);
|
||||
|
Loading…
Reference in New Issue
Block a user