From 2defa1b0e3220e666cc606c4f4c2c2021c5d8c3d Mon Sep 17 00:00:00 2001 From: = Date: Sun, 10 Sep 2017 11:01:58 -0300 Subject: [PATCH] Added a way to specify an error when a player is not allowed to join a lobby. --- .../Modules/Lobbies/Implementations/BaseLobby.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MasterServerFramework2/Assets/Barebones/Msf/Scripts/Modules/Lobbies/Implementations/BaseLobby.cs b/MasterServerFramework2/Assets/Barebones/Msf/Scripts/Modules/Lobbies/Implementations/BaseLobby.cs index 2ba9b14..bcd482f 100644 --- a/MasterServerFramework2/Assets/Barebones/Msf/Scripts/Modules/Lobbies/Implementations/BaseLobby.cs +++ b/MasterServerFramework2/Assets/Barebones/Msf/Scripts/Modules/Lobbies/Implementations/BaseLobby.cs @@ -139,9 +139,12 @@ public bool AddPlayer(LobbyUserExtension playerExt, out string error) return false; } - if (!IsPlayerAllowed(username, playerExt)) + if (!IsPlayerAllowed(username, playerExt, out error)) { - error = "You're not allowed"; + if (error == null || error == string.Empty) + { + error = "You're not allowed"; + } return false; } @@ -419,8 +422,9 @@ protected virtual string TryGetUsername(IPeer peer) /// This will be called before adding a player to lobby. /// Override it to add custom checks for bans and etc. /// - protected virtual bool IsPlayerAllowed(string username, LobbyUserExtension user) + protected virtual bool IsPlayerAllowed(string username, LobbyUserExtension user, out string error) { + error = "You're not allowed"; return true; }