Skip to content

Commit

Permalink
Registering keys is now optional
Browse files Browse the repository at this point in the history
  • Loading branch information
RugbugRedfern committed Apr 9, 2024
1 parent a9c4b84 commit 560c8c0
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions MyceliumNetworkingForCW/MyceliumNetwork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ public static void SetLobbyData(string key, object value)

if(!lobbyDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'.");
return;
RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist.");
}

if(!SteamMatchmaking.SetLobbyData(Lobby, key, value.ToString()))
Expand All @@ -393,8 +392,7 @@ public static bool HasLobbyData(string key)

if(!lobbyDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'.");
return false;
RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist.");
}

string value = SteamMatchmaking.GetLobbyData(Lobby, key.ToString());
Expand All @@ -418,8 +416,7 @@ public static T GetLobbyData<T>(string key)

if(!lobbyDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'.");
return default(T);
RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist.");
}

string value = SteamMatchmaking.GetLobbyData(Lobby, key.ToString());
Expand Down Expand Up @@ -451,8 +448,7 @@ public static void SetPlayerData(string key, object value)

if(!playerDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access player data for unregistered key '{key}'.");
return;
RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist.");
}

SteamMatchmaking.SetLobbyMemberData(Lobby, key.ToString(), value.ToString());
Expand All @@ -473,8 +469,7 @@ public static bool HasPlayerData(CSteamID player, string key)

if(!playerDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access player data for unregistered key '{key}'.");
return false;
RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist.");
}

string value = SteamMatchmaking.GetLobbyMemberData(MyceliumNetwork.Lobby, player, key.ToString());
Expand All @@ -497,8 +492,7 @@ public static T GetPlayerData<T>(CSteamID player, string key)

if(!playerDataKeys.Contains(key))
{
RugLogger.LogError($"Cannot access player data for unregistered key '{key}'.");
return default(T);
RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist.");
}

string value = SteamMatchmaking.GetLobbyMemberData(Lobby, player, key.ToString());
Expand Down

0 comments on commit 560c8c0

Please sign in to comment.