Skip to content

Commit

Permalink
Ensure BvServer messages are always cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachHembree committed Dec 1, 2020
1 parent 8db5fd3 commit e0dd4b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 10 additions & 7 deletions BuildVision2/Data/Scripts/BuildVision2/API/BvAPIMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@ private void ClientHandler(object message)

private object GetOrSetMembers(object data, int memberEnum)
{
switch ((BvApiAccessors)memberEnum)
if (BvMain.Instance?.CanUpdate ?? false)
{
case BvApiAccessors.Open:
return PropertiesMenu.Open;
case BvApiAccessors.MenuMode:
return PropertiesMenu.MenuMode;
case BvApiAccessors.Target:
return PropertiesMenu.Target?.TBlock;
switch ((BvApiAccessors)memberEnum)
{
case BvApiAccessors.Open:
return PropertiesMenu.Open;
case BvApiAccessors.MenuMode:
return PropertiesMenu.MenuMode;
case BvApiAccessors.Target:
return PropertiesMenu.Target?.TBlock;
}
}

return null;
Expand Down
3 changes: 1 addition & 2 deletions BuildVision2/Data/Scripts/BuildVision2/BvServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ private void SendServerMessages()
MyAPIGateway.Multiplayer.SendMessageToServer(serverHandlerID, protoMessages);
else
ExceptionHandler.WriteLineAndConsole($"Unable to serialize server message: {exception.ToString()}");
}

if (!ExceptionHandler.IsServer)
serverMessages.Clear();
}
}

/// <summary>
Expand Down

0 comments on commit e0dd4b7

Please sign in to comment.