From df908f90b2fe4ed8eab7804dbd32c0191d16c4ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 8 Dec 2020 19:06:08 +0900 Subject: [PATCH] Add exception to be thrown when an operation is requested requiring host when not host --- .../RealtimeMultiplayer/IMultiplayerServer.cs | 2 ++ .../RealtimeMultiplayer/NotHostException.cs | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 osu.Game/Online/RealtimeMultiplayer/NotHostException.cs diff --git a/osu.Game/Online/RealtimeMultiplayer/IMultiplayerServer.cs b/osu.Game/Online/RealtimeMultiplayer/IMultiplayerServer.cs index eb9eddbdf5..565c07d0ec 100644 --- a/osu.Game/Online/RealtimeMultiplayer/IMultiplayerServer.cs +++ b/osu.Game/Online/RealtimeMultiplayer/IMultiplayerServer.cs @@ -23,6 +23,7 @@ namespace osu.Game.Online.RealtimeMultiplayer /// Transfer the host of the currently joined room to another user in the room. /// /// The new user which is to become host. + /// A user other than the current host is attempting to transfer host. Task TransferHost(long userId); /// @@ -41,6 +42,7 @@ namespace osu.Game.Online.RealtimeMultiplayer /// /// As the host of a room, start the match. /// + /// A user other than the current host is attempting to start the game. Task StartMatch(); } } diff --git a/osu.Game/Online/RealtimeMultiplayer/NotHostException.cs b/osu.Game/Online/RealtimeMultiplayer/NotHostException.cs new file mode 100644 index 0000000000..e421c6ae28 --- /dev/null +++ b/osu.Game/Online/RealtimeMultiplayer/NotHostException.cs @@ -0,0 +1,15 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; + +namespace osu.Game.Online.RealtimeMultiplayer +{ + public class NotHostException : Exception + { + public NotHostException() + : base("User is attempting to perform a host level operation while not the host") + { + } + } +}